Repository navigation
feat(mocactl): note an unfinished last turn on resume (#471) - #472
Conversation
Quitting mocactl mid-turn closes the SSE connection, and the harness aborts the turn on disconnect (turn SSE spec §3.6). Nothing replays it, so a resumed session showed a cut-off reply that read as one still being written, and only a new prompt moved it on. fromTranscript now ends the view with a warning when the last prompt has no terminal frame: the turn isn't running, and a prompt such as "go on" continues it. Re-attaching to a live turn is rossoctl#471. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
On resume, fromTranscript now ends the view with a warning when the last prompt has no terminal (done/error) frame. The logic is small and correct: only the latest prompt is tracked, isTerminal is the same predicate transcripts.load uses to count turns, and the notice lands after finalizeOpen, so it's appended below a finalized assistant block rather than inserted above an open one. I checked the premise against the turn SSE spec §3.6: a client disconnect aborts the turn and no terminal frame is written. The tests cover an unfinished last turn, a finished last turn after a cut-off one (done and error), and an empty transcript. One wording nit is inline.
CI: trivy-scan is red on this head. It's the trivy fs step, which uses exit-code: 1 for HIGH/CRITICAL. This PR changes no dependencies or lockfiles, and the Trivy code-scanning check reports "No new alerts in code changed by this pull request." So this is most likely a newly published advisory against an existing dependency, and it will hit every PR from now on. I couldn't read the job log or the alerts from here (the token gets a 403 on code-scanning). Look at the Security tab before merging. Everything else is green.
Author: pdettori (MEMBER — maintainer)
Areas reviewed: Frontend/TUI (TypeScript), tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: failing (trivy-scan only, likely unrelated, see above); all other checks pass
| * on the harness, and nothing replays it (turn SSE spec §3.6). Without this note the cut-off reply | ||
| * reads as one still being written. | ||
| */ | ||
| export const INTERRUPTED_TURN_NOTICE = |
There was a problem hiding this comment.
nit: The transcript can tell us the turn never finished in this transcript, but not that it "isn't running". If a second mocactl window on this device is still streaming the session, resuming it in another window shows this notice and suggests "go on". That would start a concurrent turn on the same session, which the harness allows (/v1/turn turns get their own ref nonce). It's an edge case, but a softer wording avoids the false claim. For example: the last turn didn't finish here (mocactl closed, or it was cancelled or failed) — if it isn't running elsewhere, send a prompt such as "go on" to continue. Or leave it as is until #471 lands, since that's the real fix.
The trivy-scan job fails on CVE-2026-78659, -78660, -78663, -78669 and -97032 in golang.org/x/net v0.58.0 (gen/go and remote-worker). They carry no severity yet, but the action builds its SARIF report at all severities, so exit-code 1 trips on them regardless of the CRITICAL,HIGH filter. v0.60.0 fixes all five; it needs go 1.26, which remote-worker and its Dockerfile already use. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Problem
If you quit mocactl while a turn is streaming, then reopen it and resume the session, the reply is cut off at the point you quit. Nothing on screen says why. It looks like output that stopped arriving, and only a new prompt ("go on") gets it moving again.
What's going on: the harness aborts a turn when its SSE client disconnects (
docs/specs/2026-08-26-turn-sse-streaming-design.md§3.6). Nothing replays the turn, and mocactl rebuilds history from its local transcript, which ends where the client went away. So no output was produced after the quit, and there was nothing to show.Change
fromTranscript(packages/mocactl/src/render/blocks.ts) ends the resumed view with a warning when the last prompt has no terminal (done/error) frame:Re-attaching to a live turn, so this note is no longer needed, is tracked in #471.
Testing
test/blocks.test.ts: an unfinished last turn gets the notice; a finished last turn after a cut-off one (doneanderror) gets none; an empty transcript gets none.tsc --noEmitand prettier are clean.🤖 Generated with Claude Code