Repository navigation
feat(agents): add first-class Muse Code harness - #22216
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe pull request adds Muse as an interactive and headless agent. It adds launch, process recognition, permission, resume, commit-message, hook, telemetry, and transcript-polling support. It adds local and remote Muse session scanning with transcript parsing. It adds terminal readiness and idle detection. It updates renderer, mobile, skills, localization, documentation, configuration, and tests. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Muse can show a stale question during a later turn, and several integration inconsistencies remain. Resolve these issues before merging. 🚥 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 ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
|
There was a problem hiding this comment.
Important
One red CI test: adding muse to AI_VAULT_AGENTS without a Muse fixture in writeEveryAgentVault fails the every-agent transcript-capture guard, so pnpm test cannot pass. The rest of the harness wiring looks sound — the JSONC editor preserves user content, the readiness lane does not leak into other agents, and the session parser checks out.
Reviewed changes
- Canonical agent registration —
musethreaded through the shared agent registries (tui-agent, kind, labels, telemetry, permissions, selection, skill discovery/install) plus catalog, icon, mobile, i18n, docs, and README. - Managed hooks — new
src/main/muse/service with a JSONC-preservingsettings.jsoneditor, a generated managed hooks file, POSIX and native-Windows.cmdscripts, and local + SSH SFTP install paths; Claude-compatible events normalized inproviders/muse-events.ts. - Session history — local and remote Muse transcript parsing (envelope unwrap, microsecond timestamps, intent/run dedupe), date-sharded path resolution, and token/model/branch/cwd extraction; pre-existing remote parsers were extracted to a new
remote-session-scanner-source-parsers.ts. - Resume —
muse resume <id>for AI Vault, a gatedagent-session.muse-resume.v1capability, and the host-authority map entry. - Runtime readiness — a dedicated Muse ready-screen lane, since Muse emits no idle OSC title, held to quiescence as tier 1b.
- Process recognition — versioned
muse-bin-*foreground matching andmuse execone-shot filtering.
ℹ️ Nitpicks
docs/site/content/docs/agents/supported.mdx:51lists "macOS/Linux", but this PR adds native Windows hook and session support; reconcile the row with what actually ships.- No test covers the Muse pane-resume plan, which builds
muse --trust-workspace resume <id>(a flag before theresumesubcommand). An AI Vault resume usesmuse resume <id>, so abuildAgentResumeStartupPlan('muse', …)test would pin the ordering against the CLI. - The
hasQuietMuseReadyPromptdoc comment (src/main/runtime/tui-idle-evidence.ts) says a non-Muse scrollback quoting Muse "must not settle its wait", but theagent === nullbranch does admit that evidence. Either narrow the branch or correct the comment.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| diagnosticName: string | ||
| ): Record<string, unknown> | null { | ||
| const errors: ParseError[] = [] | ||
| const parsed = parseJsonc(text, errors) |
There was a problem hiding this comment.
parseJsonc reports an InvalidSymbol error for a leading UTF-8 BOM even when it parses the object, so a BOM-prefixed Muse settings.json is treated as malformed and install()/getStatus()/remove() all fail closed — Orca can never install hooks and only reports Could not read Muse settings.json. The sibling JSONC reader strips the BOM first (src/main/agent-hooks/hooks-json-read.ts:17); doing the same here would keep the two readers consistent.
There was a problem hiding this comment.
Important
Test-only follow-up since the prior review. The four new commits harden the hook, source-control, and skill-picker tests and all five touched test files pass. One item from the prior review is still open: session-transcript-every-agent-capture.test.ts remains red at 7b3f0c2 because the shared every-agent vault still has no Muse fixture (verified by re-running it).
Reviewed changes
- Remote hook registration coverage —
remote-hook-service-installers.test.tsaddsmuseHookServiceto the service map that guards the remote installer list. - Hook command contract coverage —
managed-hook-command-contract.test.tsadds local and remote Muse command builders. - Count hardening —
managed-hook-local-filesystem.test.tsnow derives expected installer counts fromREMOTE_MANAGED_HOOK_INSTALLER_AGENTS.lengthinstead of a hardcoded14, and filters managed scripts by.sh/.cmdextension. - Contract string and picker coverage — the Source Control unsupported-agent message now asserts Muse, and
SkillInstallDialog.test.tsxscopes its provider-button lookup to the detected provider so canonical-root agents cannot break it.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Add Muse as a supervised Orca agent across desktop, mobile, session history, source control, local hooks, SSH, WSL, and native Windows. Preserve user settings, support Muse 1.3 hook environment allowlists, and recognize versioned foreground processes. Include question, waiting, completion, resume, and readiness coverage. Co-authored-by: homesh-dev <[email protected]> Co-authored-by: jeffhuen <[email protected]> Co-authored-by: John Cusack <[email protected]> Co-authored-by: Adrien De oliveira <[email protected]>
7b3f0c2 to
e30d78f
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 8ca1bcd3-b53a-4920-9c10-bca0792f4232
⛔ Files ignored due to path filters (1)
src/shared/agent-icons/muse.pngis excluded by!**/*.png
📒 Files selected for processing (102)
README.mdconfig/scripts/mobile-web-app-session-terminal-closure.test.mjsconfig/tsconfig.cli.jsondocs/readme/README.es.mddocs/readme/README.fr.mddocs/readme/README.ja.mddocs/readme/README.ko.mddocs/readme/README.pt.mddocs/readme/README.zh-CN.mddocs/site/content/docs/agents/session-history.mdxdocs/site/content/docs/agents/supported.mdxmobile/src/components/mobile-agent-icon-assets.tsmobile/src/tasks/mobile-tui-agents.tssrc/main/agent-hooks/managed-agent-hook-registry.tssrc/main/agent-hooks/managed-hook-command-contract.test.tssrc/main/agent-hooks/managed-hook-local-filesystem.test.tssrc/main/agent-hooks/remote-hook-service-installers.test.tssrc/main/agent-hooks/remote-managed-hook-installers.tssrc/main/agent-hooks/server-retired-pane-new-turn.test.tssrc/main/ai-vault/remote-session-scanner-muse.test.tssrc/main/ai-vault/remote-session-scanner-source-parsers.tssrc/main/ai-vault/remote-session-scanner-sources.tssrc/main/ai-vault/session-scanner-agent-parser.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-codex-workers.test.tssrc/main/ai-vault/session-scanner-every-agent-fixture.tssrc/main/ai-vault/session-scanner-muse-parser.tssrc/main/ai-vault/session-scanner-muse-paths.tssrc/main/ai-vault/session-scanner-muse.test.tssrc/main/ai-vault/session-scanner-opencode-sqlite-coexistence.test.tssrc/main/ai-vault/session-scanner-parse-cache.tssrc/main/ai-vault/session-scanner-test-fixtures.tssrc/main/ai-vault/session-scanner-types.tssrc/main/ai-vault/session-scanner.test.tssrc/main/muse/hook-config-json.test.tssrc/main/muse/hook-config-json.tssrc/main/muse/hook-service.test.tssrc/main/muse/hook-service.tssrc/main/muse/hook-settings.tssrc/main/runtime/__fixtures__/muse-empty-folder-ready.meta.jsonsrc/main/runtime/__fixtures__/muse-empty-folder-ready.txtsrc/main/runtime/muse-readiness-transcript.test.tssrc/main/runtime/orca-runtime-resolve-exit-waiters.tssrc/main/runtime/runtime-terminal-idle-polls.tssrc/main/runtime/runtime-terminal-wait.tssrc/main/runtime/terminal-wait-detection.test.tssrc/main/runtime/terminal-wait-detection.tssrc/main/runtime/terminal-wait-name-only-idle.test.tssrc/main/runtime/tui-idle-evidence.test.tssrc/main/runtime/tui-idle-evidence.tssrc/main/skills/skill-discovery-concurrency.test.tssrc/main/skills/skill-discovery-sources.tssrc/renderer/src/components/skills/SkillInstallDialog.test.tsxsrc/renderer/src/components/terminal-pane/terminal-startup-command-classifier.test.tssrc/renderer/src/components/terminal-pane/terminal-startup-command-classifier.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-catalog.tsxsrc/renderer/src/lib/agent-favicon-assets.tssrc/renderer/src/lib/agent-status.tssrc/renderer/src/lib/tui-agent-startup.test.tssrc/renderer/src/runtime/agent-resume-host-authority-capability.test.tssrc/renderer/src/runtime/agent-resume-host-authority-capability.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/shared/agent-headless-command.tssrc/shared/agent-hook-listener-claude-compatible-vendors.test.tssrc/shared/agent-hook-listener/provider-dispatch.tssrc/shared/agent-hook-listener/provider-event-routing.tssrc/shared/agent-hook-listener/providers/muse-events.tssrc/shared/agent-hook-listener/source-routing.tssrc/shared/agent-hook-relay.tssrc/shared/agent-hook-types.tssrc/shared/agent-kind.tssrc/shared/agent-process-recognition.test.tssrc/shared/agent-process-recognition.tssrc/shared/agent-session-resume.tssrc/shared/agent-type-label.tssrc/shared/ai-vault-resume-command.test.tssrc/shared/ai-vault-resume-command.tssrc/shared/ai-vault-types.tssrc/shared/commit-message-agent-spec.test.tssrc/shared/commit-message-agent-specs-secondary.tssrc/shared/commit-message-plan.test.tssrc/shared/constants.test.tssrc/shared/muse-headless-command.tssrc/shared/protocol-version.tssrc/shared/skill-install-providers.tssrc/shared/skills-cli-agent-keys.tssrc/shared/source-control-ai-action-recipes.test.tssrc/shared/telemetry-property-schemas.tssrc/shared/tui-agent-config.test.tssrc/shared/tui-agent-config.tssrc/shared/tui-agent-display-names.tssrc/shared/tui-agent-permissions.test.tssrc/shared/tui-agent-permissions.tssrc/shared/tui-agent-selection.tssrc/shared/tui-agent-startup.test.tssrc/shared/tui-agent.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| | Codebuff | Auto-setup | [Codebuff](https://www.codebuff.com/docs/help/quick-start) | | ||
| | Freebuff | Auto-setup | [Freebuff](https://freebuff.com/cli) | | ||
| | Command Code | Auto-setup, status | [Command Code](https://commandcode.ai/docs/quickstart) | | ||
| | Muse | macOS/Linux; trusts the workspace at launch | [Meta](https://dev.meta.ai/docs/muse-code) | |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n -C4 "muse|win32|Windows|powershell|muse\\.cmd" src/shared/tui-agent-config.ts src/shared/tui-agent-startup.test.ts src/main/muse/hook-service.ts docs/site/content/docs/agents/supported.mdxRepository: stablyai/orca
Length of output: 34491
Document native Windows support for Muse.
The Muse startup tests cover native Windows with both PowerShell and cmd, and the implementation provides a Windows hook script. Add Windows to this platform list.
| <a href="https://github.com/mistralai/mistral-vibe"><kbd><img src="https://www.google.com/s2/favicons?domain=mistral.ai&sz=64" alt="Mistral Vibe logo" width="16" valign="middle" /> Mistral Vibe</kbd></a> | ||
| <a href="https://github.com/QwenLM/qwen-code"><kbd><img src="https://www.google.com/s2/favicons?domain=qwenlm.github.io&sz=64" alt="Qwen Code logo" width="16" valign="middle" /> Qwen Code</kbd></a> | ||
| <a href="https://support.atlassian.com/rovo/docs/install-and-run-rovo-dev-cli-on-your-device/"><kbd><img src="https://www.google.com/s2/favicons?domain=atlassian.com&sz=64" alt="Rovo Dev logo" width="16" valign="middle" /> Rovo Dev</kbd></a> | ||
| <a href="https://dev.meta.ai/docs/muse-code"><kbd><img src="https://www.google.com/s2/favicons?domain=dev.meta.ai&sz=64" alt="Muse logo" width="16" valign="middle" /> Muse</kbd></a> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove the duplicate Muse entry.
The Supported Agents list already adds Muse on Line 181. Remove the second entry on Line 207 so the README lists each agent once.
Muse 1.3 fires no hook for request_user_input, so a pending question left the pane "working". Its internal reminder subagents also post hooks with their own session ids (even after Stop), which surfaced "tool failed" rows and flipped finished panes back to working. - Read pending questions from Muse's session log (user_input_prompt_requested/settled) via the existing transcript poll, now generalized from Codex subagents to Muse on main and relay. - Drop child-session hooks (SubagentStart ids, or turn_id === session_id). - Treat Notification permission_prompt as the approval wait; PermissionRequest also fires for auto-approved calls, so it only caches the approval card. - Ignore Notification copy as the prompt; poll replays are not new prompts or turn boundaries. - Allowlist USERPROFILE so Windows cmd AutoRun doesn't fail every hook.
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: be2d021f-a932-44b8-835b-2399f58d2c29
📒 Files selected for processing (23)
src/main/agent-hooks/server-hook-http-ingest.test.tssrc/main/agent-hooks/server-muse-session-log-poll.test.tssrc/main/agent-hooks/server/server-authority-aliases.tssrc/main/agent-hooks/server/server-authority-fences.tssrc/main/agent-hooks/server/server-cleanup.tssrc/main/agent-hooks/server/server-lifecycle.tssrc/main/agent-hooks/server/server-state.tssrc/main/agent-hooks/server/server-status-retries.tssrc/main/agent-hooks/server/server-tab-cleanup.tssrc/main/ai-vault/session-scanner-muse-paths.tssrc/main/muse/hook-config-json.tssrc/main/muse/hook-settings.tssrc/relay/agent-hook-result-retry-scheduler.tssrc/relay/agent-hook-server.test.tssrc/relay/agent-hook-server.tssrc/shared/agent-hook-listener-claude-compatible-vendors.test.tssrc/shared/agent-hook-listener-relay-dependency.test.tssrc/shared/agent-hook-listener/listener-state.tssrc/shared/agent-hook-listener/providers/muse-events.test.tssrc/shared/agent-hook-listener/providers/muse-events.tssrc/shared/agent-hook-listener/transcript-poll-policy.tssrc/shared/muse-session-log.test.tssrc/shared/muse-session-log.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/muse/hook-settings.ts
- src/shared/agent-hook-listener-claude-compatible-vendors.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| codexSubagentTranscriptByPaneKey: new Map(), | ||
| codexLeadStateByPaneKey: new Map(), | ||
| grokActiveTurnByPaneKey: new Map(), | ||
| musePaneStateByPaneKey: new Map(), |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Clear Muse state in clearAllListenerCaches.
The new map survives clearAllListenerCaches. A stop and restart can retain old session-log cursors, child-session filters, and pending approval data.
Add state.musePaneStateByPaneKey.clear() with the other provider caches.
Proposed fix
state.codexLeadStateByPaneKey.clear()
state.grokActiveTurnByPaneKey.clear()
+ state.musePaneStateByPaneKey.clear()
state.opencodeSessionPaneBySessionId.clear()There was a problem hiding this comment.
ℹ️ No critical issues — one small state-cleanup gap inline.
Reviewed changes
This run re-reviewed 5bef4cb (fix(muse): detect questions and approvals from structured Muse signals), the only commit since the last reviewed version, and a sizeable functional addition rather than a test-only follow-up.
- New Muse session-log reader —
src/shared/muse-session-log.tslocates a live session'ssession.jsonlfrom its UUIDv7 timestamp shard (probing ±1 day, local and UTC), incrementally readsuser_input_prompt_requested/user_input_prompt_settled, and returns the newest open question. - Generalized transcript poll —
transcript-poll-policy.tsreworks the Codex-subagent poll intoshouldPollHookTranscript/transcriptPollUpdate; Muse polls its session log to surface therequest_user_inputwait and clears it on settle, stripping the replay'shasExplicitPrompt/hookEventName. - Muse event rework — child-session hooks are dropped (
SubagentStartids, orturn_id === session_id);PermissionRequestonly caches the approval card,Notificationpermission_promptis the visible wait, andNotificationcopy no longer overwrites the prompt. - Scheduler rename —
schedule/clearCodexSubagentPollbecameschedule/clearTranscriptPollacross the main server and relay; no stale references remain. - Windows and child hooks —
SubagentStartadded to the managed events andUSERPROFILEto the managed-hook env allowlist. - Coverage — new
muse-events.test.ts,muse-session-log.test.ts, and a main-serverserver-muse-session-log-poll.test.tsthat fails if question detection regresses; hook/relay ordering tests updated. All targeted tests pass locally.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| codexSubagentTranscriptByPaneKey: new Map(), | ||
| codexLeadStateByPaneKey: new Map(), | ||
| grokActiveTurnByPaneKey: new Map(), | ||
| musePaneStateByPaneKey: new Map(), |
There was a problem hiding this comment.
musePaneStateByPaneKey is now the only per-pane map that clearAllListenerCaches (listener-state.ts:331) does not clear, so Muse child-session ids and pendingApproval outlive a full server/relay cache reset (stop() / relay close). The pane-scoped path already handles it in clearPaneCacheState; the global sweep just needs the same line.
Technical details
# Muse pane state not cleared by the global cache sweep
## Affected sites
- `src/shared/agent-hook-listener/listener-state.ts:331` — `clearAllListenerCaches` clears `codexSubagentTranscriptByPaneKey`, `codexLeadStateByPaneKey`, `grokActiveTurnByPaneKey`, `opencodeSessionPaneBySessionId`, `lastLaunchTokenByPaneKey`, … but not `musePaneStateByPaneKey` (added at line 56/132).
- `src/shared/agent-hook-listener/listener-state.ts:221` — `clearPaneCacheState` does delete it, so only the global sweep is inconsistent.
## Required outcome
- `clearAllListenerCaches` clears `musePaneStateByPaneKey`, matching its sibling per-pane maps.
## Suggested approach
- Add `state.musePaneStateByPaneKey.clear()` next to the other map clears.Most Muse session-log lines are large model/tool records. Filter raw lines by the user_input_prompt_ marker before JSON.parse via an optional readJsonlCursor line filter.
# Conflicts: # config/scripts/mobile-web-app-session-terminal-closure.test.mjs
… turn Review follow-ups: question events inside retained_frame batches were skipped, and a question left open by a crash or interrupt stayed pending for the pane's life. Share the history scanner's retained_frame unwrapper, and only report a pending question whose run_id matches the hook turn_id.
There was a problem hiding this comment.
ℹ️ No new issues in the latest commits — two earlier review threads remain open.
Reviewed changes
This run re-reviewed the two commits since the prior pullfrog review at d8c9609: d86d2aa (fix(muse): unwrap batched log records and scope questions to the live turn) and 95f2599 (refactor(muse): drop type assertion in retained_frame unwrap).
- Batched log unwrap — extracted
unwrapMuseLogRecordsintosrc/shared/muse-session-log.ts. Both the surface-log poll and the AI Vault parser (session-scanner-muse-parser.ts) now expand aretained_frame'schildren[].record_jsonidentically; the byte-offset cursor and the"user_input_prompt_line filter still run against whole physical lines, so a batched frame is parsed as one line and unwrapped afterward. - Turn-scoped questions —
readMusePendingUserInputnow takes the hook payload'sturn_idand returns only the newest pending prompt whose logrun_idmatches it (falling back when either id is absent). A question left open by a crashed or interrupted earlier run (run_idpersisted from the log's outerpayload.run_id) no longer pins a later turn as waiting. - Coverage —
muse-session-log.test.tsadds cases for a prompt batched inside aretained_frameand for an earlier run's open prompt;muse-events.test.tsaligns its logrun_idwith the hookturn_id, so the poll path is actually exercised. Verified locally:muse-session-log(8) andmuse-events(5), the ai-vault Muse parsers, andserver-muse-session-log-pollall pass.
Two earlier findings are still open and untouched by these commits, so I have not re-raised them inline:
parseMuseSettingsTextdoes not strip a UTF-8 BOM (src/main/muse/hook-config-json.ts:32), so a BOM-prefixedsettings.jsonfails closed.clearAllListenerCachesomitsmusePaneStateByPaneKey(src/shared/agent-hook-listener/listener-state.ts:331), leaving Muse child-session ids andpendingApprovalacross a full cache reset.
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: 54b8aa13-f508-41af-a5eb-ea81d81e737f
⛔ Files ignored due to path filters (1)
src/shared/agent-icons/muse.pngis excluded by!**/*.png
📒 Files selected for processing (8)
config/scripts/mobile-web-app-session-terminal-closure.test.mjssrc/main/ai-vault/session-scanner-codex-workers.test.tssrc/main/ai-vault/session-scanner-muse-parser.tssrc/shared/agent-hook-listener/providers/muse-events.test.tssrc/shared/agent-hook-listener/providers/muse-events.tssrc/shared/agent-hook-listener/transcript-poll-policy.tssrc/shared/muse-session-log.test.tssrc/shared/muse-session-log.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| } | ||
| // Why: a question left open by a crash or interrupt stays in the log; only the live turn's can block. | ||
| const pending = Array.from(log.pending.values()) | ||
| return pending.findLast((prompt) => !turnId || !prompt.runId || prompt.runId === turnId) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- outline ---'
ast-grep outline src/shared/muse-session-log.ts
printf '%s\n' '--- target and nearby definitions ---'
sed -n '1,230p' src/shared/muse-session-log.ts
printf '%s\n' '--- related run_id and pending-input references ---'
rg -n -C 3 'run_id|runId|user_input_prompt_requested|readMusePendingUserInput|pending' src --glob '!**/node_modules/**'Repository: stablyai/orca
Length of output: 45543
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions
Length of output: 47678
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- file size ---'
wc -l src/shared/muse-session-log.ts
printf '%s\n' '--- session log source ---'
cat -n src/shared/muse-session-log.ts
printf '%s\n' '--- exact function callers ---'
rg -n -l 'readMusePendingUserInput|MusePendingUserInput|createMuseSessionLogState' src --glob '!**/node_modules/**' | head -100
printf '%s\n' '--- bounded caller excerpts ---'
for file in $(rg -l 'readMusePendingUserInput|MusePendingUserInput|createMuseSessionLogState' src --glob '!**/node_modules/**' | head -20); do
printf '\n--- %s ---\n' "$file"
rg -n -C 8 'readMusePendingUserInput|MusePendingUserInput|createMuseSessionLogState' "$file"
doneRepository: stablyai/orca
Length of output: 14072
Require an exact run ID for scoped turns.
When turnId is defined, the predicate still accepts prompts without runId. An unanswered record without payload.run_id can therefore match a later turn, return a stale question, and set that turn to waiting.
Suggested fix
- return pending.findLast((prompt) => !turnId || !prompt.runId || prompt.runId === turnId)
+ return pending.findLast((prompt) => turnId === undefined || prompt.runId === turnId)📝 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.
| return pending.findLast((prompt) => !turnId || !prompt.runId || prompt.runId === turnId) | |
| return pending.findLast((prompt) => turnId === undefined || prompt.runId === turnId) |

ELI5
Orca now treats Muse Code like its other supervised coding agents. You can launch Muse from the agent picker. Its questions, approval prompts, notifications, working/waiting/done state, history, resume, hooks and Source Control flows all appear in the same Orca places as other agents.
What Changed
execorresume, is still typed as a prompt.muse-bin-*process, and keeps one-shotmuse execruns out of interactive status.Notificationevent with typepermission_promptdrives waiting for approval.PermissionRequestalso fires for calls Muse approves on its own, so Orca only uses it to fill in the approval card (tool name and command).request_user_inputquestion tool waits. Orca instead reads the question from Muse's session log (user_input_prompt_requested/user_input_prompt_settledin~/.local/share/muse/sessions/YYYY/MM/DD/<session>/session.jsonl). The existing once-a-second Codex transcript poll now also serves Muse and runs on the machine where Muse runs, including over SSH and WSL. The pane shows waiting with the question card, then working once you answer.SubagentStart; helper events also carryturn_id === session_id). Before this, they produced "tool failed" rows and flipped finished panes back to working.managed_hooks_env_vars, and never overwrite a hooks path someone else configured. The allowed variables includeUSERPROFILE, because Muse removes most environment variables before running a hook, and a Windows cmd startup (AutoRun) script that uses%USERPROFILE%otherwise makes every hook exit 1.muse.cmdand generates a hook script that callscurl.exe.muse resume <session-id>, offered only when the host supports it.muse execwith read-only flags and passes the prompt after--.Why
Adding Muse to the agent list alone would leave questions, approvals, history, resume and remote Windows incomplete, so this follows the same contracts as the other first-class agents. We captured Muse 1.3.0's real hook payloads and found:
PermissionRequestfires even for calls Muse approves automatically.Alternatives considered for detecting questions:
muse servepublishes proper status updates, but only for sessions it hosts itself, and it can't attach to a terminal session.PreLLMCall/PostLLMCall) don't include tool names, and each one is about 34 KB.The session log is written for every session, has stable fields, and is readable on the machine where Muse runs.
Linked Issue
Related to the community implementation work in #19188, #18791, and #21494.
Visual Proof
Before / launch picker:
After / Muse running as a first-class agent:
Testing
Manual, macOS dev build (Muse 1.3.0,
1.3.0-R3401.1):Manual, Windows (
awin):cmd.exe /c, keepingSystemRoot,ComSpecandPath, and the generated hook script andcurl.exerun.USERPROFILEto the allowed variables changed hook runs fromfailed exit=1tocompleted exit=0on a host whose cmd AutoRun script uses it.Automated:
pnpm tcand the changed-code quality gate pass. The agent-hook, relay, Muse and ai-vault suites pass: 4,519 tests.AI Disclosure
OpenAI Codex and Anthropic Claude assisted with implementation, validation, and this pull request description.
Review
The requested community PRs were reviewed directly:
homesh-devprovided most of the overall structure: hooks, history/resume and Source Control patterns.jeffhuenandJohn Cusackprovided the starting point for the agent entry, permissions, mobile, icon and docs.adriendeoliveiraprovided the readiness checks, versioned process recognition and headless behavior.None of them handled Muse questions. #21494 read the terminal screen, which this PR avoids. Muse behavior was checked against
muse --help, the Muse Code documentation, the Muse Code SDK, and captured hook payloads and session logs.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.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (CI covers the full suite and build; typecheck, the changed-code gate and the focused suites pass locally)