Repository navigation
fix(runtime): recognize Pi/OMP state-marker idle titles in tui-idle detection - #24113
AhmedNAgy25 wants to merge 4 commits into
Conversation
|
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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughTerminal wait and renderer send-title checks now use Pi state-title classification to recognize idle titles. Runtime records store and propagate stale-working-title-clear metadata. TUI idle evaluation ignores the matching cleared OSC title and suppresses adopted-PTY idle evidence when that flag is set. Tests cover title-state classification, stale-cleared titles, and first-party working status. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to The added test fixture breaks the repository’s node typecheck workflow. Fix the fixture before merging; no production failure is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change recognizes additional idle markers and prevents timer-cleared titles from falsely proving readiness. Permission handling remains distinct, and no introduced security issue was established. However, enforcement immediately before terminal input was not fully verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
|
| title.includes(GEMINI_IDLE_PREFIX) || | ||
| title.startsWith(PI_IDLE_PREFIX) | ||
| title.startsWith(PI_IDLE_PREFIX) || | ||
| getPiStateTitleStatus(title) === 'idle' |
There was a problem hiding this comment.
When a Pi/OMP working title stops updating but output continues, the existing three-second timer can change π : … to π > … without the agent reporting that it is idle. This new check treats that timer-generated title as strong readiness evidence, so a tui-idle wait can finish and pending input can be sent while the agent is still working—even if a fresh working status exists. The new send-title check also makes the rewritten title eligible for an immediate send. These readiness checks need to distinguish timer-generated clears from agent-emitted idle titles.
There was a problem hiding this comment.
Addressed in a6e2cd8:
- Tracked
lastOscTitleStaleWorkingClearin PTY and leaf records wheneverapplyTrackedPtyTitlereceivesmeta?.staleWorkingTitleClear. - Guarded
hasExplicitIdleTitleso timer-synthesized cleared titles are excluded from explicit idle evidence. - Evaluated fresh first-party working status before explicit idle titles in
evaluateTuiIdle, ensuring an active working account always vetoes title settlement. - Added
meta?.staleWorkingTitleClearsuppression todetectAgentSendTitleStatusto reject immediate send eligibility on timer-cleared titles.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Recognize Pi/OMP state-marker idle titles in main
tui-idledetection —computeExplicitIdleStatusFromTitlenow acceptsgetPiStateTitleStatus(title) === 'idle', soπ > <dir>/OMP > <dir>/Pi > <dir>count as explicit idle evidence, while:(working) and!(permission) keep their prior classification. - Mirror the check in the renderer send gate —
isExplicitIdleSendTitlegains the same disjunct, so immediate sends to an idle Pi/OMP pane are no longer rejected as non-explicit. - Tests —
π >,OMP >,Pi >, wrapper-prefixedzsh | π >, legacyπ -, plus rejection of:,!, and braille-work titles in bothterminal-wait-detection.test.tsandagent-send-title-status.test.ts.
This reuses the canonical getPiStateTitleStatus parser rather than adding a parallel one, and the outer gate (detectAgentStatusFromTitle) already returns idle for these markers, so the new condition only promotes an idle title to explicit — no base-status change and no regression for working/permission markers. The legacy π - prefix must stay because - is intentionally not a table marker. Grep confirms no other file defines a parallel explicit-idle check.
The added tests are real regressions: without the source change both functions return null for π > …. Verified locally with pnpm test src/main/runtime/terminal-wait-detection.test.ts src/renderer/src/lib/agent-send-title-status.test.ts (77 passed).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ssions in readiness
There was a problem hiding this comment.
Important
The new stale-title-clear provenance flag is only reliably read on the PTY record; the leaf copy is dropped on every renderer graph publish, so a leaf-based tui-idle wait can still settle on a timer-synthesized idle title. Details inline.
Reviewed changes
- Added stale-clear provenance to terminal records —
lastOscTitleStaleWorkingClearis written on PTY and leaf records inapplyTrackedPtyTitle, reset on provider-generation change, and added to the runtime record and evidence types. - Refused timer-synthesized titles in readiness —
hasExplicitIdleTitlenow skips a title whose stale-clear flag is set, andevaluateTuiIdlereorders a fresh first-partyworkingstatus ahead of the explicit-idle and body-evidence checks. - Added a renderer
metaparameter —detectAgentSendTitleStatusaccepts{ staleWorkingTitleClear }and returnsnullfor flagged titles, with a matching unit test. - Retained commit 1's state-marker recognition —
π >/OMP >/Pi >stay recognized as explicit idle in both the main wait detector and the renderer send gate, with unit tests.
ℹ️ PR description predates the second commit
The description and testing notes cover only the Pi/OMP state-marker recognition (commit eb7686b). They do not mention the stale-clear provenance plumbing, the evaluateTuiIdle tier reorder, or the new renderer parameter added in a6e2cd8. Refreshing it would help reviewers and the agent_readiness history see the full behavior change.
Technical details
# PR description does not cover commit 2
## Affected sites
- PR body "What Changed" / "Testing" — describes only commit `eb7686b`.
## Required outcome
- The description should state the second behavior change (rejecting timer-synthesized idle titles, and the working-vs-title precedence reorder) and its tests, so the change is reviewable on its own terms.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 67adfa17-9736-4cae-ab68-b5b0d410a130
📒 Files selected for processing (6)
src/main/runtime/orca-runtime-apply-tracked-pty-title.tssrc/main/runtime/runtime-terminal-state-records.tssrc/main/runtime/tui-idle-evidence.test.tssrc/main/runtime/tui-idle-evidence.tssrc/renderer/src/lib/agent-send-title-status.test.tssrc/renderer/src/lib/agent-send-title-status.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
…idle titles - Maintain tier 1 precedence in evaluateTuiIdle so genuine explicit idle titles (not synthesized by timer) settle ready-strong over retained working status. - Guard adopted PTY idle status against lastOscTitleStaleWorkingClear. - Copy lastOscTitleStaleWorkingClear in syncWindowGraph rebuilt leaves and reset it in provider generation change. - Remove unused meta parameter from detectAgentSendTitleStatus.
There was a problem hiding this comment.
Important
One new issue: the added ptyTuiIdleEvidence test builds a TuiIdleEvidenceSource that omits the required getTabTitle, so pnpm typecheck:node fails.
Reviewed changes
- Restored tier-1 precedence —
evaluateTuiIdlenow checks the explicit idle title / positive body evidence before a fresh first-partyworkingstatus, so a genuine Pi/OMP idle title settles while timer-synthesized ones stay rejected. Againstmainthis is only a clarifying comment; the previous reorder is undone. - Dropped the unwired renderer
metaparameter —detectAgentSendTitleStatusno longer accepts{ staleWorkingTitleClear }; the inert early return and its test are removed. - Fixed leaf stale-clear provenance —
syncWindowGraphnow copieslastOscTitleStaleWorkingClearfrom its tail source besidelastOscTitle, andresetTrackedTerminalStateForProviderGenerationclears it on the leaf. - Guarded the adopted-PTY idle branch —
ptyTuiIdleEvidence.readPositiveBodyEvidencerefusesgetAdoptedPtyIdleStatus(...) === 'idle'when the PTY's stale-clear flag is set. - Tests — added stale-clear rejection and genuine-idle cases in
tui-idle-evidence.test.ts, plus state-marker cases interminal-wait-detection.test.tsandagent-send-title-status.test.ts.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const source: TuiIdleEvidenceSource = { | ||
| getPaneAgent: () => 'omp', |
There was a problem hiding this comment.
The new test builds a TuiIdleEvidenceSource without getTabTitle, which is a required member of the type (tui-idle-evidence.ts:328). pnpm typecheck:node currently fails here with TS2741, so the typecheck gate is red even though the runtime tests pass. Add the missing stub — the PTY lane never reads it, since ptyTuiIdleEvidence reads only record.lastOscTitle.
| const source: TuiIdleEvidenceSource = { | |
| getPaneAgent: () => 'omp', | |
| const source: TuiIdleEvidenceSource = { | |
| getTabTitle: () => null, | |
| getPaneAgent: () => 'omp', |
Comments Outside DiffThese findings could not be posted inline.
|
|
Fixed in commit f083e53. Separated the explicit idle title check from positive body evidence in |
There was a problem hiding this comment.
ℹ️ No critical issues — one comment-documentation nit inline.
Reviewed changes
- Demoted positive body evidence below a fresh first-party status —
evaluateTuiIdlenow runsreadPositiveBodyEvidence()after the freshdone/working/blocked/waitingchecks, so a ready prompt retained in the terminal tail no longer settlesready-strongover an active turn. This is a broad behavior change (all agents, not just Pi/OMP), but it is consistent with the existing rule that ablocked/waitingaccount stayspending, and all affected suites pass. - Added a regression test — a pane reporting fresh
workingwith positive body evidence now returnsworking. - The prior review's
tui-idle-evidence.ts:78/:279/agent-send-title-status.ts:21threads from review5365163192remain addressed (resolved).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| ? WORKING | ||
| : { kind: 'pending', quietForeground: 'closed' } | ||
| } | ||
| // Why positive body evidence after fresh working status: a retained prompt from a previous turn |
There was a problem hiding this comment.
Moving body evidence below a fresh first-party status contradicts this module's canonical ranking, which still lists it under tier 1: the header comment (tui-idle-evidence.ts:30-31, "an explicit idle marker in its own title, or a known ready-prompt body") and the readPositiveBodyEvidence JSDoc (tui-idle-evidence.ts:203, "Tier 1 body evidence") both describe it as tier 1. Since a fresh working now outranks it, updating those two spots keeps the tier numbering a reader can trust.

ELI5
Recognize Pi and OMP state-marker idle titles (e.g.
π > <dir>orOMP > <dir>) as explicit idle readiness signals in terminal wait and active send detection.What Changed
π -prefix (PI_IDLE_PREFIX = '\u03c0 - '). Modern OMP and Pi (v17.2+ and v18.x) write dynamic state separators between the brand and label (π > <dir>for idle,π : <dir>for working,π ! <dir>for permission). Becauseπ > <dir>did not start withπ -,computeExplicitIdleStatusFromTitleandisExplicitIdleSendTitlerejected it as an explicit idle signal. During orchestrationworker-start --agent omp, readiness waited for timeout instead of recognizing the idle prompt.computeExplicitIdleStatusFromTitleandisExplicitIdleSendTitlecheckgetPiStateTitleStatus(title) === 'idle', recognizingπ > <dir>,OMP > <dir>, andPi > <dir>as strong idle signals while continuing to recognize legacyπ -titles and rejecting working (:) or permission (!) markers.getPiStateTitleStatusfromsrc/shared/pi-state-title-marker.tsinsrc/main/runtime/terminal-wait-detection.tsandsrc/renderer/src/lib/agent-send-title-status.ts. Added comprehensive unit tests interminal-wait-detection.test.tsandagent-send-title-status.test.ts.Why
Pi and OMP encode their operational turn state directly in the title separator (
:,!,>). Orca title parser already extracts this marker viagetPiStateTitleStatus(). Wiring this check into explicit idle detection ensures managed worker launches (worker-start),orca terminal wait --for tui-idle, and note/prompt dispatch immediately recognize when a fresh Pi or OMP session is idle and ready for input.Linked Issue
If you do not have one and are an outside contributors, your PR wiil be ignored. Refs is not sufficient. Link an actual issue
Fixes #24068
Visual Proof
N/A— Background terminal readiness and title status detection change; no UI layout or styling modifications.Testing
Manually verified state title detection on
π > ...,OMP > ...,Pi > ...,π : ..., andπ ! ....Automated tests added and passed:
src/main/runtime/terminal-wait-detection.test.ts(64 tests pass)src/renderer/src/lib/agent-send-title-status.test.ts(13 tests pass)Full regression suites passed:
tui-idle-evidence.test.ts,terminal-wait-name-only-idle.test.ts,tui-idle-delivery-and-quiescence.test.ts,runtime-terminal-idle-polls.test.ts,pi-state-title-marker.test.ts,omp-pi-semantic-title-preservation.test.ts,omp-owner-state-title.test.ts(190 tests pass).Quality gates passed:
check-changed-code-quality.mjspassed with 0 findings across all changed files.tscon node and web passed with 0 errors.oxfmtformatting verification passed.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Assisted by Google DeepMind Antigravity agent.
Review
No changes to security boundaries, protocol shapes, or remote wire interfaces. Backward-compatible across Linux, Windows, macOS, and SSH workspaces.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)