Skip to content

Keep a prompt submitted before /clear out of the new session - #903

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-7637-keep-a-prompt-submitted-before-clear-out-of-the-new-session
Sep 11, 2026
Merged

Keep a prompt submitted before /clear out of the new session#903
TheGreatAxios merged 1 commit into
mainfrom
cl-7637-keep-a-prompt-submitted-before-clear-out-of-the-new-session

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Operator send is now generation-gated like leftover/steer hops: a /clear or /new that rotates the session after Enter must not deliver that prompt into the rebuilt agent (agentProxy.send + sendUserPrompt gates, AgentClosedError abort on rotation).

Verification: exit.test.ts 4 pass; queued-delivery/wiring suites 32 pass; typecheck exit 0; lint/format clean.

Fixes CL-7637

A clear after Enter could finish token refresh against the rebuilt agent, so the outgoing prompt started the new session.
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

CL-7637

@TheGreatAxios TheGreatAxios changed the title CL-7637: Keep a prompt submitted before /clear out of the new session Keep a prompt submitted before /clear out of the new session Sep 11, 2026

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge. agentProxy.send captures delivery generation, then drops after awaitTail and again after the OAuth refresh if /clear rotated the session — that closes the hung-token-refresh race the tests pin. The paired happy-path test (no rotation still delivers) keeps the guard honest. CI is green.

@TheGreatAxios
TheGreatAxios merged commit 22aaf8c into main Sep 11, 2026
9 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7637-keep-a-prompt-submitted-before-clear-out-of-the-new-session branch September 11, 2026 05:10
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