Skip to content

Preserve uncertain goal text and accept distinct controls - #33022

Merged
brennanb2025 merged 7 commits into
mainfrom
brennanb2025/goal-control-fixes
Oct 25, 2026
Merged

brennanb2025 merged 7 commits into
mainfrom
brennanb2025/goal-control-fixes

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​278 $\color{#cf222e}{\Huge{\mathbf{−}}}$​142 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​136
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​45 $\color{#cf222e}{\Huge{\mathbf{−}}}$​66 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21

A lost goal reply could remove the submitted objective even when Codex applied it. Retrying that old unknown action could later overwrite a Pause, Clear, or replacement. A second distinct control could also be dropped while another request was pending.

Goal controls now keep uncertain objective text, replay only recorded results, and send each distinct action to the host. Set, Resume, Pause, and Clear identify the user as their source. Failure copy says when a change could not finish without promising the previous goal survived.

Changes

  • Keep the attempted objective when delivery is unknown; remove it only for a definite refusal or cancellation before dispatch.
  • Return the recorded success or original uncertainty on replay, without reissuing an old goal change based on current state.
  • Admit distinct Set, Pause, Clear, and Resume requests while another is pending; preserve the separate permission hold.
  • Use truthful partial-change wording and retire obsolete translations so supported languages fall back to the corrected English sentence.

Review path: full. This touches saved objective/outcome recovery and ordering. The endpoint and saved formats stay compatible; no saved field or public wire operation was added.

Temporary follow-up

Tracked in STA-11962: the existing direct-control path can still race Stop during activation and can reuse an earlier goal's identity/usage when its notification trails a rapid replacement. Removing the renderer latch exposes that rapid two-Set entry on one pane too. The follow-up will make goal Set and Resume owned turns on capable hosts. The partial response-only Stop compensator was removed from this patch before shipping.

Validation

Real Codex 0.163.0 was exercised on the M4Air at 12bd1463951c: Set, Pause, Resume, a distinct objective, Clear, a graceful upgrade of a main-created conversation, and two normal replies afterward. Captured requests identify the user as their source. Pending Pause/Clear and paused Resume also reached the provider; these timing checks briefly held genuine replies and retained host serialization.

Real Claude Code 2.1.310 (claude-opus-5-5) also completed two file-reading sends and two replies in one native chat on 18c42c605ecd, with an available composer and no Codex goal controls. Both isolated QA copies stopped gracefully and real-config hashes matched.

117 tests across seven explicit files passed on that QA head. Focused SQLite close/reopen proof retains the unknown objective and original receipt, and old-ID replay cannot override later Pause/Clear/Set. A later tests-only commit replays six recorded Codex notifications through the translator, actual SQLite journal, and banner goal projection; its three-test file passed. Localization catalogs and required pre-commit checks passed.

Evidence limits: the main-created goal completed before Pause arrived, so completed history was carried through the graceful restart. Unknown-outcome recovery and permission holds are established by tests. The failure-copy screenshot is a labelled renderer fixture. No activation-window Stop or replacement identity/counter-reset pass is claimed.

The required PR gate, lint/typecheck, all five unit shards, relay integration, persistence, and both package jobs passed on 18c42c605ecd. The separate WSL workflow also passed on the failed-job retry, including Fedora, Debian and Ubuntu; the first Fedora setup timed out before tests. The earlier main lint blocker was fixed by #33046, and the added test's type annotation was corrected before this run. Visual evidence is linked below.

Tracked in #31605.

Visual evidence

codex-main-goal.png
codex-restored-chat.png
codex-goal-active.png
codex-goal-paused.png
codex-goal-resumed.png
codex-goal-edited.png
codex-goal-cleared.png
codex-two-replies.png
pending-controls.png
pending-resume.png
goal-change-notice.png

claude-two-replies.png

@brennanb2025
brennanb2025 marked this pull request as ready for review October 24, 2026 03:36
@coderabbitai

coderabbitai Bot commented Oct 24, 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: 30797fbb-b912-4918-a818-b2ec5d0ab1b9
Commits

Reviewing files that changed from the base of the PR and between 12bd146 and 1539c4d.

Files selected for processing: 2
  • src/main/codex/__fixtures__/codex-app-server-goal-lifecycle.jsonl
  • src/main/codex/codex-structured-journal-goal-revision.test.ts

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

Walkthrough

The change updates Codex goal request origins and reports when a replacement fails after a successful clear. The agent-session layer retains journaled objectives after provider-call errors and replays only succeeded operations. The renderer tracks concurrent goal mutations, updates the enabled state of goal controls, and uses revised goal-change failure notices.

Priority: Normal

Merge Risk: Moderate · up to 1539c

A goal change that loses its response during cancellation could leave the goal active. Resolve or explicitly accept this risk 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 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 15 files. (1 skipped: … 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 summarizes the main changes: preserving uncertain goal text and accepting distinct controls.
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 provides a clear high-level explanation, detailed changes, rationale, linked issue references, testing results, compatibility notes, follow-up work, and visual evidence. It does not us…
Full details: Description check

Explanation

The description provides a clear high-level explanation, detailed changes, rationale, linked issue references, testing results, compatibility notes, follow-up work, and visual evidence. It does not use every template heading and omits the explicit checklist, AI disclosure, Review, and Agent skill upstream boundary sections, but the required substantive information is mostly present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 15 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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


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: b4f0ff90-d0f5-45b7-bba2-17f419d19ccc
Commits

Reviewing files that changed from the base of the PR and between 71be80c and 7f16f57.

Files selected for processing: 16
  • src/main/codex/codex-structured-thread-goal.test.ts
  • src/main/codex/codex-structured-thread-goal.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-ready-operation-order.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-thread-goal.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-thread-goal.ts
  • src/renderer/src/components/native-chat/NativeChatThreadGoalBanner.test.tsx
  • src/renderer/src/components/native-chat/NativeChatThreadGoalBanner.tsx
  • src/renderer/src/components/native-chat/agent-session-write-notice-text.test.ts
  • src/renderer/src/components/native-chat/agent-session-write-notice-text.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-thread-goal.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-thread-goal.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/shared/agent-session-refusal-notice.test.ts
  • src/shared/agent-session-refusal-notice.ts
  • src/shared/agent-session-write-notice-copy.ts

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

Comment thread src/main/codex/codex-structured-thread-goal.ts Outdated
@brennanb2025 brennanb2025 changed the title Keep goal controls cancellable and preserve uncertain changes Preserve uncertain goal text and accept distinct controls Oct 24, 2026
@brennanb2025

brennanb2025 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

A lost goal reply could hide the submitted objective even when Codex had applied it. Retrying that old unknown action could override a newer decision, and a renderer pending flag could refuse a distinct goal control.

The change keeps uncertain goal text, replays the original recorded outcome without another provider write, identifies explicit controls as user actions, and admits distinct controls while preserving the permission hold. Partial-change copy no longer promises the previous goal survived.

The full review included adversarial correctness, architecture challenge, a final whole-mechanism comparison, performance and readiness checks. Review removed the partial Stop compensator, enabled pending Resume, corrected locale fallback, and added persisted recovery and recorded-provider-output proof. No open in-scope P0/P1 remains. Differences from the common pattern are intended for the existing durable operation ledger and direct Pause/Clear, or temporary as linked below.

Temporary: STA-11962 owns the direct activation Stop gap and replacement identity/usage race. Removing the renderer latch also exposes rapid two-Set entry in one pane. This PR does not fix either gap or promise counter reset. The response-only compensator was removed before shipping.

Verified: real Codex 0.163.0 UI Set/Pause/Resume/Edit/Clear, main-created history carried through a graceful restart, and two real replies afterward. Captured explicit requests carry origin:user. The paused baseline goal finished before Pause arrived, so completed history was restored. Pending controls used a labelled ~1.3-second hold on genuine replies; delivery stayed serialized. Unknown-result recovery and permission holds are covered by tests; the notice screenshot is a labelled renderer fixture. No activation-window Stop, phone goal feature, or Claude goal endpoint pass is claimed.

117 tests across seven named files passed on QA head 12bd1463951c1f5ada366bff151a620fb3dc1831; actual SQLite close/reopen retains unknown objective/receipt and old replay preserves later Pause/Clear/Set. A later three-test file replays six real captured notifications through the translator, SQLite journal, and banner projection. Locale validation and precommit passed. Since QA, only test/fixture commit 1539c4d1ac8e and type-annotation commit 18c42c605ecd changed; existing runtime and screenshot evidence carries. Final required PR gate, lint/typecheck, all five unit shards, relay integration, persistence and both package jobs passed on 18c42c605ecd. The separate WSL workflow also passed, including Fedora, Debian and Ubuntu. Its initial Fedora setup timed out before tests; the failed-job retry completed successfully.

Real Claude Code 2.1.310 (claude-opus-5-5) also completed two file-reading sends and two replies in the same native chat on 18c42c605ecd; the composer remained usable and no Codex goal controls appeared. The isolated app and driver stopped gracefully, all owned processes exited, and real-config hashes matched.

For Brennan's review

Main-created history, before / after graceful upgrade

codex-main-goal.png

codex-restored-chat.png

Set / Pause / Resume — actual provider

codex-goal-active.png

codex-goal-paused.png

codex-goal-resumed.png

Distinct objective / Clear / two continuing replies

codex-goal-edited.png

codex-goal-cleared.png

codex-two-replies.png

Pending Pause/Clear and paused Resume — timing harness

pending-controls.png

pending-resume.png

Truthful notice — labelled renderer-only fixture

goal-change-notice.png

Claude shared chat — two real replies on current head

claude-two-replies.png

@brennanb2025
brennanb2025 merged commit e26e418 into main Oct 25, 2026
46 of 47 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/goal-control-fixes branch October 25, 2026 21:05
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