Repository navigation
refactor(agent-status): drop two superseded Codex attention workarounds - #21844
Conversation
Codex fires its PermissionRequest hook as decider #1, before its own auto-reviewer and before the user, so the event never meant "a human is blocked". #21389 fixed that at the source: the execution host reads the turn's approvals_reviewer from the rollout at write time and keeps a reviewer-owned approval in `working`. Two older reader-side workarounds for the same bug are now redundant. The launch-argument suppressor guessed auto-approve mode by string-matching the launch args, then dropped the status row in the reader. It only matched Codex's bypass flag, and under that flag Codex's approval policy is `Never`, which takes the Skip path and fires no PermissionRequest at all. When the user turns on "Approve for me" inside a live session the args never change, so it never fired for the actually-reported case either. The Codex-only 1.5s notification quiet window could not do its job: measured auto-reviews take 3-20s and a human can answer in under a second, so no fixed constant separates them. Its deferred callback also re-checked liveness and returned without notifying, so a genuine prompt whose pane went non-live inside the window was dropped rather than delayed. Codex now notifies synchronously like every other agent. Also types the coordinator's completion state from the controller's exported CompletionState instead of asserting each field, which the changed-lines casting gate required once those lines moved.
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change removes Codex auto-approval suppression from status events, synthetic titles, hook completions, attention notifications, and process-exit handling. Codex waiting and blocked states now use the normal status, title, lifecycle, and attention paths. Codex attention dispatch no longer uses a quiet-window timer. Process-exit detection now requires two active polling intervals before confirmation. Related contracts, wiring, suppression code, and tests were updated. Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Important
The blip test was rewritten to drop its "no completion" assertion, and restoring that assertion fails: with the quiet window gone, a null-foreground read can now land a process-exit completion that the removed guard used to defer. This is a behavior change beyond timing, and the PR body describes it as timing-only. Details inline.
Reviewed changes
- Dropped launch-argument suppressor. Deleted
codex-auto-approval-notification-suppression.tsand every call site (status applicator, coordinator option, PTY-owned status path, terminal-title path, hook-completion coordinator, main synthetic-title driver). - Dropped Codex attention quiet window. Removed
CODEX_ATTENTION_QUIET_MS, its timer,clearPendingCodexAttention/hasPendingCodexAttention, and the plumbing through the notification controller, coordinator, hook observer, lifecycle, and process monitor/inspection-result. - Retyped coordinator state.
completionStateis now typed from the exportedCompletionStateinstead of per-field casts. - Tests. Deleted the suppressor suite and 12 subject-specific tests, rewrote the Codex attention tests to pin immediate notification, and trimmed fixtures for removed symbols.
The underlying premise checks out — resolveCodexApprovalOwnedState in src/shared/agent-hook-listener/providers/codex-events.ts maps a reviewer-owned PermissionRequest to working, so a waiting that reaches the readers is human-owned and the reader-side workarounds are genuinely superseded.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one documentation-accuracy note inline; the prior review's process-exit finding is addressed.
Reviewed changes
- Settled transient process-exit evidence. Replaced the flat
pendingProcessExitAgentwith a timestampedpendingProcessExitand gated localprocess-exitdispatch behind a 1500ms sustained-absence window (LOCAL_PROCESS_EXIT_SETTLE_MS), so the null-foreground blip the prior review flagged can no longer confirm exit. - Reset the exit candidate on liveness.
establishAgentEvidence()now clearspendingProcessExit, so an attention/title hook restarts the settle rather than sharing it with a prior miss. - Re-pinned the behavior in tests. The rewritten blip test now asserts no completion during the blip and exactly one
process-exitafter sustained absence; the coordinator cadence/precedence/side-effect tests were re-timed to match.
The prior IMPORTANT finding — that dropping the hasPendingCodexAttention() clause let a transient null-foreground read land a process-exit completion at ~750ms — is resolved by the settle: the test that previously could not keep its "no completion" assertion now asserts it and passes (51/51 across the five affected suites; pnpm tc:web and oxlint clean, pnpm tc OOM-killed in this sandbox only).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| ) => boolean | ||
|
|
||
| // Two foreground misses can span one process handoff; only sustained absence confirms exit. | ||
| const LOCAL_PROCESS_EXIT_SETTLE_MS = POLL_TIER_INTERVAL_MS.active * 2 |
There was a problem hiding this comment.
With this settle added, the PR body's claim that the process-exit deferral "went with it" no longer matches the code — a ~1.5s sustained-absence requirement now applies to every agent, not just Codex. Worth updating the body's "Tradeoff"/"Testing" sections so reviewers don't read the net behavior as notification-timing-only.
Grok QA evidence (PR #21844)Review-only Electron + throwaway Linux Docker SSH run against HEAD Producer-owned Codex OS notification timing cannot be proven from a still image. Renderer Local process-exit settle: unit tests pin a 1500ms (2×750ms) settle and reset on unverifiable inspections (42/42 in the cadence + attention + ownership suites). Live local PTY started and killed a |
Final review status: landThe review is clean at What the review established
Validation
Visual evidence: #21844 (comment) Residual gap: the live local PTY run observed the Verdict: land. |
…no callers (#22032) #21844 removed the Codex launch-argument attention suppressor, which was the last production caller of two launch-config lookups. Both were left in place for a follow-up; this is it. `getAgentLaunchConfigForStatusMetadata` (renderer store) looked a launch config up from a loose metadata bag. Its sibling `getAgentLaunchConfigForStatusEntry` takes a real status entry and still serves the one live consumer, cold restore resume startup. Deleting the metadata accessor also orphaned its `getLaunchConfigForStatusMetadata` helper and the `AgentLaunchConfigStatusMetadata` parameter type, so those go too. `getAgentStatusLaunchConfigForPaneKey` (main runtime) returned a pane's launch config behind a launch-token fence. Its two remaining references were assertions in the launch-authority retirement test. They were a second view of a state bit the test already pins: retirement nulls `pty.launchToken`, and the surviving `verifyOrchestrationCompatibilityCaller` assertion fails when it does not. Verified by ablation — disabling only the `launchToken` nulling fails that assertion with the accessor already gone, so no coverage is lost. Retirement never cleared `launchConfig` itself, so there was no second property hiding in those assertions. Test mocks that existed only to satisfy the removed store method are stripped; the tests themselves are about other behaviour and stay. No behaviour change.




ELI5
When Codex is set to approve its own tool calls, Orca's status chip used to flicker between "Working" and "Needs You", firing a notification each time. That was fixed properly in #21389. This PR deletes the two older patches that were trying to hide the same flicker, because they no longer do anything useful — and one of them could swallow a notification you actually needed.
What Changed
Two reader-side workarounds are removed. #21389 now owns approval classification at the source. A review-found dependency on the old timer is replaced separately in the process-monitoring domain: local foreground loss must remain sustained for a bounded settle interval before Orca reports process exit.
1. The launch-argument suppressor (
codex-auto-approval-notification-suppression.tsand all of its call sites).It tried to guess whether Codex was in auto-approve mode by string-matching the arguments Codex was launched with, and if it matched, it threw away the status row in the reader — in the renderer's status applicator, the notification coordinator, the PTY-owned status path, the terminal-title path, and the main process's synthetic-title driver.
Before: a Codex pane whose launch arguments exactly matched the bypass flag had its permission rows dropped, including for the dashboard pop-out window, which stopped receiving those events while the main window still got them.
After: every Codex permission row is treated the same as any other agent's, and both windows see the same events.
2. The Codex-only notification quiet window (
CODEX_ATTENTION_QUIET_MS, its timer,clearPendingCodexAttention, and the plumbing that carried it through the coordinator, lifecycle, hook observer and process monitor).Before: when Codex needed input, the visible status changed immediately but the OS notification was held back 1.5 seconds, hoping the pause would resolve itself and the notification could be cancelled.
After: Codex notifies at the moment the pause is reported, exactly like every other agent.
Two supporting changes came along for the ride. The coordinator's completion-state object is now typed from the controller's exported
CompletionStaterather than asserting each field individually. Local process-exit inference now owns a provider-neutral, time-bounded candidate: fresh hook, title, or recognized-process evidence clears it, while sustained absence still completes. Remote host-authoritativelive/unverifiable/exitedverdicts are unchanged.Why
Codex fires its
PermissionRequesthook as the first decider — before its own auto-reviewer and before the user. So the event never meant "a human is blocked", and both workarounds were attempts to guess, after the fact, which pauses were real. #21389 removed the guesswork: the execution host reads the turn'sapprovals_reviewerfrom the rollout at write time and keeps a reviewer-owned approval inworking, so a reviewer-owned pause never becomes a "Needs You" row in the first place.Why the launch-argument suppressor is dead. It only fired when the launch arguments exactly matched Codex's bypass flag. Under that flag Codex's approval policy is
Never, and underNeverCodex's approval path skips the prompt and fires noPermissionRequestat all — so there was nothing for the suppressor to suppress. And in the case users actually reported, where "Approve for me" is switched on inside a running session, the launch arguments never change, so it never fired then either. It was dead in both directions.Why the quiet window could not work, and could hurt. It cannot separate the two cases it exists to separate: auto-reviews have been measured at 3 and 20 seconds, and a human can answer in well under a second, so no fixed constant divides them. Worse, its deferred callback re-checked whether the pane was still live and returned without notifying if it was not — so a genuine prompt whose pane went non-live inside the window was dropped outright, not delayed. That is a silently lost notification, which is a worse failure than the flicker it was added to hide.
Alternatives considered. Keeping the quiet window and lengthening it: rejected, because the measured ranges overlap, so a longer window only widens the hole through which real prompts fall. Keeping the launch-argument suppressor as belt-and-braces: rejected, because a second guard beside a correct one only adds a way for the two to disagree, and this one is provably never reached.
Tradeoff a reviewer should weigh
The fix in #21389 is positive-evidence-only: if the rollout cannot be read, it falls back to
waiting. In that fallback a transient, auto-resolved approval will now ping immediately instead of being swallowed by the 1.5-second window. Given that auto-reviews were measured at 3 to 20 seconds, the window would not have swallowed those anyway, so in practice this should not reintroduce the flicker — but it is a real behavioural difference in the unreadable-rollout path, and worth a second opinion rather than being buried.Review found that the old notification timer also served an unrelated purpose accidentally: while it was pending, local process polling could not turn a transient "no foreground process" reading into task completion. Removing that guard allowed a real human-owned wait to receive a false completion and terminal-mode reset after clustered misses. The final implementation keeps immediate attention delivery, but replaces the accidental Codex-specific coupling with a provider-neutral process-exit settle interval. Fresh positive evidence cancels the candidate; sustained absence still completes after the bounded interval.
Linked Issue
Follow-up cleanup to #21389, which superseded both of these. The original flapping bug these workarounds targeted was #8387.
Visual Proof
N/A— this removes code that is unreachable (the launch-argument suppressor) or that only delayed an existing notification by 1.5 seconds (the quiet window). There is no new or changed UI surface; the observable difference is notification timing, which the automated tests pin directly.Testing
pnpm tc— passes.oxlintover all 22 changed files — clean. (Verified the linter was actually inspecting them with a deliberate-violation control first; passing a file list tooxlintwithout splitting it silently reports "no files found".)pnpm run check:code-quality:changed— passes, 0 findings across all seven gates.pnpm testover the agent-status, terminal-pane, notification and startup suites (src/renderer/src/hooks/,src/main/startup/,src/renderer/src/components/terminal-pane/, plus the shared Codex approval suite): 87 files / 753 tests pass.src/shared/agent-hook-listener-codex-approval-ownership.test.ts— untouched by this PR, 15/15 pass. That is the suite proving the real fix still holds without either workaround, including the "rollout cannot be read at all" fallback named in the tradeoff above.browser-process-user-agent-ordering.test.tshits its hard 30s timeout only in a single ~700-file parallel run. Confirmed pre-existing by checking out the base commit and reproducing the identical failure there; it passes alone and passes with the wholesrc/main/startup/directory.Platform: verified on macOS. The change is platform-neutral — it deletes renderer and main-process logic with no OS-specific branches, no path handling, and no shell invocation. SSH/remote is covered: the removed PTY-owned status suppression sat on the renderer-owned status path used by remote runtimes, and removing it makes remote Codex panes behave like local ones rather than differently.
Test handling, per file:
codex-auto-approval-notification-suppression.test.ts— deleted (all 14 tests; the file's entire subject is the removed module).agent-completion-coordinator-attention-dispatch.test.ts— 6 tests deleted (subjects were the removed timer or the removed suppression option), 6 rewritten to pin the new behaviour: Codex now notifies immediately onwaitingand onblocked, a second distinct pause still notifies, and the pause plus the turn's later completion both notify. Added coverage proves a Codex pause still notifies when the pane stops being live, fresh hook evidence resets a pending local process-exit candidate, transient foreground misses do not complete the turn, and sustained absence still does.agent-hook-completion-notifications.test.ts— 1 deleted ("fails open ... without launch proof"), 2 rewritten into plain "notifies for a Codex permission request" / "... blocked permission request" tests that still assert real notification behaviour.pty-connection-task-complete-dispatch.test.ts— 3 deleted (two suppression tests, plus a "does not resolve launch config for ordinary title changes" perf guard that is vacuous once nothing resolves launch config on that path), 1 kept and renamed (preserves synthetic Codex permission titles).useIpcEvents-agent-status-queue-ordering.test.ts— 1 deleted, 1 kept and renamed; the sibling test asserting the row stays actionable is now the unconditional behaviour.useIpcEvents-agent-status-pane-teardown.test.ts,main-window-structured-status-filter.test.ts,agent-completion-stale-evidence-backoff.test.ts— fixtures/mocks for removed symbols trimmed; assertions kept.Agent skill upstream boundary
Notes
Security: unchanged — no authorization, command, dependency, or network surface changes. Performance: less work per status event (no launch-config store read on every Codex permission row and no per-pause timer); local process monitoring retains its existing cadence and stores only one bounded candidate timestamp. Backwards compatibility: no wire, IPC-shape, or persisted-state change; remote host verdict semantics are unchanged.
One thing deliberately not removed, flagged for your call:
getAgentLaunchConfigForStatusMetadataon the renderer store, andgetAgentStatusLaunchConfigForPaneKeyon the main runtime, now have no production callers — this PR removed their last ones. I left both because each is a generic accessor over an existing registry with a live sibling (getAgentLaunchConfigForStatusEntryis still used by cold-restore resume), not plumbing built for these guards, and deleting them would touch roughly twenty test fixtures and the store contract for about fifteen lines — well outside a focused deletion. Happy to do it as a separate pass if you'd rather not leave them.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)