You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(orchestration): start chat workers with their coordinator chat's permission - #49380
When you set a chat to Full access and it starts helper workers, those workers used to start in "Ask for approval" anyway, so their approval cards kept popping up in your chat. Now a new worker starts with the same permission as the chat that started it, and never with more.
What Changed
Before: a new chat worker always took the global default permission from Settings. A coordinator chat in Full access, with the default left at Ask, got Ask workers, and every command they ran showed an approval card in the coordinator ("1 worker · 1 needs you").
After: a new local chat worker takes its coordinator chat's permission at the moment the start is accepted:
the same mode when the worker's agent offers it, otherwise Ask;
Ask while the coordinator's pick has not taken effect yet: its saved mode and the mode its agent is running in differ, or its agent still needs a restart to apply it;
Ask when the coordinator chat has no saved mode, since it runs in Ask;
"agent settings" carries over only to a worker running the same agent, once it is in effect; a worker on a different agent gets Ask.
A follow-up that has to start a fresh chat for a finished worker follows the same rule; a follow-up that reopens or reaches an existing chat leaves that chat's own mode alone.
Unchanged: terminal workers, coordinators that are not chats, remote workers, existing workers, and every setting. The coordinator is the chat the request comes from, never one named in the request.
Users may notice: with the global default at Full access and a coordinator chat in Ask (or a mode the worker's agent lacks), workers now start in Ask and their approval cards appear in the coordinator.
Why
A chat's permission is the user's choice for that piece of work, and workers do that work. Taking the coordinator's mode keeps a Full access chat from producing approval cards from its own workers. Falling back to Ask when the mode doesn't match (rather than picking the "nearest" mode) means a worker can never do something its coordinator would have asked about.
Linked Issue
Reported in-app.
Visual Proof
Tested on Windows with a signed-in Antigravity CLI. The global default was Ask for approval throughout, except in the second row.
Coordinator chat
Worker
Worker starts in
Antigravity, Full access
Antigravity
Antigravity, Full access
Codex
Antigravity, Ask (global default Full access)
Antigravity
Antigravity, Accept edits
Codex (no Accept edits)
Full access coordinator with its workers: no "Needs you".
Full access worker reopened after a restart: still Full access, and its command ran without a card.
Testing
Unit test drives worker start through chat creation for: Full access; Ask under a Full access default; an unsupported mode; "agent settings" on the same and on a different agent; a pending switch (including a chat that reports no running mode, a pick that still needs a restart, and a pending switch to "agent settings"); "agent settings" still in effect after a plan approval; a chat with no saved mode; a follow-up that starts a fresh chat; a reopened chat keeping its own mode; non-chat callers. Every case that this change affects fails without it.
Real agents on Windows (Antigravity CLI, Codex, Claude):
an Antigravity coordinator in Full access started Antigravity and Codex workers: both in Full access, the Antigravity worker launched without approvals, no cards, and the commands ran;
an Ask coordinator under a Full access default started an Ask worker, whose cards reached the coordinator;
an Accept edits coordinator started a Codex worker in Ask;
a worker reopened after a graceful restart kept Full access;
a worker started with --deps, and one started from a Claude coordinator, both got Full access.
Before this change, on the same setup, Full access coordinators got Ask workers and "1 worker · 1 needs you" cards.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because this reads one saved chat record once per worker start.
Risk
The riskiest part is a worker getting a different permission than before: wider when its coordinator chat is in Full access, narrower when the coordinator is in Ask but the global default is Full access. Users can still change a worker's permission from its chat afterwards. A plain revert restores the old behavior; workers created while this shipped keep their saved mode.
Level: Medium
AI Disclosure
Review
Independent code review, regression review and performance review on the final head.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Problem. A chat set to Full access kept showing command approval cards. The cards came from the workers it started: a new worker always took the global default permission (Ask) rather than its coordinator chat's.
Change. A new local chat worker starts with its coordinator chat's permission, never with more:
the same mode when the worker's agent has it, otherwise Ask;
Ask while the coordinator's pick has not taken effect yet;
Ask for a chat with no saved mode;
"agent settings" only for a worker on the same agent, once it is in effect.
Terminal and remote workers, follow-ups, existing workers and all settings are unchanged.
Fixed during review.
A chat that doesn't report the mode it is running in could hand workers Full access during a pending switch; it now uses the mode the chat was launched with.
A chat with no saved mode now gives Ask.
"Agent settings" no longer carries across different agents.
The description now matches the diff.
Also fixed. A follow-up that has to start a fresh chat for a finished worker now follows the same rule; reopened chats keep their own mode. A chat on "agent settings" that reports a concrete mode after a plan approval still passes "agent settings" on.
Deferred.
A Codex worker's approval card shown in the coordinator has no Deny button (same before this change).
Verified.
Unit test of the permission decision, which fails without the change.
Changed-files checks.
Two performance scans, both passing.
An independent regression review that found no issues.
Real Antigravity, Codex and Claude runs on Windows. The screenshots are in the description:
Full access and Ask coordinators;
a mode the worker's agent lacks;
a worker reopened after a restart;
a dependent start;
Claude, Codex and Antigravity coordinators, rechecked on the final head.
Remaining. None. Full CI passed on the final head.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
No actionable comments were generated in the recent review.
Walkthrough
Worker starts now capture eligible coordinator chat permission and pass it through local placement into structured worker launch options. The permission snapshot checks saved, running, and child launch modes, plus acquisition status. A parent's own mode becomes ask when the parent and worker agents differ. Question-link preparation now uses a dedicated helper.
Merge Risk: Minimal · up to ea28c
Worker chats now start with their coordinator chat's permission, and fall back to Ask when the coordinator is mid-switch or the mode cannot be confirmed. No concrete merge-blocking risk remains. Any ambiguity errs toward more approval prompts, not more access.
Pre-merge checks: 3 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description covers the main content well. It has a clear ELI5, a detailed What Changed section with before and after behavior, a Why section, a Testing section, a Performance answer, and a Risk se…
1) Link a real issue in the Linked Issue section, using the form "Fixes #". The template requires one, and "Reported in-app." does not satisfy it. 2) Fill in the AI Disclosure section, or state that no AI was used if the team's poli…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: new chat workers started by a coordinator chat now take that chat's permission mode. The changeset adds snapshotCoordinatorChatPermission, passes parentPermission thro…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: new chat workers started by a coordinator chat now take that chat's permission mode. The changeset adds snapshotCoordinatorChatPermission, passes parentPermission through startLocalWorker and placement, and adds tests for the seeding rules. The title uses a conventional commit prefix and stays specific, though it omits the Ask fallback rules.
Full details: Description check
Explanation
The description covers the main content well. It has a clear ELI5, a detailed What Changed section with before and after behavior, a Why section, a Testing section, a Performance answer, and a Risk section with a level and rollback path. Several required items are missing or incomplete. The Linked Issue section says only "Reported in-app." and has no issue reference, but the template requires an actual linked issue ("Fixes #"). The AI Disclosure section is empty. The Review section is a single line and the template does not ask for it. The Agent skill upstream boundary box is checked, which is acceptable. The Visual Proof section contains images, but the template asks for a BEFORE and AFTER that can be switched; the images are shown as a table of mixed scenarios rather than before/after pairs. The Performance answer is short and states the work done per start, which is acceptable. The Testing section lists a unit test scope but does not give the exact test command or platform list for automated tests beyond Windows real-agent runs. The checklist is marked complete, including pnpm lint/typecheck/test/build, but the PR objectives say later heads did not run those commands, so this claim conflicts with the objectives.
Resolution
Link a real issue in the Linked Issue section, using the form "Fixes #<number>". The template requires one, and "Reported in-app." does not satisfy it. 2) Fill in the AI Disclosure section, or state that no AI was used if the team's policy requires it. 3) Provide a clear BEFORE and AFTER visual pair for the UI behavior change, as the template asks, instead of mixed scenario images only. 4) Correct the checklist items for lint, typecheck, test, and build so they match the commands actually run on the final head, since later review notes say they were not run. 5) Optionally state the platforms tested for automated tests and remove the empty Review section or fill it with the relevant details.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Performance result: PASS. No introduced P0/P1 performance finding in origin/main...ea28c79161c59bca07108f897df8a84b4a4d6ca5 (merge base 15a48329252a2f72fb94f069a1e490f3b767e8b4; main resolved to f0ddb491f81ec33df18f5ce62e294e8463ec3e55). Static source review only.
Work inventory — trigger → population/work → bound and lifetime:
Worker start, including a fresh follow-up: worker-start-method.ts:80 calls the new snapshot once before asynchronous preflight. Explicit remote and reused-terminal starts skip it; absent caller/host/record/permission support returns early. It reads one record map entry, one live-child map entry and at most two adapter getters for one coordinator. Runs on the executing runtime's main JS thread; no added filesystem/SQL/network/process operation.
Snapshot normalization: worker-chat-permission.ts:17 performs one provider membership lookup (at most 22 entries) and one mode lookup (at most four entries), then returns two scalar fields. Adapter routing uses a session-keyed map; the two native adapters read session-local fields/maps. ACP may call acpRunningPermission twice: at most two scans of that session's C config entries plus two searches of at most four permission mappings (acp-structured-options.ts:316). C is provider-supplied, not globally capped; no model-choice arrays, transcripts or fleet inventory are traversed. This is request-scoped work to resolve the current permission, with no retry or background cadence.
Local start → placement → surface creation: local-worker-start.ts:196 and worker-start-agent-placement.ts:267 pass the same two-field snapshot through existing argument objects. One snapshot per active start; no new registry, listener, timer, child or queued job. Settling/failing a start releases its transient references through the existing start lifetime.
New structured worker creation: worker-placement-topology.ts:110 adds one provider lookup (≤22), one mode lookup (≤4), and copies at most four already-narrowed seed keys into an options object with one permission key. One target worker consumes it. Existing creation validation/overlay/persistence receives one enum value (≤12 ASCII bytes); no additional create, acquisition, transaction or publication call. Unsupported agents retain their existing selection; reopening a retained conversation bypasses this new-create seed.
Question-link extraction: worker-question-link.ts:28 adds one short-lived return object holding the existing params and receipt wrapper. The previous link/reminder queries, optional params copy, receipt wrapping and closure execute once in the same order with the same predicates; zero additional queries or collection passes. No new question/history-dependent amplification.
Changed test cases and harness fields add no app-runtime work. The structured-worker session comment and permission type imports add no runtime operations.
Fleet pricing (source counts, not timings): for S starts/s, added provider comparisons are ≤44S and mode comparisons ≤8S; ACP adds ≤2CS config visits and ≤8S mapping comparisons. There is no multiplication by mounted owners. At 750 versus 7,500 worktrees, 100 versus 1,000 agents, or 10× repos/terminals/chats/history/refs/remotes, a single start has the same counts for a fixed coordinator config. A burst of 100 versus 1,000 starts costs 100 versus 1,000 snapshots, not a fleet scan per start. Added idle wakeups are structurally 0/s on main, renderer and daemon; no new recurring source exists.
Six-question disposition:
Skip gates: reviewed; remote/reused-terminal requests skip the snapshot, other early exits precede adapter reads. A start later rejected or reopened can pay one snapshot; it must precede preflight to freeze the start-time permission.
Ownership: reviewed; one requesting coordinator and one created worker, no mounted-consumer fanout. No subscription/publication changed, so listener census is not applicable.
Thread/storage: reviewed; main-thread map/scalar work and the ACP config scans priced above. Existing create storage and question-link SQL call counts are unchanged.
Growth/progress: reviewed; added work is bounded by one start and its coordinator's C options, with no retries, global discovery, history reads or new pending queue.
Host: reviewed source routes for macOS/Linux/Windows local execution and remote/terminal exclusions. No new host probe, shell command, WSL operation or SSH round trip. Host timing was not measured.
Cleanup/idle: reviewed; transient snapshot/options only, existing ownership and failure cleanup unchanged, no new persistent resource or idle trigger.
Touched regression classes: hot-path rescans matched and scoped to ≤2C targeted ACP option visits per explicit start; no repeated fleet/history scan. Expensive work newly reachable past a gate was checked: the new adapter getter calls are reads, not acquisition/control writes. Sync SQLite, whole-file writes and no-op publication candidates from the extraction were disproved as additions by matching the old call sequence. Eager imports were checked: a small snapshot module is added; permission tables, host registry and caller utilities were already on this start graph, with no newly eager SDK/adapter construction. No other class has matching added code.
Coverage: all 11 changed files, start/follow-up/reopen and failure routes, host record/child reads, adapter router and native/ACP permission getters, permission support tables, seed narrowing and structured-create option overlay. The new permission cases and retained-follow-up assertion were inspected, not executed. No tests, typechecks, builds, benchmarks or pnpm commands were run. Latency, CPU and heap effects across hosts remain unmeasured; the verdict concerns the source-proven work counts above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
When you set a chat to Full access and it starts helper workers, those workers used to start in "Ask for approval" anyway, so their approval cards kept popping up in your chat. Now a new worker starts with the same permission as the chat that started it, and never with more.
What Changed
Why
A chat's permission is the user's choice for that piece of work, and workers do that work. Taking the coordinator's mode keeps a Full access chat from producing approval cards from its own workers. Falling back to Ask when the mode doesn't match (rather than picking the "nearest" mode) means a worker can never do something its coordinator would have asked about.
Linked Issue
Reported in-app.
Visual Proof
Tested on Windows with a signed-in Antigravity CLI. The global default was Ask for approval throughout, except in the second row.
Full access coordinator with its workers: no "Needs you".
Full access worker reopened after a restart: still Full access, and its command ran without a card.
Testing
Unit test drives worker start through chat creation for: Full access; Ask under a Full access default; an unsupported mode; "agent settings" on the same and on a different agent; a pending switch (including a chat that reports no running mode, a pick that still needs a restart, and a pending switch to "agent settings"); "agent settings" still in effect after a plan approval; a chat with no saved mode; a follow-up that starts a fresh chat; a reopened chat keeping its own mode; non-chat callers. Every case that this change affects fails without it.
Real agents on Windows (Antigravity CLI, Codex, Claude):
--deps, and one started from a Claude coordinator, both got Full access.Before this change, on the same setup, Full access coordinators got Ask workers and "1 worker · 1 needs you" cards.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because this reads one saved chat record once per worker start.
Risk
The riskiest part is a worker getting a different permission than before: wider when its coordinator chat is in Full access, narrower when the coordinator is in Ask but the global default is Full access. Users can still change a worker's permission from its chat afterwards. A plain revert restores the old behavior; workers created while this shipped keep their saved mode.
Level: Medium
AI Disclosure
Review
Independent code review, regression review and performance review on the final head.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)