Skip to content

refactor(agent-status): drop two superseded Codex attention workarounds - #21844

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/remove-superseded-codex-attention
Sep 21, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/remove-superseded-codex-attention

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83 $\color{#cf222e}{\Huge{\mathbf{−}}}$​775 $\color{#cf222e}{\Huge{\mathbf{−}}}$​692
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58 $\color{#cf222e}{\Huge{\mathbf{−}}}$​271 $\color{#cf222e}{\Huge{\mathbf{−}}}$​213

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.ts and 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 CompletionState rather 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-authoritative live / unverifiable / exited verdicts are unchanged.

Why

Codex fires its PermissionRequest hook 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's approvals_reviewer from the rollout at write time and keeps a reviewer-owned approval in working, 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 under Never Codex's approval path skips the prompt and fires no PermissionRequest at 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.
  • oxlint over all 22 changed files — clean. (Verified the linter was actually inspecting them with a deliberate-violation control first; passing a file list to oxlint without splitting it silently reports "no files found".)
  • pnpm run check:code-quality:changed — passes, 0 findings across all seven gates.
  • pnpm test over 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.
  • One unrelated pre-existing flake: browser-process-user-agent-ordering.test.ts hits 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 whole src/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.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

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 on waiting and on blocked, 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

  • Not applicable.

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: getAgentLaunchConfigForStatusMetadata on the renderer store, and getAgentStatusLaunchConfigForPaneKey on 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 (getAgentLaunchConfigForStatusEntry is 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

  • 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)
  • 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)

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.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 3e4a64c4-cbd3-4698-b686-a625b8f579b1

📥 Commits

Reviewing files that changed from the base of the PR and between c657145 and f4f384d.

📒 Files selected for processing (9)
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator-attention-dispatch.test.ts
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator-hook-title-precedence.test.ts
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator-process-cadence.test.ts
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator.ts
  • src/renderer/src/components/terminal-pane/agent-completion-inspection-result.ts
  • src/renderer/src/components/terminal-pane/agent-completion-process-monitor.ts
  • src/renderer/src/components/terminal-pane/agent-completion-process-types.ts
  • src/renderer/src/components/terminal-pane/agent-completion-stale-evidence-backoff.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-hook-completion-side-effects.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the removal of two superseded Codex attention workarounds.
Description check ✅ Passed The description is complete and directly matches the changes. It covers the user impact, implementation, rationale, linked issues, visual proof, testing, platform considerations, and checklist. The AI…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts and 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. completionState is now typed from the exported CompletionState instead 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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 pendingProcessExitAgent with a timestamped pendingProcessExit and gated local process-exit dispatch 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 clears pendingProcessExit, 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-exit after 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).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Grok QA evidence (PR #21844)

Review-only Electron + throwaway Linux Docker SSH run against HEAD f4f384db18b3ecc18b2181ed61acd0f6d35b0d0e (brennanb2025/remove-superseded-codex-attention). Identity: Orca: brennanb2025/remove-superseded-codex-attention.

Producer-owned Codex PermissionRequest classification was exercised through the real remote hook server (POST from inside the container to the relay hook port, with rollout files on /work/demo-project). Auto-reviewed (approvals_reviewer=auto_review) stayed working. Human-owned (approvals_reviewer=user) became waiting immediately (status event ~4ms after the POST). This activity surface labels that bucket Working / Waiting for input; the worktree card shows Needs permission and the tab shows Needs attention / Codex - action required.

OS notification timing cannot be proven from a still image. Renderer window.Notification was patched and did not fire (Electron delivers banners from main). Pair the screenshots with the hook timestamps in /tmp/pr21844-grok-qa.md.

Auto-reviewed Codex PermissionRequest stays Working

Human-owned Codex PermissionRequest is Waiting for input

SSH worktree card: Needs permission + Codex waiting row

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 codex 600 stand-in, and inspectProcess did return unverifiable; a full waiting-row transient-miss vs sustained-exit capture was not completed on the local PTY.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final review status: land

The review is clean at f4f384db18b3ecc18b2181ed61acd0f6d35b0d0e.

What the review established

  • The removed Codex-specific suppression is genuinely superseded. The execution host now classifies each PermissionRequest from rollout ownership: auto-review stays working; user-owned, missing, unreadable, or stale evidence stays waiting; request_user_input remains human-actionable.
  • Relay/local normalization preserves that producer verdict. The old launch-argument, title, renderer, direct-SSH, and notification suppressor consumers are no longer needed.
  • Initial review found one independent responsibility accidentally coupled to the deleted timer: transient local process-inspection misses could falsely complete a real human wait. That was fixed in f4f384db18 with an agent-neutral, bounded 1500 ms process-exit settle that resets on fresh or unverifiable evidence.
  • Re-review completed clean after 3 rounds. Final readiness found no remaining P0, P1, or P2 issues.
  • Performance/resource review is clean: no new polling, timer, subprocess, listener, persisted state, or unbounded collection. The existing process monitor stores one monotonic candidate timestamp.
  • No mobile-facing, persisted-state, or wire-schema surface changed. Cross-platform packaging and remote-host ownership remain intact.

Validation

  • Completion/PTY review suites: 17 files / 149 tests passed
  • Changed-path/ownership suites: 12 files / 121 tests passed
  • Focused ownership + settle QA: 3 files / 42 tests passed
  • pnpm tc, changed-code quality checks, formatting, and git diff --check passed
  • PR CI is green, including all 8 test shards, relay integration, Windows packaging, and changed Electron specs
  • Electron + disposable Linux SSH QA on this exact SHA verified the real relay hook path: auto-review remained Working and a human-owned permission became Waiting for input / Needs permission in about 4–6 ms

Visual evidence: #21844 (comment)

Residual gap: the live local PTY run observed the unverifiable reset path but did not capture the complete transient-miss-versus-sustained-exit waiting-row sequence. The focused regression tests pin both the 1500 ms settle and reset behavior; this is not a failing observation.

Verdict: land.

@brennanb2025
brennanb2025 merged commit afb618f into main Sep 21, 2026
36 checks passed
brennanb2025 added a commit that referenced this pull request Sep 21, 2026
…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.
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