Skip to content

fix(agents): accept Muse idle composer without the voice footer - #25047

Closed
BeamNawapat wants to merge 2 commits into
stablyai:mainfrom
BeamNawapat:fix/muse-footer-free-readiness
Closed

BeamNawapat wants to merge 2 commits into
stablyai:mainfrom
BeamNawapat:fix/muse-footer-free-readiness

Conversation

@BeamNawapat

@BeamNawapat BeamNawapat commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On Linux, Muse's idle input box has no "Voice input" line under it. Orca was waiting for that line before sending a task to a Muse worker, so the worker start timed out. Orca now also recognizes the input box without that line.

What Changed

  • findMuseReadyPromptIndex (src/main/runtime/terminal-wait-detection.ts) used to need voice + input + ❯ after the last Muse Code banner. That match is kept, so every screen that was ready before still is.
  • In addition, a ❯ with a ─── rule directly above and directly below it counts as Muse's composer. That frame is there with or without the footer. Between the rule and ❯ the check skips whitespace and line breaks. Terminal escapes never reach the detector: the tail parser consumes them first, so the captured Muse bytes in __fixtures__/muse-empty-folder-ready.txt arrive as ───❯─── with no escape characters.
  • Only the newest ❯ after the banner is checked, in a 96-char window on each side. If a shell prompt sits below an exited Muse's old composer, the newest ❯ is the shell's, so the screen is not ready.
  • The quiet-stream gate and blocked-dialog checks are untouched.

Why

Two rules and not ❯ alone: starship / pure shell prompts also draw ❯, and shell output can draw a rule. With one rule, a crashed Muse with a shell prompt under its old banner would read as ready.

Linked Issue

Fixes #25005

Visual Proof

N/A: no UI change. The fix changes when the orchestration worker start sees Muse as ready.

Testing

  • New cases in terminal-wait-detection.test.ts: the footer-free composer from the issue, a footer-free composer with a trust dialog below it (blocked), and exited-Muse shell screens (~/app ❯; rule + path line + ❯; rule directly above ❯ ls; a shell ❯ below a stale footer-free composer) that must stay not-ready.
  • New case in muse-readiness-transcript.test.ts: the real captured Muse bytes with the voice-input footer swapped for a plain rule, replayed through the runtime, reads as tui-idle.
  • The shell-below-a-stale-composer case failed on the first commit of this branch (expected true to be false) and passes now. 8 test files touching Muse readiness and terminal wait: 189 passed. tsc -p config/tsconfig.node.json clean, oxlint/oxfmt clean, check-changed-code-quality 0 findings.
  • Not run: a live Linux Muse session. The footer-free screen is built from the issue's description.

Known limits, found by an independent verifier probing the detector:

  • Text typed into the composer (❯ hello between the rules) is not ready. Same as main for the footer-free case, and it fails safe.

  • A shell prompt painted exactly inside two rules under an old Muse banner would read as ready. I could not build that from a real shell; it needs the exact Muse frame.

  • A stale composer with the voice-input footer left in scrollback after /exit still matches below the banner. Same as main before this change. The footer-free match no longer has this problem, because only the newest ❯ counts.

  • Only the newest ❯ is checked, so a shell prompt that has no ❯ (plain $ or % ) painted below a stale footer-free composer still reads as ready.

  • I manually tested these changes locally

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

AI Disclosure

This PR was written by an AI agent (Claude Code, Claude Opus) on behalf of @BeamNawapat. Separate AI verifier passes reviewed the change against the issue; their findings were addressed or listed above before opening.

Muse Code on Linux paints its idle composer without the voice-input
footer, so the readiness predicate never matched and worker start
timed out at agent_readiness. Keep the footer match, and also accept
a prompt marker framed by a box-drawing rule on both sides, ignoring
the escapes Muse paints between them. A shell prompt next to a single
rule under an old banner still does not count.

Fixes stablyai#25005
@coderabbitai

coderabbitai Bot commented Oct 3, 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: 64fd78f5-824e-43f5-8b74-cf513443021f
📥 Commits

Reviewing files that changed from the base of the PR and between 646b391 and c242d6b.

📒 Files selected for processing (3)
  • src/main/runtime/muse-readiness-transcript.test.ts
  • src/main/runtime/terminal-wait-detection.test.ts
  • src/main/runtime/terminal-wait-detection.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/runtime/terminal-wait-detection.test.ts

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


📝 Walkthrough

Walkthrough

The Muse readiness detector now accepts a composer with either the voice-input footer or a rule-framed ❯ prompt. The rule-framing check examines the last prompt marker and checks for horizontal rules within 96 characters on both sides. Tests cover footer-free readiness, shell prompts below exited or stale Muse screens, and a trust dialog that blocks readiness. A transcript test also checks that a footer-free capture reaches tui-idle.

Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity>

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to c242d

If Muse exits back to a still-running shell during launch, stale composer text can make readiness succeed and route the task to the shell. This is a bounded launch failure, but it can submit unintended shell input and merits owner follow-up.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c242d

The change preserves permission checks and rejects several ordinary shell-prompt cases. However, an old input box could still be mistaken for readiness after Muse exits. If a shell remains open, pending task text could be submitted there instead. That production transition remains unverified, and the potential exposure is limited to the selected terminal’s existing authority.

Retained concerns

  • Medium · security · inferred: The new fallback can accept a retained footer-free composer without establishing that Muse still consumes terminal input. If Muse exits while its hosting shell remains connected and no newer ❯ replaces the composer marker, readiness can release a pending task to the surviving terminal consumer. The base rejected that footer-free text. Production reachability and shell interpretation remain unverified.
Security review details

Security Blast Radius

  • inferred — The conditional wrong-consumer path targets the selected terminal handle and PTY, not an arbitrary terminal. Its potential impact inherits the surviving consumer’s existing account, environment and accessible assets; shell execution or broader privilege escalation was not demonstrated.

Security Findings and Attack Paths

  • inferred — The newly accepted footer-free text creates a conditional path from retained terminal output to task submission without current consumer identity proof. Exploitation would require control over relevant terminal output or exit timing, a surviving writable consumer, and an authorized pending task. These prerequisites were not demonstrated end to end. The analogous broad voice-footer condition already existed in base.

Trust Boundaries and Controls

  • observed — The submission path verifies terminal connectivity, handle-to-PTY identity and lifecycle generation, and checks permissions before both paste and submit. It selects formatting using foregroundAgent or launchAgent, but the inspected write path does not assert that Muse is the current foreground consumer.

Resilience and Maintainability Implications

  • observed — Confirmed PTY exit marks the transport disconnected and prunes retained transcript state; prompt submission rejects a disconnected PTY. Full transport exit therefore has stronger containment than an agent exiting within a still-connected transport.

Hardening Proposals

  • proposed — Bind body-based readiness to the intended live agent consumer and revalidate that identity immediately before task submission, while preserving footer-free composer support. This would address the conditional stale-composer path rather than relying solely on terminal connectivity.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #25005’s footer-free idle-composer objective is implemented. findMuseReadyPromptIndex accepts a rule-framed ❯, and tests cover footer-free readiness, blocked dialogs, and shell prompts below… Reject a stale footer-bearing composer after Muse exits and add a regression test for that screen. Keep footer-bearing and footer-free idle-composer readiness, blocked-dialog handling, and active-work checks.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changes modify Muse readiness detection and related terminal and transcript tests. These changes support issue #25005. No unrelated changes are evident.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files.
Title check ✅ Passed The title clearly and concisely describes the main change: Muse idle-composer detection no longer requires the voice footer.
Description check ✅ Passed The description is mostly complete. It explains the problem, the detection change, the rationale, the linked issue, why visual proof is not applicable, and the tests and known limitations. The Review …
Full details: Linked Issues check

Explanation

Issue #25005’s footer-free idle-composer objective is implemented. findMuseReadyPromptIndex accepts a rule-framed ❯, and tests cover footer-free readiness, blocked dialogs, and shell prompts below stale footer-free composers. The existing footer path still accepts any ❯ when voice and input occur after the last Muse Code banner. A stale footer-bearing composer can therefore report ready after Muse exits. The PR description confirms this behavior, so stale-scrollback handling is incomplete.

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@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: 2af43b5f-6fe5-47bf-89a2-c8ee714ae219
📥 Commits

Reviewing files that changed from the base of the PR and between 1d010ce and 646b391.

📒 Files selected for processing (2)
  • src/main/runtime/terminal-wait-detection.test.ts
  • src/main/runtime/terminal-wait-detection.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.

@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 new footer-free Muse rule is tuned to the issue's synthetic illustration rather than a captured Linux PTY transcript. docs/reference/agent-pty-transcript-capture.md requires terminal-painted readiness rules to be pinned to a recorded transcript, and docs/reference/antigravity-readiness-evidence.md is the cautionary tale for remembered screens (three of four past attempts were worse than the bug they replaced). Please attach a Linux muse capture, or have the reporter provide one, before merging — or say explicitly why this shape is trustworthy without one.

Reviewed changes

  • Footer-free Muse composer recognized — findMuseReadyPromptIndex now also accepts a ❯ framed by ─── rules above and below, in addition to the existing voice + input footer match.
  • Bounded, escape-tolerant scan — hasRuleFramedMusePrompt checks only the last 8 ❯ after the last banner, each in a 96-char window with terminal escapes stripped.
  • Tests — no-footer composer (positive), exited-Muse shell screens (negative), an escape-painted composer (positive), and a footer-free composer with a trust dialog below it (negative).

⚠️ New readiness rule is pinned to a synthetic screen, not a capture

The predicate this PR relaxes is exactly the kind of rule the repo says must be written against a recorded agent transcript. The committed macOS fixture (muse-empty-folder-ready.txt) is a real capture, but the Linux footer-free shape that motivates this change comes from the issue's synthetic illustration — the same evidence class the Antigravity history shows is unreliable (wrapping, cursor moves, and column alignment are not handed back by a described screen). If the real Linux screen differs in any detail the heuristic keys on (rule adjacency to ❯, glyph, spacing), #25005 still times out. The change is conservative and fails safe, so this is about whether the fix is actually demonstrated, not about regression risk.

Technical details
# New Linux Muse rule lacks transcript evidence

## Affected sites
- `src/main/runtime/terminal-wait-detection.ts:173` — `hasRuleFramedMusePrompt`, the new heuristic.
- PR body "Testing" — author states: "Not run: a live Linux Muse session. The footer-free screen is built from the issue's description."

## Required outcome
- At least one committed capture of the real Linux `muse` idle screen (with the sidecar `platform: linux`), replayed through the runtime, so the heuristic is pinned to bytes rather than to a rendering of the issue text.

## Suggested approach (optional)
- Record with `node config/scripts/capture-agent-pty-transcript.mjs --name muse-linux-no-voice-footer -- muse ...` per `docs/reference/agent-pty-transcript-capture.md`, scrub it, and drive the readiness assertion through `onPtyData` (`agent-transcript-pane-test-harness.ts`) instead of `waitTextFor`. If the reporter can supply the screen, a capture from them also settles it.

## Open questions for the human (optional)
- Is a Linux Muse session reachable from CI or a maintainer machine at all, or should this ship as a documented best-effort against the reported shape?

ℹ️ Nitpicks

  • terminal-wait-detection.ts:190-191 still says "The voice-input composer is present even without loaded skills"; the function now also accepts a composer that carries no voice input, so the comment no longer describes the accepted shape.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

A footer-free composer left in scrollback matched even after Muse
exited and a shell prompt appeared below it, because the scan fell
back to older prompt markers. Only the newest prompt marker is
checked now.

The escape stripping in that scan was unreachable: the tail parser
consumes escapes before the detector sees text. Drop it and the test
that fed it hand-built escapes, and cover the footer-free screen with
the real captured Muse bytes instead.

@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 from 646b391 to c242d6b — the newest-❯ composer judgement, the escape-strip removal, and the new tests. The full PR remains three files.

  • Removed the terminal-escape stripping (TERMINAL_ESCAPE_RE/ESC/BEL) and the hand-built "escape-painted composer" test from the Muse composer matcher, since production waitText is parsed tail text that never carries escapes.
  • Narrowed hasRuleFramedMusePrompt to the newest ❯ only, so a shell prompt below an exited Muse's stale footer-free composer no longer reads as ready; the predicate stays strictly additive relative to main because the voice + input branch is unchanged.
  • Added a discriminating negative test for the stale-composer case and a createTranscriptPane replay of the captured Muse bytes with the voice-input footer swapped for a plain rule.

I ran pnpm test src/main/runtime/terminal-wait-detection.test.ts src/main/runtime/muse-readiness-transcript.test.ts (56 passed) and confirmed the new negative case fails when the scan is reverted to the earlier multi-candidate form, so it is real coverage.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Thanks a lot for digging into this, @BeamNawapat! We landed the fix for #25005 through #25695 (reworked during our bug bash, with your rule-framed composer idea and shell-prompt cases informing the final version, and you credited as co-author). Closing this one in favor of #25695.

@nwparker nwparker closed this Oct 28, 2026
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.

[Bug]: Muse Linux idle composer is rejected by the readiness detector when the voice-input footer is absent

2 participants