Skip to content

Fix premature Codex completion notifications - #5682

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-agent-notify-timing
Jun 18, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-agent-notify-timing

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • reproduced the premature notification on the pre-fix build after submitting a real Codex prompt in an Orca terminal
  • traced it to the process-exit backstop firing before/around hook completion, not to hook replay
  • debounce process-exit until an idle/non-agent process inspection repeats, and include process-exit in the cross-coordinator completion identity guard so hook and process observers do not duplicate notifications

Validation

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/agent-completion-coordinator.test.ts
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/hooks/agent-hook-completion-notifications.test.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • live pre-fix reproduction in Electron/CDP: real Codex prompt submission produced premature agent-task-complete from process-exit before the hook done event
  • live fixed sanity: no agent-task-complete attempts while Codex was running/idle in the reproduced window

@ghost

ghost commented Jun 18, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Expand completion identity types
2 Implement process-exit gating and identity tracking
3 Verify process-exit gating and deduplication
Open in Stage

Chapters generated by Stage for commit 4dc2038 on Jun 18, 2026 7:22am UTC.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eb8a0d16-089f-415e-a927-923a74b84e3f

📥 Commits

Reviewing files that changed from the base of the PR and between 290846cebd0ce3ac6bdc6bb125615bc110f005e8 and 4dc2038.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator.test.ts
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator.ts

📝 Walkthrough

Walkthrough

The CompletionIdentitySource type is extended to include 'process-exit'. A new per-coordinator field pendingProcessExitAgent is introduced to gate process-exit completions through a two-step confirmation: when handleProcessInspectionResult detects the foreground agent has changed, it now checks for child processes first (skipping dispatch and resetting pending state if any exist), then requires a second matching idle sample before dispatching, at which point a structured completionIdentity payload (source, identity, agentIdentity) is included. clearAgentRunEvidence and handleRecognizedProcess both reset pendingProcessExitAgent. Tests update the processResult helper with an explicit hasChildProcesses parameter and add coverage for the child-process guard behavior and cross-coordinator suppression.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. It lacks the required sections: Screenshots, Testing checklist, AI Review Report (cross-platform check), Security Audit, and Notes. Add missing sections from the template: Screenshots, Testing checklist results, AI Review Report with cross-platform validation (macOS/Linux/Windows), Security Audit summary, and Platform-specific Notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the main change: fixing premature Codex completion notifications, which is the core issue addressed in the PR.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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 and usage tips.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/fix-agent-notify-timing branch from 290846c to 4dc2038 Compare June 18, 2026 07:21
@brennanb2025 brennanb2025 changed the title Prevent premature Codex completion notifications Fix premature Codex completion notifications Jun 18, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Live notification timing verification on current commit 4dc2038c7:

  • Launched isolated Orca dev profile for /Users/thebr/orca/workspaces/orca/medaka via CDP on renderer 5174.
  • Codex: submitted a real terminal run; observed hook working first (toolName: Bash, toolInput: sleep 8), no agent-task-complete notification in the immediate post-submit window, then hook done with CODEX_NOTIFY_E2E_DONE and one agent-task-complete notification attempt at the same timestamp.
  • Claude: submitted a real terminal run; observed hook working first (toolName: Bash, toolInput: sleep 8), no new notification in the immediate post-submit window, then hook done with CLAUDE_NOTIFY_E2E_DONE and one agent-task-complete notification attempt at the same timestamp.
  • macOS dev notification delivery returned UNErrorDomain error 1, so I treated the main-process agent-task-complete notification failed to show log as dispatch-attempt evidence rather than OS banner delivery.
  • Re-ran focused tests after removing temporary trace logs: coordinator tests 43 passed; hook/PTY notification tests 178 passed.

@brennanb2025
brennanb2025 merged commit 20079a9 into main Jun 18, 2026
1 check passed
@brennanb2025
brennanb2025 deleted the brennanb2025/fix-agent-notify-timing branch June 18, 2026 18:51
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-text-zoom.test.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (78 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/app/h/[hostId]/session/[worktreeId].tsx
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-html.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (341 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/main/text-generation/commit-message-text-generation.test.ts
#	src/main/text-generation/commit-message-text-generation.ts
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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