Repository navigation
fix: let Send become Stop while a turn is running - #38
Open
bluzername wants to merge 1 commit into
Open
bluzername wants to merge 1 commit into
bluzername wants to merge 1 commit into
Conversation
Right now the Send button just goes disabled the whole time a turn runs. If
you notice a mistake in what you asked, you have to wait for it to finish,
you cannot fix it early.
The daemon already know how to cancel a job, server/src/index.ts has a
"cancel" case that abort the job by id. Nothing in the composer ever sent
that message though.
This add a Stop state for the button while awaiting is true. It swap the
icon and label, and clicking it now sends {type: "cancel", jobId} instead
of doing nothing. When the job end (done or cancelled) the button go back
to Send.
Tests in app.stop.test.ts cover both directions: Send turns into Stop and
sends the cancel message with the right job id, and it reverts to Send once
job:done arrives so the next turn can go out normally.
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.
Closes #29.
What is wrong
Right now the composer's Send button just goes disabled for the whole time
a turn is running. If you notice a mistake in what you asked right after
you send it, there is no way to stop and fix it, you just wait for the
answer to finish.
Why it was easy to add
The daemon already support cancelling.
server/src/index.tshas acase "cancel": jobs.get(parsed.jobId)?.abort?.abort(), and the protocolalready carry
{ type: "cancel", jobId }. Even the client comment atkeepVisualsay a cancel keeps the pending deltas queued "so Send triesagain rather than starting from nothing" - it was designed for, just the
button never sent it.
The fix
While
awaitingis true, the Send button now stay enabled and turn intoStop (icon and aria-label change too). Clicking it while a job is running
send
{ type: "cancel", jobId: this.activeJobId }instead of trying tosubmit again. Once the job finish (done or cancelled), the button go back
to Send.
I did not touch anything on the server side, it was already there.
Testing
Added
packages/overlay/src/app.stop.test.ts, two cases:job:createdsends exactly one cancel message with the job id (not asecond edit).
job:donearrives the button go back to Send and a new turn can besubmitted normally.
Both were RED on the old code first (I checked, the button just stayed
disabled and no cancel message ever appeared), then GREEN after the change.
Ran locally:
pnpm vitest runinpackages/overlay- 77 files, 1175 tests, all passtsc --noEmitinpackages/overlay- cleanbiome checkon the two changed files - clean (format + lint)I used Claude Code to help write and test this change.