Skip to content

CL-9384: migrate persisted approval stores to purge update_plan keys - #1186

Open
TheGreatAxios wants to merge 8 commits into
mainfrom
cl-9384-migrate-persisted-approval-stores-to-purge-update_plan-keys
Open

TheGreatAxios wants to merge 8 commits into
mainfrom
cl-9384-migrate-persisted-approval-stores-to-purge-update_plan-keys

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

One-time migration purges update_plan keys from persisted approvals files (session, project, global, provider-model stores). On-disk update_plan grants were dropped at load by normalizeSeededApprovals but never rewritten, so removing the normalizer later would resurrect the hole.

  • Backup-then-rewrite: pre-migration bytes saved to .bak (existing backup kept, so the first backup holds the true original); clean files untouched, no backup written
  • Idempotent: re-run is a no-op (purged 0, no new backups)
  • Reuses canonicalGrantTool as the single owner of is-an-update_plan-key, so disk and memory cannot disagree
  • Wired into loadSeededApprovals; load-time normalizer untouched as defense-in-depth
  • Missing/unreadable/corrupt stores are no-ops; backup failure skips rewrite

Verification: bun run typecheck (exit 0), targeted permission+session suites (589 pass), full bun test ./src ./tests ./evals ./scripts --randomize --seed 424242 (8025 pass, 0 fail), bun run lint (exit 0).

Fixes CL-9384

Advertise read/write/edit/delete/bash/grep/glob plus the control-plane.
Registry engines stay posix-named. Hidden aliases dispatch; grants
canonicalize both sides. Codex does not advertise apply_patch, shell,
or update_plan.

Fixes CL-8400
Authorize classified Codex command arrays as empty strings, so
reactor-gated hidden shell auto-allowed and the unwrapped script ran.
Stored update_plan grants canonicalized onto manage_tasks, so a
create-only plan approval auto-allowed full task lifecycle calls.
Coverage is now one-directional and seeders drop the narrow key.
Live requests never present as aliases (coerced before matching), so
tests presenting update_plan requests exercise an unreachable path.
Fail-closed pins and seeder tests remain.
@linear-code

linear-code Bot commented Sep 26, 2026

Copy link
Copy Markdown

CL-9384

Guard the session-start migration call so a future throw degrades to
log-and-continue, and route the migration rewrite through the shared
chained tmp+rename writer so a concurrent grant mint serializes with
the purge instead of losing an update.
A direct wx write of .bak can crash mid-write and leave a torn
rollback copy. The next start treats that EEXIST as success and
purges live anyway. Write the full backup to a sibling tmp, then
link it onto .bak so the name appears complete or not at all, and
a pre-existing original still wins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant