Repository navigation
Keep each accepted chat message with its chosen model and effort - #28207
Closed
brennanb2025 wants to merge 45 commits into
Closed
brennanb2025 wants to merge 45 commits into
brennanb2025 wants to merge 45 commits into
Conversation
4 of 8 tasks
# Conflicts: # src/main/acp/acp-structured-host-option-hang.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-acquire-aborts.ts # src/main/native-chat/agent-session-wire/structured-agent-session-claude-option-queue.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts # src/main/native-chat/agent-session-wire/structured-agent-session-option-settlement.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-provider-started.ts # src/main/native-chat/agent-session-wire/structured-agent-session-startup-attempt-registrations.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-startup-permission-mode.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-startup-picks.test.ts
# Conflicts: # src/main/acp/acp-structured-acquire.ts # src/main/acp/acp-structured-handshake.ts # src/main/acp/acp-structured-host-option-hang.test.ts # src/main/acp/acp-structured-publish-at-spawn.test.ts # src/main/claude/claude-structured-session-adapter.test.ts # src/main/claude/claude-structured-session-startup.ts # src/main/claude/claude-structured-start-fast-mode.ts # src/main/codex/codex-structured-publish-at-spawn.test.ts # src/main/codex/codex-structured-session-start.ts # src/main/native-chat/agent-session-journal/journal-row-builders.ts # src/main/native-chat/agent-session-wire/structured-agent-session-acquisition-options.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-acquisition.ts # src/main/native-chat/agent-session-wire/structured-agent-session-attach-flow.ts # src/main/native-chat/agent-session-wire/structured-agent-session-attach-orchestration.ts # src/main/native-chat/agent-session-wire/structured-agent-session-claude-option-queue.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-conversation-lifetime.ts # src/main/native-chat/agent-session-wire/structured-agent-session-create.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-delivery-loop.ts # src/main/native-chat/agent-session-wire/structured-agent-session-held-start.test-support.ts # src/main/native-chat/agent-session-wire/structured-agent-session-instant-start.test-support.ts # src/main/native-chat/agent-session-wire/structured-agent-session-mutation-context.ts # src/main/native-chat/agent-session-wire/structured-agent-session-option-settlement.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-provider-child-record.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-provider-open.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-provider-started-catalog.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-queued-message-rig.test-fixture.ts # src/main/native-chat/agent-session-wire/structured-agent-session-send-restarts-failed-start.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-startup-attempt-host.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-startup-attempt-registrations.test.ts # src/main/native-chat/agent-session-wire/structured-agent-session-startup-attempt.ts # src/main/native-chat/agent-session-wire/structured-conversation-command.test.ts # src/main/pi/rpc-session-startup.ts # src/main/runtime/structured-agent-session-failure-logging.test.ts # src/main/runtime/structured-agent-session-pi-startup.test.ts
# Conflicts: # src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts
5 of 8 tasks
4 of 6 tasks
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Changing the model while an agent was starting could make an earlier message run with a choice intended for a later one. Messages waiting as cards also relied on whichever choice the chat held when they eventually ran. Each new message and card now keeps the choices it had when accepted.
What Changed
Each accepted message and queued card keeps its own model and effort, and delivery applies them immediately before sending the prompt. For example, send A on model X, pick model Y, then send B: A records X as its choice and B records Y; the running-turn differences are described below. Close, quit, restart, card edit and Send now preserve those choices. Desktop and mobile omit choices while the picker is unknown, so the host uses its saved choice. Mobile follows the host status stream and includes an in-flight pick when the full choice is known; otherwise it omits choices and uses the host selection. A desktop on an older host still refreshes after another device picks. The picker retains its model pill while an unloaded list is filled in.
Why
The host already owns message acceptance and the saved selection. Capturing choices with each message keeps later picker changes from changing work already accepted. Picker clicks now save the selection instead of writing to a running child; delivery applies each message's own choices. Provider reports enrich catalogs and live facts without rewriting saved choices. Older records stay readable; choices missing from an older record cannot be reconstructed.
Differences from the common pattern
Codex messages with a different model or effort currently wait for the running turn to end. Whether they should instead steer now and apply choices to a later turn remains undecided; the message wait remains here. Goal changes and rewinds on a running agent answer immediately, even when an earlier message is held by that wait. A goal requested during startup also stops waiting behind messages once their delivery parks.
Older ACP and Pi messages or cards that contain no recorded choices still receive no saved-choice fallback. A downgrade that discards this metadata cannot retain the per-message guarantee.
Linked Issue
Replaces the message-choice portion of #26561 and folds #27641 into the aligned stack. Depends on #28048 and its three lower drafts; #28051 will target this branch.
Visual Proof
Rendered before/after evidence is pending. Scripted tests cover the behavior; no screenshot or manual platform evidence is claimed.
Testing
Focused host/card, desktop, shared-choice and provider tests; Node, Web, mobile production and CI project typechecks; mobile test-type ratchet; 14 real Claude CLI tests; static checks with the accepted pinned-main HtmlDocPreview exception. New unknown-send and kept-card regressions cover the failure cases. Goal pause, edit and clear are tested while a message remains held by the Codex wait; those cases fail without the ordering fix. No rendered Electron, simulator or actual SSH QA.
Review
Reviewed the owning diff, failure paths and covered races. Tests demonstrate covered behaviors; rendered and real remote-host QA are pending.
Agent skill upstream boundary
Notes
Execution stays on the host owning the agent. Folder workspaces and independently updated peers retain their existing paths. Loss of contact is not process-exit evidence. Draft only; no main sync or hosted CI watch.
Checklist