Skip to content

fix(runtime): reopen the quiet-foreground tui-idle lane for agents with no other rest signal - #23598

Merged
brennanb2025 merged 9 commits into
mainfrom
brennanb2025/sta-7440-tui-idle-rest-signal
Sep 28, 2026
Merged

brennanb2025 merged 9 commits into
mainfrom
brennanb2025/sta-7440-tui-idle-rest-signal

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​321 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​313
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​199 $\color{#cf222e}{\Huge{\mathbf{−}}}$​31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​168

What this fixes (scope)

The bug: since #20155 (merged 2026-09-13), terminal agents that give Orca no readiness signal can never be detected as ready, so anything that waits for them to be ready times out: orca worker start --agent <agent> fails after 60 s with "Agent did not become ready", and so do orchestration dispatch, launch-with-prompt, automations and orca terminal wait --for tui-idle on those panes.

Who hits it: only terminal panes running one of these agents: amp, goose, crush, kimi, qwen-code, rovo, aug, cline, kiro, kilo, codebuff, freebuff, continue, trae, ante, autohand, mistral-vibe, command-code, prime-agent. Local, SSH and WSL panes alike.

Not affected: Claude, Codex, Gemini, Grok, OpenCode, Cursor, DSH, Muse, Qoder and every other agent with an existing readiness signal (they keep exactly today's behaviour, pinned by tests); structured (native) chat; plain shells with no agent.

ELI5

Before Orca types a task into an agent's terminal, it waits for the agent to look ready. For some agents (Amp, Goose, Crush, Kimi, Qwen Code, Rovo Dev, Auggie and about a dozen others), Orca has no way to read "I'm ready" from the agent, so the only clue it has is "this program has gone quiet". #20155 (merged 2026-09-13) switched that clue off for every agent Orca launches, so for these agents the wait could never succeed. This turns it back on for exactly the agents that have nothing better, and makes it wait until the agent itself has drawn something on screen first. The shell's own prompt and the typed launch command do not count.

What Changed

Before: orca worker start --agent amp (and the same for goose, crush, kimi, qwen-code, rovo, aug, cline, kiro, kilo, codebuff, freebuff, continue, trae, ante, autohand, mistral-vibe, command-code, prime-agent) waited the full 60 seconds and then failed with "Agent did not become ready". Any other readiness wait on those panes (orchestration dispatch, launch-with-prompt, automations, orca terminal wait --for tui-idle) ran to its timeout the same way.

After: those panes become ready about 3 seconds after the agent finishes drawing its screen, and not before the agent has drawn anything. Agents that already had a readiness signal (Claude, Codex, Gemini, Grok, OpenCode, DSH, Muse and the rest) behave exactly as before.

Mechanism, in four parts:

  1. New src/shared/tui-agent-rest-signal.ts records how each agent says it is at rest: its own hook reporting the turn ended (DSH), an Orca-written " ready" title (Codex, Cursor, Pi, ...), a title the status classifier reads (Claude, Gemini, Grok, ...), a recognised ready screen (Muse, Qoder), or no stronger signal that the readiness wait trusts. Amp, Kimi and Command Code have hooks and Freebuff reports a screen-derived "done", but the wait takes those only as "still working" vetoes (it trusts a "done" only from DSH), so they land in "nothing" too. It is derived from the tables that already encode this, not hand-written per agent, so it cannot drift from them. An agent with no existing evidence gets "nothing", which is the safe default because of part 3.
  2. In tui-idle-evidence.ts, the "quiet program in the foreground" readiness lane used to be closed whenever Orca knew which agent was running. It is now closed only for agents with a stronger signal still to come, and reopened for agents with none. It still closes the moment any title classifies, and a hook saying the agent is working still vetoes it.
  3. On a reopened lane, silence only counts once the agent itself has drawn something, measured from the last output. Orca types the launch command into a shell, so the shell's prompt and the echoed command always arrive before the agent starts, and counting them let an agent that boots silently for more than 3 seconds be declared ready before it could take input. Orca's shell integration already prints a "command started" marker (OSC 133;C) right before the command runs. New terminal-command-paint.ts records that marker per terminal, using the existing chunk-boundary-safe OSC 133 scanner (terminal-osc133-command-finished.ts, which now also reports where in the chunk the marker ended), and runtime-terminal-idle-polls.ts accepts silence only after visible output that followed it. Orca types these agents' launch command into bash and zsh (local, terminal daemon and SSH relay alike), and both print the marker after the echo, so those panes get the full protection (checked on bash 3.2). A launch that gets no marker falls back to "any output": zsh on an SSH host (the remote zsh wrapper prints no command markers), older fish, shells Orca could not wrap (sh, dash, nu, or bash/zsh when the wrapper files are unusable), and Windows, where cmd.exe and PowerShell usually receive the command as a launch argument, so no prompt or echo precedes the agent there. Panes where Orca knows no agent keep their existing behaviour, because that rule exists for panes whose output never reaches Orca.
  4. The poll no longer asks the operating system for the foreground process while the pane cannot settle yet (still streaming, or nothing drawn), so a reopened pane does not pay a process inspection every 2 seconds for the length of a turn.

Why

Regression source: #20155 ("fix(runtime): stop a name-only agent title from satisfying tui-idle", merged 2026-09-13). It added quietForegroundProcessProvesTuiIdle(agent) returning !agent, which closed the quiet-foreground lane for every agent Orca launches, including the ones that have no other readiness signal. Since that merge, those agents can never pass a readiness wait.

#20155 closed this lane to stop Orca typing a prompt into an agent that was still starting up and losing it. That was right for agents that will announce readiness some other way, but it used "Orca knows which agent this is" as the test, when the real question is "will this agent ever send a better signal". For agents that never will, that lane was the only one they had.

Alternatives considered:

  • A boot timer (close the lane for N seconds after launch). Rejected: it guesses a startup time for every agent and still lets Claude-like agents through after the timer, which is the original bug.
  • Requiring output "since the wait started", or since the poll first saw the agent in the foreground. Rejected: the poll only looks every 2 seconds and the terminal host reports the launching agent's name for its first seconds even while the shell still runs, so that clock either starts before the shell's echo (no protection) or after the agent's first paint (the wait hangs on an agent already sitting idle). The shell's command-started marker is written in byte order, right between the echo and the agent's first output, so it needs no timing guess.
  • Adding title names for these agents to the title classifier. Rejected: that would claim they paint a recognisable title, and there is no captured terminal recording showing that. The short names are also deliberately excluded because ordinary shell titles contain them.

Known limits, stated plainly: for an agent with no readiness signal, silence is the only evidence there is. If such an agent draws something and then pauses for more than 3 seconds while still starting up, the wait can still settle early, and where the launch is not marked (zsh on SSH hosts, older fish, shells Orca could not wrap, a long command typed into cmd.exe) the shell's own echo still counts as a paint. The same holds for later waits on these panes (for example an automation waiting for a turn to finish): a pause of more than 3 seconds with nothing drawn reads as done. That is how these agents behaved before #20155. Only a real readiness signal from the agent removes it. An agent pane adopted after an Orca restart that has printed nothing since cannot settle on this lane; that was already true on main.

No new data is persisted and nothing new is sent between app and host. The capability is a fixed table in the running app, the command-started record lives only in memory beside the terminal's other output state, and the wait runs on the machine that owns the terminal. For SSH panes where the foreground program cannot be read, this lane is unavailable, as it was before.

Linked Issue

Linear: STA-7440

Regression introduced by #20155.

Visual Proof

N/A: no UI change. This only changes when a readiness wait on an agent terminal succeeds; the visible effect is a worker start that completes instead of failing after 60 seconds.

Testing

  • tui-agent-rest-signal.test.ts: every launchable agent has a rest signal, pinned in a full table so adding an agent will not compile until someone classifies it.

  • tui-idle-evidence.test.ts: amp, goose, crush, kimi, qwen-code, rovo and aug get the reopened lane; claude, codex, grok and dsh keep it closed; any classified title closes it. A per-agent check confirms that every agent marked as having no signal is refused by every stronger lane (DSH hook, Muse screen, Codex screen, synthetic title, title classifier).

  • runtime-terminal-idle-polls.test.ts: an amp pane does not settle while it has painted nothing (five poll cycles) and makes no foreground-process read meanwhile, does not settle within the quiet window after its first output, then settles. A Claude pane never settles on this lane.

  • tui-idle-command-paint.test.ts (through the real runtime): an amp pane whose shell has already printed its prompt, the echoed command and the command-started marker does not settle through 10 seconds of silent boot, then settles after the agent draws. terminal-command-paint.test.ts covers the marker rules: a title set after the marker is not a paint, a paint in the same chunk as the marker is, and the next command starts over.

  • Ablations: with the product code reverted to main, the amp settle test fails (the wait never settles). With only the "must have painted" rule removed, the same test fails because the pane settles before painting anything. With the command-started check removed from the poll, or the marker no longer recorded from terminal output, the runtime test fails because the pane settles during the silent boot. With the foreground read no longer skipped, the read-count assertion fails.

  • vitest over src/main/runtime and the related shared suites: 917 files, 9618 tests passed on the first commit; after the review fix, every tui-idle, terminal-wait and output-handling suite, the aggregate runtime suite (1314 tests) and all of src/shared pass. The changed-code quality gate passes. Typecheck passed on the first commit and is re-run on the latest one.

  • Second review: merged current main, which added Freebuff; the full rest-signal table now includes it (none, because tui-idle trusts a first-party done only from DSH). The command-start scan gained a forward substring check before its backward search (measured 6x to 25x cheaper per 64 KB chunk without a marker); the third review replaced that scan with the shared scanner. vitest over src/main/runtime and src/shared on the merged tree: 1760 files, 19254 tests passed.

  • Third review: merged current main, which added Qoder and a Qoder branch in the readiness evaluation; Qoder is classified by its ready screen (its composer), so its quiet-program lane stays closed as main intends. The command-paint tracker now reuses the shared OSC 133 scanner instead of its own parser, so a marker split across two output chunks is still found (new test; with the scanner's carry dropped the test fails, and with the in-chunk offset ignored the prompt and echo count as paint and four tests fail, including the runtime silent-boot test). vitest over src/main/runtime, src/shared and the renderer OSC 133 callers on the merged tree: 1764 files, 19321 tests passed; the changed-code quality gate passes.

  • Fourth review: the command-paint record is now dropped, with the other cross-chunk parse state, when the terminal host reports dropped output or a new process reuses the terminal id. Otherwise half a command-started marker from before the gap (fish's marker carries the command line) could be completed by unrelated output after it, and the pane would wait for a paint it had already made (new runtime test; it times out without the reset). vitest over src/main/runtime plus the rest-signal and OSC 133 suites: 918 files, 9358 tests passed; the changed-code quality gate passes.

  • Live QA on a second Mac, in an isolated dev build with fake amp, goose and claude executables standing in for the real CLIs (real ones update themselves and touch real config), at the second commit of this branch (before the review merges and the shared-scanner change): on main, orca orchestration worker-start --agent amp failed at its timeout with the task never delivered. On this branch amp and goose became ready about 3.9 seconds after they first drew, including when amp stayed silent for 5, 10 or 20 seconds after launch, and nothing was typed before it drew. A Claude pane with its title was ready as fast as before, a Claude pane without a title still timed out as before, and a plain non-agent program settled as before.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: no change. Cross-platform: platform-neutral; the foreground-process read already exists on every platform. SSH: unchanged; the lane needs a foreground read, which remote panes may not provide. Mobile and mixed versions: no wire or stored change. Performance: one table lookup per poll tick; one marker search per terminal output chunk; fewer foreground-process reads than before, since panes that cannot settle yet skip them.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…th no other rest signal

A tui-idle wait could never settle on a pane running amp, goose, crush, kimi,
qwen-code, rovo, auggie and other agents whose titles Orca cannot classify:
the quiet-foreground lane was closed for every launched agent, and it was the
only lane those agents could reach, so worker start failed at agent_readiness
after 60s.

Model each agent's rest signal, derived from the tables that already encode
it (synthetic ready titles, the title classifier, the DSH hook and Muse ready
screen lanes). The lane stays closed where a stronger signal will arrive and
reopens for agents with none. On a reopened lane, silence counts only after
the TUI has painted: an agent that has painted nothing is still booting.

Linear: STA-7440
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e1e64077-1ae3-4c6f-846f-957eb0d2f2ab

📥 Commits

Reviewing files that changed from the base of the PR and between e75db54 and 0c5d01a.

📒 Files selected for processing (5)
  • src/main/runtime/orca-runtime-apply-tracked-pty-title.ts
  • src/main/runtime/orca-runtime-emit-daemon-pty-transient-fact.ts
  • src/main/runtime/runtime-terminal-state-records.ts
  • src/main/runtime/tui-idle-command-paint.test.ts
  • src/renderer/src/components/terminal-pane/terminal-command-lifecycle.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/runtime/runtime-terminal-state-records.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change adds agent rest-signal classifications and command-paint tracking for PTY output. OSC 133 command-start scanning reports the marker’s position within the current chunk. Idle polling uses quiet-foreground lanes, command-paint checks, and quiescence timing when it assesses PTY and leaf readiness. Tests cover agent classifications, paint detection, and quiet-foreground polling.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 0c5d0

The reported typecheck blocker is resolved, and no verified merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 0c5d0

More agent sessions can now become ready when their terminal goes quiet. If terminal output is lost, a wait can finish before there is evidence that the agent displayed its screen. The identified exposure is limited to affected terminal sessions; no wider service or privilege change is established.

Retained concerns

  • Medium · security · inferred: A data gap can erase a recorded command-start paint requirement. For a newly eligible agent, the remaining pre-gap output timestamp and a non-shell foreground process can then satisfy readiness without evidence of agent paint after the gap. Readiness-dependent actions may proceed prematurely; a security consequence beyond that control failure is not established.
Security review details

Security Blast Radius

  • inferred — The identified path affects PTY waits for known agents that have no other rest signal and encounter an output gap. The inspected evidence does not establish a cross-service, tenant, or privilege boundary change.

Security Findings and Attack Paths

  • inferred — If a gap follows an observed command-start marker but no agent paint is subsequently received, clearing the tracker makes the paint check succeed. After the old output becomes quiet, a non-shell foreground process can complete readiness. This establishes premature readiness, not a verified data disclosure.

Trust Boundaries and Controls

  • observed — The normal marked-command path excludes shell prompt and echoed-command output until visible text follows OSC 133;C. Idle polling also checks screen-blocked evidence and rejects a shell foreground process; neither foreground identity nor the second quiet check requires fresh post-gap paint.

Resilience and Maintainability Implications

  • observed — Output received after a gap creates a new paint tracker, and the gap test confirms recovery when visible output arrives. The no-subsequent-output state remains distinct because the missing tracker is treated as painted.

Hardening Proposals

  • proposed — When a previously observed command boundary is lost to a data gap, retain an indeterminate paint state until fresh post-gap evidence arrives, rather than treating the absent tracker as affirmative paint. Preserve the separate fallback for launches that never supplied a boundary.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the primary change: reopening the quiet-foreground tui-idle lane for agents without another rest signal.
Description check ✅ Passed The description is comprehensive and covers the required explanation, scope, rationale, linked issue, visual proof, testing, review, compatibility considerations, and checklist. It documents extensive…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The after-paint guard does not actually verify the agent painted — lastOutputAt is already set by the shell prompt and launch-command echo, so the lane can settle during agent boot. Details inline.

Reviewed changes

  • Rest-signal derivation — new src/shared/tui-agent-rest-signal.ts classifies each TuiAgent as hook-done / synthetic-title / title / ready-body / none, derived from the existing title tables rather than a second hand-kept table.
  • Reopened lane — src/main/runtime/tui-idle-evidence.ts changes quietForeground from a boolean to QuietForegroundLane ('closed' | 'after-paint' | 'open'); agents with no other rest signal get 'after-paint', unknown panes keep 'open'.
  • Paint gate — src/main/runtime/runtime-terminal-idle-polls.ts runs the foreground poll for lanes other than 'closed' and requires a non-null lastOutputAt on 'after-paint'.
  • Tests — a full-table pin for the derived signals, per-agent lane-agreement checks, plus an amp settle test and a claude non-settle test.

ℹ️ Some 'none' agents may already paint a classifying title

qwen-code (a gemini-cli fork that uses Gemini's --approval-mode flag) and prime-agent (which embeds Pi's TUI) are classified 'none'. If either actually emits a classifying glyph/name title, reopening the lane is a direction-reversed error: main correctly closed it, and 'after-paint' would now allow a premature settle for an agent that already had a signal.

Technical details
# Unverified `'none'` classifications

## Affected sites
- src/shared/tui-agent-rest-signal.ts:33 — the classification bottoms out in `detectAgentStatusFromTitle(expectedProcess)`, which is true only if the process name itself is a recognized agent token.
- src/shared/tui-agent-config.ts:281 — `qwen-code` uses Gemini-shaped CLI flags; if it inherits the fork's `✦`/`◇` OSC glyphs it would classify.
- src/shared/tui-agent-config.ts:177 — `prime-agent` embeds Pi's TUI; Pi has a native `π …` title writer.

## Required outcome
- Confirm from a captured transcript (per docs/reference/agent-pty-transcript-capture.md) whether either agent emits a classifying title. If so, it should not be `'none'`.

## Open questions for the human
- Is there a recorded `qwen`/`prime-agent` transcript that shows (or rules out) an OSC title? This is the same evidence bar the PR applied to the title classifier elsewhere.

ℹ️ Nitpicks

  • The new per-agent agreement test returns early for every non-none signal (tui-idle-evidence.test.ts:201), so nothing pins that a 'title' / 'synthetic-title' agent actually has the lane it claims — which is how the antigravity label slipped through.
  • The claude non-settle case in runtime-terminal-idle-polls.test.ts was already 'closed' on main, so it guards a regression but does not distinguish the new behavior; the amp case is the one that does.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

return 'synthetic-title'
}
// Why the process name: the title tables match an agent by the name it runs as.
if (detectAgentStatusFromTitle(TUI_AGENT_CONFIG[agent].expectedProcess) !== null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

antigravity derives to 'title' here because its expectedProcess is agy, but agy emits no OSC title at all (see docs/reference/antigravity-readiness-evidence.md); its real readiness lane is the ready-body screen, the same category as muse. The behavior is unaffected — both non-none values map to 'closed' and the body lane still settles — but the title doc line is inaccurate and no test covers this direction.

Technical details
# `antigravity` mislabeled as a title-signal agent

## Affected sites
- src/shared/tui-agent-rest-signal.ts:33 — `detectAgentStatusFromTitle('agy')` matches `AGY_AGENT_NAME_RE` and falls through to `'idle'`, so the proxy reports a title signal the agent never emits.
- docs/reference/antigravity-readiness-evidence.md:231,235 — agy sets no OSC title; the ready screen is its only signal.
- src/main/runtime/antigravity-terminal-readiness.ts — the body lane that actually settles agy waits.

## Required outcome
- Classify `antigravity` as `'ready-body'` (identity table) rather than deriving `'title'` from the process name, so the table matches reality.

## Suggested approach
- Move `antigravity` into `IDENTITY_REST_SIGNALS` alongside `muse`, or broaden the derivation to consult the known ready-body registry rather than the process-name proxy alone.

… on the tui-idle foreground lane

The after-paint lane accepted any output, and the shell's prompt and echoed launch
command always land before the agent starts, so a silently booting agent could still
settle and lose its first prompt. The runtime now reads the shell integration's
command-start marker and requires visible output after it; panes whose shell emits
no marker keep the any-output rule.

Also skip the foreground-process read while the pane cannot settle, and register the
new title-classifier call site in the pane agent identity inventory.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1949c44d-28e6-44e9-bed3-b26c43684dbc

📥 Commits

Reviewing files that changed from the base of the PR and between 2f8f4f5 and f796e53.

📒 Files selected for processing (14)
  • src/main/runtime/orca-runtime-on-pty-data.ts
  • src/main/runtime/orca-runtime-runtime-id.ts
  • src/main/runtime/runtime-terminal-idle-polls.test.ts
  • src/main/runtime/runtime-terminal-idle-polls.ts
  • src/main/runtime/runtime-terminal-state-records.ts
  • src/main/runtime/terminal-command-paint.test.ts
  • src/main/runtime/terminal-command-paint.ts
  • src/main/runtime/terminal-wait-name-only-idle.test.ts
  • src/main/runtime/tui-idle-command-paint.test.ts
  • src/main/runtime/tui-idle-evidence.test.ts
  • src/main/runtime/tui-idle-evidence.ts
  • src/shared/pane-agent-identity-inventory.test.ts
  • src/shared/tui-agent-rest-signal.test.ts
  • src/shared/tui-agent-rest-signal.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment on lines +8 to +49
const EXPECTED_REST_SIGNALS: Record<TuiAgent, TuiAgentRestSignal> = {
dsh: 'hook-done',
codex: 'synthetic-title',
cursor: 'synthetic-title',
pi: 'synthetic-title',
omp: 'synthetic-title',
droid: 'synthetic-title',
hermes: 'synthetic-title',
devin: 'synthetic-title',
zcode: 'synthetic-title',
claude: 'title',
'claude-agent-teams': 'title',
openclaude: 'title',
opencode: 'title',
opencode2: 'title',
'mimo-code': 'title',
gemini: 'title',
antigravity: 'title',
aider: 'title',
openclaw: 'title',
copilot: 'title',
grok: 'title',
muse: 'ready-body',
autohand: 'none',
ante: 'none',
trae: 'none',
'prime-agent': 'none',
goose: 'none',
amp: 'none',
kilo: 'none',
kiro: 'none',
crush: 'none',
aug: 'none',
cline: 'none',
codebuff: 'none',
'command-code': 'none',
continue: 'none',
kimi: 'none',
'mistral-vibe': 'none',
'qwen-code': 'none',
rovo: 'none'
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Add the missing freebuff entry. Typecheck fails without it.

EXPECTED_REST_SIGNALS has the type Record<TuiAgent, TuiAgentRestSignal>. The CI failure is TS2741: the freebuff property is missing. pnpm run typecheck and build:cli both fail. Add freebuff with the signal that getTuiAgentRestSignal('freebuff') derives. The value is probably 'none' because freebuff is related to codebuff, but confirm it against the derived value.

Proposed fix
   codebuff: 'none',
+  freebuff: 'none',
   'command-code': 'none',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const EXPECTED_REST_SIGNALS: Record<TuiAgent, TuiAgentRestSignal> = {
dsh: 'hook-done',
codex: 'synthetic-title',
cursor: 'synthetic-title',
pi: 'synthetic-title',
omp: 'synthetic-title',
droid: 'synthetic-title',
hermes: 'synthetic-title',
devin: 'synthetic-title',
zcode: 'synthetic-title',
claude: 'title',
'claude-agent-teams': 'title',
openclaude: 'title',
opencode: 'title',
opencode2: 'title',
'mimo-code': 'title',
gemini: 'title',
antigravity: 'title',
aider: 'title',
openclaw: 'title',
copilot: 'title',
grok: 'title',
muse: 'ready-body',
autohand: 'none',
ante: 'none',
trae: 'none',
'prime-agent': 'none',
goose: 'none',
amp: 'none',
kilo: 'none',
kiro: 'none',
crush: 'none',
aug: 'none',
cline: 'none',
codebuff: 'none',
'command-code': 'none',
continue: 'none',
kimi: 'none',
'mistral-vibe': 'none',
'qwen-code': 'none',
rovo: 'none'
}
const EXPECTED_REST_SIGNALS: Record<TuiAgent, TuiAgentRestSignal> = {
dsh: 'hook-done',
codex: 'synthetic-title',
cursor: 'synthetic-title',
pi: 'synthetic-title',
omp: 'synthetic-title',
droid: 'synthetic-title',
hermes: 'synthetic-title',
devin: 'synthetic-title',
zcode: 'synthetic-title',
claude: 'title',
'claude-agent-teams': 'title',
openclaude: 'title',
opencode: 'title',
opencode2: 'title',
'mimo-code': 'title',
gemini: 'title',
antigravity: 'title',
aider: 'title',
openclaw: 'title',
copilot: 'title',
grok: 'title',
muse: 'ready-body',
autohand: 'none',
ante: 'none',
trae: 'none',
'prime-agent': 'none',
goose: 'none',
amp: 'none',
kilo: 'none',
kiro: 'none',
crush: 'none',
aug: 'none',
cline: 'none',
codebuff: 'none',
freebuff: 'none',
'command-code': 'none',
continue: 'none',
kimi: 'none',
'mistral-vibe': 'none',
'qwen-code': 'none',
rovo: 'none'
}
🧰 Tools
🪛 GitHub Actions: PR 23598 | source 4db989481014da0edc67fb2bc318d8896340e3d0 | workflow 4db989481014da0edc67fb2bc318d8896340e3d0 | unit full / static analysis

[error] 8-8: TypeScript compilation failed during pnpm run smoke:orcad-terminal (via pnpm run build:cli): the Record<TuiAgent, TuiAgentRestSignal> value is missing the required freebuff property (TS2741).

🪛 GitHub Actions: PR 23598 | source 4db989481014da0edc67fb2bc318d8896340e3d0 | workflow 4db989481014da0edc67fb2bc318d8896340e3d0 | unit full / typecheck

[error] 8-8: pnpm run typecheck failed: TypeScript error TS2741 — the Record<TuiAgent, TuiAgentRestSignal> value is missing the required 'freebuff' property.

Source: Pipeline failures

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one hardening note inline.

Reviewed changes

Reviewed the delta since the prior pullfrog review (048fcd5b25 → f796e537b5), which adds the agent-paint gate the earlier review asked for:

  • Command-paint tracking — new src/main/runtime/terminal-command-paint.ts records the shell's OSC 133;C command-start marker per PTY and reports commandPaintedAt only once visible output follows it; observeTerminalCommandPaint runs from onPtyData.
  • Gate wired into the poll — isQuietForQuiescence now returns false for the after-paint lane until hasCommandPainted is true, and the runtime wires hasCommandPainted to the PTY's paint record; the foreground read is skipped while the pane cannot settle.
  • Coverage — new terminal-command-paint.test.ts (marker rules) and tui-idle-command-paint.test.ts (a full runtime amp pane that stays unsettled through a silent boot after the echoed command, then settles on the paint), plus the poll-level amp settle/read-count case.

Note: I resolved the earlier after-paint thread — the new gate addresses it. The antigravity thread remains open and is unchanged by this delta.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…arker scan on chunks without one

Main added the Freebuff agent after this branch point, so the full per-agent rest-signal table no longer matched on the merge ref. Freebuff derives `none`: its screen reports a first-party `done`, which tui-idle trusts only for DSH, so the quiet-foreground lane is its only one.

The command-start scan ran a backward search over every PTY chunk; a forward check first cuts that to the cost of a plain substring test on chunks with no marker.
Main added Qoder with its own readiness branch returning a boolean quiet-foreground
flag; map it to the lane type and classify Qoder by its ready screen so the full
rest-signal table and lane-agreement check stay exhaustive. Say what `none`
actually means: no stronger lane tui-idle trusts, not no hooks at all.
The command-paint tracker had its own split-unsafe 133;C parser. Reuse the
chunk-boundary-safe scanner, which now reports where in the chunk the marker
ended, so a marker split across reads is still found. Correct the unmarked-launch
list: bash and zsh mark typed launches after the echo.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review (f796e537b5 → e75db54111):

  • Split-marker paint tracking — terminal-command-paint.ts replaces its hand-rolled lastIndexOf scanner with a TerminalCommandPaint class that delegates to the shared createOsc133CommandFinishedScanner, whose carry resolves a \x1b]133;C marker split across PTY reads. This closes the prior hardening thread: a split marker now still arms the gate, and the paint slice is taken from endInChunk in the current chunk's coordinates.
  • Scanner reports where the command's output begins — createOsc133CommandFinishedScanner's onCommandStarted now receives endInChunk (index just past the sequence). Existing renderer/main callers pass a zero-arg callback and are unaffected; verified the combinedStartInChunk arithmetic stays positive even when the terminator spans the carry/data boundary.
  • Qoder classified ready-body — added to IDENTITY_REST_SIGNALS, so its quiet-foreground lane stays closed behind the composer screen (isQoderComposerReady), matching the evaluateTuiIdle qoder branch on main. The per-agent agreement test asserts museBody || screenRead and is satisfied for qoder via screenRead.
  • Lane type cleanup — quietForeground: false became 'closed' at the non-lane resolver sites, and the title/body tier checks were reordered (same verdict, cheaper order).
  • Tests — split-marker rule, qoder agreement, and the amp poll read-count assertion.

One pre-existing thread remains open and unchanged by this delta: antigravity still derives 'title' from expectedProcess === 'agy' even though agy emits no OSC title, with no behavioral impact (both non-none values map to 'closed'). Approval is withheld only for that reason; nothing in the new commits needs further work.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

A dropped chunk can cut a command-start marker in half, and the scanner's
carry then completes it on unrelated output after the gap, leaving the
pane waiting for a paint that already happened. Reset it with the other
cross-chunk carries.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review (e75db54111 → fc0576d0fa):

  • Clear the paint record on a discontinuity — notePtyDataGap now drops pty.commandPaint alongside tailPendingAnsi, and resetTrackedTerminalStateForProviderGeneration drops it when a same-id respawn reuses the terminal. A half-written \x1b]133;C carry can no longer be completed by unrelated output after a gap and leave the pane waiting for a paint the agent already made; the field reading as painted is the existing no-marker fallback, so this is the safe direction.
  • Regression test — tui-idle-command-paint.test.ts pins that an amp pane whose command-start marker is cut off by dropped output still settles. I ablated it by removing the notePtyDataGap reset: the case times out at 30s, so it genuinely fails without the fix.
  • Record comment — documents that commandPaint is absent again after a gap or a new process.

The antigravity thread from the first review remains open and is unchanged by this delta, so approval stays withheld only for that reason.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review (fc0576d0fa → 0c5d01ad5f):

  • Renderer command-start callback no longer receives the chunk offset — terminal-command-lifecycle.ts wraps options.onCommandStarted in a zero-arg closure before handing it to the shared OSC 133 scanner. TerminalCommandLifecycleOptions.onCommandStarted is declared () => void, but a caller can supply a callback with an optional parameter (pane-foreground-agent-tracker.ts's onCommandStarted(expectedAgent?)), so the scanner's new endInChunk number could have landed in that optional param. This is the only caller that forwarded onCommandStarted; the other scanner callers pass none, and terminal-command-paint.ts supplies its own (endInChunk) handler. Renderer lifecycle and OSC 133 carry tests pass (13).

The antigravity thread from the first review remains open and is unchanged by this delta, so approval stays withheld only for that reason.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready for maintainer review

Verdict: six review loops, and the last one came back clean. CI is fully green at 0c5d01ad5f2 (29 passed, 12 skipped) and the PR merges cleanly into main.

What review changed on top of the original commit:

  • The "agent has painted" check counted the shell's own prompt and echoed launch command as the agent's output, so an agent that boots silently for more than 3 s could still be typed into mid-boot and lose its task. Silence now counts only after visible output that follows the shell's command-started marker (OSC 133;C). Live QA reproduced the original bug on the first commit and confirmed the fix.
  • That marker is read through the existing shared OSC 133 scanner, which now also reports where in the chunk the marker ended. Markers split across two reads are handled, and there is no second parser.
  • The marker state is reset when output is dropped or a new process reuses the terminal. A reset can only remove the protection, never make a wait hang.
  • Freebuff and Qoder were added on main after the branch point; both are classified, so the full per-agent table test stays green on the merge ref.
  • The foreground-process read is skipped while the pane cannot settle, so a streaming or not-yet-painted pane pays no process inspection per poll.

Architecture: because two loops touched the same area, an independent architecture review was run. It recommended keeping the design: close the quiet-foreground lane only for agents that have a stronger rest signal, and on the reopened lane require the agent's own first paint. A boot timer, a runtime-stamped clock and dropping the paint check were each rejected, for the reasons given in the PR body.

Live QA (isolated dev builds on a remote Mac, with fake amp/goose/claude executables; no real agent CLIs were run):

Scenario main this PR
amp prints at once worker-start fails at agent_readiness after the full timeout; the task is never delivered ready about 3.7 s after amp paints; task delivered
amp silent for 5 s / 10 s before painting not run on main (it already fails in the case above) never ready before the paint; task pasted after amp's prompt
goose not run on main ready about 3.7 s after paint
Claude-style agent with a title ready via the title same
Claude-style agent with no title times out, nothing typed same: the lane stays closed for Claude
plain non-agent program idle after about 4 s same

The final QA round ran at fc0576d0fad. 0c5d01ad5f2 only adds a renderer callback wrapper, so the main-process code under test is the same.

On main, worker-start --agent amp waits the full timeout with amp sitting at its prompt:
A-before.jpg

With this PR, while amp boots silently, nothing is typed into the pane:
B-before-paint-after2.jpg

Once amp paints, the task arrives after its prompt (fake amp echoes each line as got:):
B10-final-crop.jpg

Known limits (also in the PR body):

  • Some shells emit no command-started marker: zsh on SSH hosts, older fish, unwrapped sh/dash, and Windows commands launched as shell arguments. There the check falls back to any output, the same as the original commit.
  • For agents with no rest signal, a pause of more than 3 s while working can still read as idle.
  • An agent pane adopted after a restart that has printed nothing since still cannot settle on this lane, the same as on main.

Not verified:

  • Windows and SSH were not exercised live.
  • The "no stronger rest signal" classification is derived from the existing title tables, not from captured terminal recordings of each agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant