Skip to content

feat(mocactl): note an unfinished last turn on resume (#471) - #472

Merged
pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:feat/mocactl-interrupted-turn-note
Oct 9, 2026
Merged

pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:feat/mocactl-interrupted-turn-note

Conversation

@pdettori

@pdettori pdettori commented Oct 9, 2026

Copy link
Copy Markdown
Member

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:

the last turn didn't finish (mocactl closed, or it was cancelled or failed) and isn't running — send a prompt such as "go on" to continue

  • Only the last turn gets the notice. An earlier cut-off turn that was followed up gets none.
  • The transcript records frames, not the client's turn-end events. So a quit, an Esc and a failure before streaming can't be told apart, and the wording covers all three.

Re-attaching to a live turn, so this note is no longer needed, is tracked in #471.

Testing

  • New cases in test/blocks.test.ts: an unfinished last turn gets the notice; a finished last turn after a cut-off one (done and error) gets none; an empty transcript gets none.
  • mocactl suite: 667 passed, 3 skipped. tsc --noEmit and prettier are clean.
  • I haven't tried it in the running app.

🤖 Generated with Claude Code

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]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 9, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 =

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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]>
@pdettori
pdettori merged commit 0555d7f into rossoctl:main Oct 9, 2026
14 checks passed
@pdettori
pdettori deleted the feat/mocactl-interrupted-turn-note branch October 9, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants