Skip to content

fix(native-chat): preserve accepted command outcomes across agent startup - #31605

Merged
brennanb2025 merged 14 commits into
mainfrom
brennanb2025/codex-goal-composer-clear
Oct 24, 2026
Merged

brennanb2025 merged 14 commits into
mainfrom
brennanb2025/codex-goal-composer-clear

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​402 $\color{#cf222e}{\Huge{\mathbf{−}}}$​137 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​265
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​218 $\color{#cf222e}{\Huge{\mathbf{−}}}$​176 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42

Setting a goal in a fresh or resting Codex chat could start the goal while leaving its objective and Goal chip in the composer. Startup changes the runtime generation before the reply arrives, and the renderer discarded the successful reply as stale.

Each native chat command now keeps its actual result. An accepted goal clears unchanged submitted content; failed goals and newer writing remain available. The command finishes against its original chat while late notices, focus and scrolling apply only to the view that issued it.

  • Stop, Answer and prompt Cancel retain their original host and request identity through capability discovery, including after the view closes.
  • Queue Clear finishes every selected card through the existing eight-worker limit and releases busy controls. Delete notices and Resume’s late scroll stay scoped to the issuing view.
  • Typed commands settle the original draft. Rewind returns captured text/images after success or a genuinely unknown outcome, preserving newer writing.
  • Repeated named Stop on an older host shares the pending request and its truthful result. A current press can report failure once even if the first view has closed; callers handling their own failures remain silent by default.

Direct goals retain submitted content until acceptance because a refused goal removes its transcript row. Existing host admission, older-host requests and ordinary message sending stay supported. No wire format, saved-data schema, agent implementation, new control or screen layout changes are included.

This takes the full review path: asynchronous action ordering spans eleven renderer production files and follows repeated generation-based reply exceptions. Four rounds are complete, with no new finding in round four. All confirmed findings are fixed. Final whole-mechanism reference, readiness and performance source reviews are complete; differences from the common pattern are intentional and grounded in mixed-host compatibility and draft preservation. No live performance measurement is claimed.

Validation on reviewed head f8269878a1af8395436ab49d22edfcd1183be0d0:

  • Full CI workflow 40003934983 passed, including its final aggregate.
  • The incorporated-main head passed 311 tests across 17 explicitly selected files, including Hangul/Japanese composition and acceptance-time draft settlement. The final test-only commit added current/obsolete already-sent Delete/Clear contracts; all 12 queue tests passed and were independently reviewed. All eleven authored production blobs remain unchanged from the final source-reviewed implementation.
  • Every authored flow is native-chat UI: composer/result settlement, prompt controls, queue controls and local presentation. Under the current review QA table these require renderer tests plus CI (qa=tests). No authored lifecycle/recovery, process ownership, Windows/WSL process or login flow requires a real QA round, and screen appearance is unchanged.
  • Extra live observations with Claude and Codex cover accepted Goal clearing, a real IME suffix reply, ordinary replies, Claude commands/options, question answer/cancel, approval and named Stop. These are partial extra evidence, not a claim that every live scenario passed. Full rewind/disposal and saved-card action scenarios were not completed. Screenshots and limitations are in the review status comment.

Remembered option preferences (tracked in #31208), pending-goal interaction, post-reply rewind catch-up, older-host answer feedback, Stop sharing across a full remount and failed-action queue refocus remain separate existing observations. No new capability, default or support change is included.

Extra QA observations in unchanged code are tracked separately in STA-11942 (foreground Stop label) and STA-11943 (Claude rewind missing resume point). Their source traces and evidence limits are preserved in the review status comment.

Setting a goal starts the agent when none is running, which moves the
session's runtime fence before the host answers. The composer dropped
that successful answer as stale, so the objective and Goal chip stayed.
Keep the reply for goal changes as for the other writes that may start
the agent.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 21, 2026 19:54
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

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.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 85893fb3-1c20-4625-bf14-97040e744b09
📥 Commits

Reviewing files that changed from the base of the PR and between 3e74a50 and d13e138.

📒 Files selected for processing: 10
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageList.in-flight.test.tsx
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageList.test.tsx
  • src/renderer/src/components/native-chat/structured-agent-session-prompt-response.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-question-answers.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.resume.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Structured session writes now settle independently of whether the originating pane is still current. Composer submissions, rewinds, queued-message operations, and queue-resume reveals capture presentation state and gate late UI updates against it. Rewind content is returned for completed or outcome-unknown operations even when the pane closes. Tests cover these behaviors and update transport fixtures to provide the presentation-capture callback.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to d13e1

A Stop issued after a runtime fence change can appear successful without sending its own request if an earlier Stop is still pending. This narrow case should be fixed or explicitly accepted before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 29.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 34 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preserving accepted native chat command outcomes across agent startup.
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.
Description check Passed The description is detailed and directly explains the problem, solution, scope, compatibility behavior, testing, CI status, QA limitations, and related issues. It does not follow every template headin…
Full details: Description check

Explanation

The description is detailed and directly explains the problem, solution, scope, compatibility behavior, testing, CI status, QA limitations, and related issues. It does not follow every template heading: the ELI5, explicit Visual Proof, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist sections are not separately completed, and no Fixes # issue reference is provided. These omissions are non-critical because the required context is substantially present.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

❤️ 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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Add capturePresentation to the default… · NativeChatInterruptedContinue.test.tsx:137-146

src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx:137-146
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add capturePresentation to the default transport in Harness.

capturePresentation is now a required property of NativeChatStructuredComposerTransport. The fallback transport object in Harness (the props.transport ?? {...} branch) does not define it. Typecheck fails with TS2322 at line 137, as the pipeline log shows. This blocks the static analysis and typecheck job.

The other fixtures in this file already received the stub at lines 391 and 518. Add it to this fallback too.

🐛 Proposed fix
     transport: props.transport ?? {
+      capturePresentation: () => () => true,
       send: () => true,
       dispatchCommand: async () => ({ handled: false, accepted: false, error: null }),

Source: Pipeline failures


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3383cf42-bdd2-466a-90b5-9646b97f8fd2
📥 Commits

Reviewing files that changed from the base of the PR and between 52f6960 and c08c7a6.

📒 Files selected for processing: 28
  • src/renderer/src/components/native-chat/NativeChatComposer.resume-command.test.tsx
  • src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageList.in-flight.test.tsx
  • src/renderer/src/components/native-chat/NativeChatQueuedMessageList.test.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-draft-lifecycle.test.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-types.ts
  • src/renderer/src/components/native-chat/native-chat-image-references.test.tsx
  • src/renderer/src/components/native-chat/native-chat-structured-send-composition-clear.test.tsx
  • src/renderer/src/components/native-chat/native-chat-submission-navigation.test.tsx
  • src/renderer/src/components/native-chat/structured-session-takeover-report.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-submit.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-submit.ts
  • src/renderer/src/components/native-chat/use-native-chat-rewind.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-rewind.ts
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-send.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-send.ts
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-transport.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-command-start-failure.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.resume.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-rewind.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session.ts
  • src/renderer/src/components/native-chat/use-structured-native-chat-submit-reveal.test.ts
  • src/renderer/src/components/native-chat/use-structured-native-chat-submit-reveal.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Include the host and press fence in the Stop… · use-structured-agent-session-mutate.ts:172

src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts:172
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include the host and press fence in the Stop deduplication key.

On an older host, a second Stop with the same fields can arrive after the runtime fence changes. This key joins the earlier request, so the second Stop is never sent with its captured fence and can report the earlier Stop’s success. Include hostKey and pressedFence in the key so only requests for the same host generation join.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1ba8d08-703a-4294-8125-af8260633758
📥 Commits

Reviewing files that changed from the base of the PR and between c08c7a6 and 915f5af.

📒 Files selected for processing: 8
  • src/renderer/src/components/native-chat/NativeChatComposer.paste-remount.test.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.test.tsx
  • src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-prompt-recall.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-command-start-failure.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
  • tests/e2e/cross-version-wire/agent-session-clear-old-client.unit.test.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@brennanb2025 brennanb2025 changed the title A Codex goal clears the composer when Codex wasn't running yet fix(native-chat): preserve accepted command outcomes across agent startup Oct 21, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Setting a goal in a fresh or resting Codex chat could start work but leave the objective and Goal chip in the composer. The renderer treated the startup generation change as authority to discard a successful command reply. This PR retains the actual result and settles captured content in the original chat, while late notices, focus and scrolling stay with the view that issued the action. Failed goals and newer writing remain available.

Four review rounds complete, no open attributable findings. Reviewed head: f8269878a1af8395436ab49d22edfcd1183be0d0. Earlier fixes preserve overlapping command/rewind results, admit Stop/Answer/Cancel before capability preparation, finish every selected Clear child through the existing eight-worker scheduler, and let one current older-host Stop caller report a shared failure once without changing the raw result. The final whole-mechanism reference comparison and readiness/performance source passes are complete. Differences from the common pattern are intentional for mixed-host compatibility and captured draft preservation; none is an untracked temporary workaround.

Validation: current-head CI 40003934983 passed, including its final aggregate. The incorporated-main head passed 311 tests across 17 explicitly selected files, including Hangul/Japanese composition and acceptance-time draft settlement. The final test-only commit passed all 12 queue tests and independently verified current/obsolete already-sent Delete/Clear contracts. Main merge 9d55b73 incorporated a9d242d16 automatically; all 11 authored production blobs remained identical to reviewed 17fd9585. Final f8269878 changed only the queue test file.

QA classification: qa=tests. Every authored flow is native-chat UI: direct/typed Goal and IME draft settlement; command/options results; rewind content and local presentation; Stop/question/approval controls; saved-card controls; current/obsolete notices and reveal. Renderer contracts and CI cover these flows under the current review table. No authored lifecycle/recovery, process ownership, Windows/WSL process or login flow changed. Screen appearance is unchanged, so no screenshot run was required. The real-agent run begun under the earlier table was stopped; its partial observations are extra evidence only.

Extra live evidence and limits: actual Codex Goal acceptance cleared the submitted composer/chip and produced its own reply; a real CDP IME composition retained 확인, and a bounded subsequent send received 확인했습니다. Actual Claude/Codex ordinary replies, Claude commands/options, question Answer→ALPHA31605, question Cancel→Interrupted, approval Allow and named task Stop were observed. The initial IME suffix was rejected before provider start and does not count as delivery. Full rewind/disposal, saved-card actions and the former complete provider matrix were not completed or claimed passed. Automatic mid-turn queue admission is dark; shipped saved-card actions remain supported and covered by renderer contracts.

Observed in QA, not caused by this PR

  • STA-11942: one foreground Claude Stop returned cancelled:true but displayed “Worked for 4s / Cancellation requested.” The next send worked. The bounded trace confirms identical Stop arguments, immediate dispatch and host/status path on incorporated main; the PR does not write terminal turn verdicts. Target provider/event ordering was not captured, so its root cause remains unresolved and this is not a Stop PASS.
  • STA-11943: rewind returned “fork is missing its resume point” from provider transcript code identical to main. The renderer sends the same itemId/expectedEpoch. Replacement content/image/caret stayed stable through the actual held error and no obsolete notice appeared; successful rewind/handback was not established. Both follow-ups are unassigned in Chat UI.

Existing observations outside this cut remain separate: remembered options (tracked in #31208), pending-goal interaction, post-reply rewind catch-up, unrepresentable older-host answer feedback, Stop sharing across a full remount and failed-action queue refocus. No new capability/default/support choice or live performance measurement is claimed.

For Brennan’s review

These are actual branch screenshots, not matched main/branch comparisons. No main live comparison completed.

Observed result Screenshot
Codex Goal reply; submitted composer/chip empty. The separate goal remains active in this frame. Accepted Goal with cleared composer
Delivered IME suffix retry and its own reply. IME suffix and reply
Claude question answered, followed by ALPHA31605. Claude answer result
Claude named background task stopped. The same frame preserves the separate foreground Stop-label observation described above. Named task stopped
Distinct replacement editor retained its text/image after the original floating editor closed and the real rewind error arrived. This frame does not show a successful rewind. Replacement draft preserved after rewind error

Cleanup verified: owned apps, keepers, driver and terminals stopped; generated bundles restored and tracked checkout clean. QA ticket1889 released. Real config audit recorded a changed Codex config hash; Claude settings/hooks hashes unchanged. No real config contents were copied or restored.

Three places for human judgment:

@brennanb2025
brennanb2025 merged commit c84817e into main Oct 24, 2026
33 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/codex-goal-composer-clear branch October 24, 2026 00:11
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