Repository navigation
Conversation
…script lines An un-cursored `terminal read` returns the preview buffer, a live-screen model that in-place redraws collapse, but it derives `oldestCursor`, `nextCursor` and `latestCursor` from the append-only transcript. When a TUI redraws, the preview holds a couple of rows while the transcript keeps growing, and the response still reports `limited: false` with `nextCursor === latestCursor`. Both mean "you are caught up", so a caller paginating by the documented rule stops reading and concludes the terminal produced nothing. Set `limited` when the retained transcript holds more completed lines than the response returned. Cursor semantics are unchanged; this only stops the flags from contradicting the cursors. Also name the window in `terminal read --help`, which never stated that a bare read is bounded.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe Merge Risk: ⚪ Minimal · up to The PR corrects the limited-output signal for un-cursored terminal reads so callers can continue paging retained lines; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Behaviour change
An un-cursored
orca terminal readnow setslimited: truewhen the retained transcript holds more completed lines than the response returned. Cursor semantics, the default limit, and which buffer the read draws from are all unchanged.Fixes #12333.
Evidence
Reproduced on
upstream/mainagainst a live pane, using the released CLI:The bare read returned 24 of 61 retained lines and reported
limited: falsewithnextCursor === latestCursor. Both of those mean "you are caught up".The repo's own CUU fixture reproduces the same thing without a live pane. After
A\r\nB\r\nC\r\n\x1b[2A\x1b[2K\x1b[1GB2\r\n, an un-cursored read returns 2 rows whilelatestCursoris4, and before this change reportedlimited: false.Why it matters
This is not a cosmetic flag.
skill-guides/orca-cli.mdtells callers to keep paging "whilelimitedis true andnextCursor !== latestCursor". On this path both stop conditions are satisfied at once, so a caller following the shipped rule exactly stops reading and concludes the pane produced nothing.We watched that happen. An agent-driven probe sent
echo RDY5into a pane every four seconds and read the pane back with a bareterminal read --terminal <h> --json. Eighteen probes in a row appeared to execute nothing and the operator concluded the pane was dead for ninety seconds. The pane was fine — a cursor read showed 28 retained lines, 12 of them theRDY5output the earlier reads had not returned. Two independent agents reached the same wrong diagnosis within an hour, and in both cases the wrong diagnosis came from the tool's response, not from the system under test. #12333 reports the same inversion from a different pair of sessions, where a healthy worker was stopped on the strength of it.The change
readTerminalTailcomputes its content and itslimitedflag against the preview buffer, but derivesoldestCursor/nextCursor/latestCursorfrom the transcript. Those are two different buffers: the preview is a live-screen model that in-place redraws rewrite and delete rows from, while the transcript is monotonic. Nothing was dropped relative to the preview, solimitedstayedfalsewhile the transcript kept growing.One added condition in the un-cursored branch of
readTerminalTail, plus the--helpline that says a bare read is a bounded window.Per #12333's analysis, this sits in
readTerminalTailrather than inwithVisibleSnapshotFallback, so the leaf path, the live-PTY path, SSH/remote hosts and headless hosts get the same contract — the fallback behaves differently per host and a fix leaning on it would not hold on headless or remote. It is deliberately the signalling fix only: #12333 also proposes thatnextCursorshould stop equallinglatestCursorwhile unread lines exist, which changes cursor semantics and belongs in its own PR.Compatibility
limitedis an existing optional boolean onRuntimeTerminalRead; no wire shape changes, so no capability negotiation is needed and mixed client/host versions stay fine. The change is host-independent and platform-independent — no path handling, no provider-specific branches.The direction of the change is conservative: a caller that ignores
limitedsees identical output, and a caller that honours it now pages where it previously stopped. The human formatter already renders this aswarning: output limited; page retained output with --cursor <n> --limit <count>, so no formatter change was needed.Adjacent work: #10231 touches alt-screen scrollback restore near
withVisibleSnapshotFallback; this PR does not modify that function, so they should not conflict. #7433 asks for the--jsonresult schema in--help— the one help line here names the window and points atlimited, but does not document the full schema, so #7433 stays open.Test plan
Two tests added next to the existing CUU redraw tests in
src/main/runtime/orca-runtime.test.ts:latestCursor: '4'and now reportslimited: truelimited: false, so the flag does not become noiseRun on this branch:
The second test fails without the production change; the first fails without it too.
Moved from #13672, same commits, same head SHA. That pull request was opened from an organisation-owned fork, and GitHub refuses maintainer pushes on org-owned forks even when
maintainer_can_modifyreportstrue— so a maintainer could not push a fixup to it, only ask or rewrite. This one is on a personal fork, where a maintainer push works.The review history stays readable on #13672: #13672