Skip to content

Fix Codex launch draft delivery after delayed setup - #12347

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/codex-tui-linear-injection
Aug 3, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/codex-tui-linear-injection

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

  • Reserve startup-draft delivery for the mounted terminal pane before its deferred PTY connection begins.
  • Prevent the creation sidecar's eight-second readiness budget from consuming a launch while setup still owns the PTY.
  • Add a regression covering sidecar contention followed by the delayed Codex composer-ready frame.

Screenshots

The Linear pointer is visibly present as an unsent Codex draft after a 12-second setup delay:

codex-linear-draft-after-fix.png

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Completed focused verification:

  • 540 tests in pty-connection.test.ts
  • 71 tests across new-workspace.test.ts and worktree-activation.test.ts
  • pnpm run typecheck:web
  • pnpm run check:max-lines-ratchet
  • oxfmt check on both changed files
  • All three Oxlint configurations on both changed files
  • Isolated Electron validation with real Codex after a 12-second setup delay; foreground PTY inspection confirmed Codex owned the terminal

AI Review Report

Reviewed the delivery-claim lifecycle for duplicate writes, abandoned mounts, deferred PTY connection, and setup-to-agent ownership changes. The main risk was claiming too early and leaving the launch token consumed; the existing dispose path still releases any unattempted claim, and the regression verifies that the competing sidecar cannot steal the active pane's launch. Cross-platform compatibility was checked for macOS, Linux, and Windows: this changes no shortcuts, labels, paths, shell commands, process recognition, or platform-specific Electron behavior, and the ownership logic is shared by local, SSH, and folder-workspace terminal paths.

Security Audit

No new command execution, prompt parsing, IPC, authentication, dependency, or filesystem behavior is introduced. The change only advances when an existing launch-token claim occurs, retaining its worktree/tab/token scoping and existing cleanup. The regression uses inert test strings, and no credentials or private data were added to the diff.

Notes

The complete changed-file quality wrapper could not parse pnpm's Node-engine warning under local Node 26; its three underlying Oxlint scans were run directly and returned zero diagnostics. The repository requires Node 24. Production Orca was not touched during Electron validation.

@coderabbitai

coderabbitai Bot commented Aug 3, 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 Plus

Run ID: 2b423d97-2a4c-430f-89b4-3a303a9a9364

📥 Commits

Reviewing files that changed from the base of the PR and between a7972b5 and f25ec3c.

📒 Files selected for processing (1)
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts

📝 Walkthrough

Walkthrough

The PTY connection now reserves startup draft-paste ownership before deferred connection setup begins. The deferred startup scanner reuses this ownership claim. A regression test verifies that setup output does not deliver the draft and that the draft is sent after the terminal emits a ready prompt.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the fix for Codex launch draft delivery after delayed setup.
Description check ✅ Passed The description covers the summary, screenshot, testing, AI review, security audit, and notes with relevant implementation details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f461513c-eea4-48de-8ed7-75a0b90ec5a2

📥 Commits

Reviewing files that changed from the base of the PR and between e25381c and acba856.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — final pushed head f25ec3ce8d

Validated in an isolated Orca dev instance attached to this exact worktree/branch.

  • Created a real PR-linked workspace from Fix Codex launch draft delivery after delayed setup #12347 with Codex, setup enabled, and Wait for setup to complete before starting agent enabled.
  • Setup completed in 27.9s, exceeding the old sidecar readiness window.
  • The rendered Codex composer showed exactly one unsent draft containing the PR title and URL.
  • Backing PTY inspection confirmed codex owned the foreground process and the main-owned buffer snapshot contained the same draft.
  • The focused lifecycle suites passed (540 PTY-connection tests plus 71 workspace/activation tests); the Claude --prefill route remains outside the paste-claim path and passed its companion coverage.
  • Performance check: no polling, scans, waits, timers, subprocesses, or provider fanout were added; this remains one existing Set/Map claim per pane connection.

No dedicated startup-draft reliability gate exists in config/reliability-gates.jsonc; accepted residual gap: SSH/WSL/mobile providers were not live-run for this renderer-only, provider-neutral ownership move. Local PTY behavior and disposal/release are covered deterministically and by the Electron run below.

Codex draft preserved after delayed setup

Codex draft preserved after delayed setup

Setup completion context

Setup completed in 27.9 seconds

@brennanb2025
brennanb2025 merged commit a7282fe into main Aug 3, 2026
42 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix: preserve Codex launch drafts through setup

* test: enforce single startup draft delivery

* test: name startup draft release behavior
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