Repository navigation
refactor(desktop): one forward-only state per recorded tmux run, and one check for a delivered result - #8737
Conversation
…one check for a delivered result A recorded run is started, delivered or stop, and only moves forward, so a late acknowledgement can never undo a stop. The executor alone decides which results reach the model (not a stop, nor one that stands in for a run that did not start, has an unknown outcome or was too large to send), and snapshots the journal before its own recovery. A delivery looks up its run by call instead of reading every record. A run that cannot start after tagging closes its pane like a refused one. At launch, a kept run whose pane outlived its command is closed and forgotten. Covers a newline in a pane's running command and a character split across tmux's output.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Turn on auto-fix | Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
A simplification of the tmux run ledger from #8722. The product rules stay the same: at launch, for the same user, runs the model can no longer collect are stopped, and every recorded run is stopped when the identity ends. The only behaviour changes are the correctness fixes listed under "Fixes".
Simpler
state: 'started' | 'delivered' | 'stop'replacesdelivered+mustStop, behind a singleadvance(runId, state).stateexisted is read as the state it meant:mustStop: trueasstop(this wins), thendelivered: trueasdelivered, and otherwisestarted. A published staging build wrote that format. Any other record is dropped as unreadable.isDeliveredResultin the executor decides which results reach the model.onResultDeliveredfires only for those, and the journal's pending-results read uses the same check. Before, the check was duplicated inmain/index.tsand the service.main.mainno longer has toawaitthe snapshot beforestart().abandonhook: a run that can't write its go file after tagging closes its tagged pane throughifTagged, like a refused run. The next sweep drops the saved record.Fixes
cancelledresult and a 413resultOmittedone, as well as the not-started and outcome-unknown ones already excluded. In none of these did the model get a pane.remain-on-exit, a dead pane used to read asoursforever.recordedRunStatenow reads#{pane_dead}and reports such a pane asfinished. The launch sweep then closes it throughifTaggedand forgets the record, with no Ctrl-C sent.superseded: it's handled at the next launch, with no extra code.started.stopRun's doc comment, which had drifted ontoifTagged, is back onstopRun.#8725 follow-ups
pane_current_commandraw stayed green.list-panesoutput in two pieces, split inside a multi-byte character. The test pinsrunTmux'ssetEncoding('utf8').Corrections to #8722's description
delivered: it is set when Sim acknowledges a real result for the call. "Once the result has been handed back" was wrong: it waits for Sim's acknowledgement, and a stand-in result never sets it.delivered, or when the journal holds its real result for recovery to send. Anything else is stopped. "Stopped when the journal shows the call claimed or started" undersold this, because a run with no journal entry at all is stopped too.Type of Change
Testing
src/main/terminalandsrc/main/desktop-executor(209 tests).stopwinning overdeliveredin an old record;#{@sim-run-id} #{pane_dead}asrun-x 0while the pane is live andrun-x 1after its command ends underremain-on-exit, and the taggedkill-paneremoves it;Checklist