Repository navigation
fix(cli): do not re-run a handoff when the TUI restarts after an update - #1178
Draft
sosidudku1 wants to merge 1 commit into
Draft
sosidudku1 wants to merge 1 commit into
sosidudku1 wants to merge 1 commit into
Conversation
atag handoff opens the TUI in the same process, so the post-update
restart replayed process.argv ("handoff --from ...") and imported the
transcript again as a second identical chat. Relaunch as `tui` with the
TUI's own args instead, keep --session so it lands on the same chat,
and drop --send since that message was already sent.
This branch has not been deployed
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.
Careful tier: touches logic outside the UI, please review closely.
What
After a self-update, the terminal restarts itself as
atomic-agent tuiwith the TUI's own arguments, instead of replaying the original command line.--sessionis kept, so it lands back on the same chat.--sendis dropped, since that message was already sent.New pure helper
selfUpdateRelaunchArgsinsrc/tui/tui-args.ts, used by the restart block insrc/tui/tui-command.ts.Why
atomic-agent handoffopens the TUI in the same process. The restart after an update replayedprocess.argv(handoff --from ...), so the handoff ran a second time: the transcript was imported again and a second identical continuation chat appeared. A plaintui --send Xhad the same flaw and sent X twice.How it was verified
Not yet checked on the second Mac: this draft waits for one combined build, test, smoke and e2e run together with the other open fixes.
Static checks so far:
src/tui/tui-args.test.ts(handoff argv on plain node and SEA, plain tui launch with a dash-led value). On the old code the relaunch args would behandoff --from claude, so they fail.tui,handoff), the value-flag list againstparseTuiArgs, and the timing of--sendversus the restart.Known narrow edge: if the turn is aborted before it was ever dispatched (still waiting for a local model switch at restart time), the continuation prompt is not re-sent. Much rarer than the duplicate chat it replaces.