Skip to content

feat(orchestration): surface agent permission wait on worker-show - #13215

Closed
bbingz wants to merge 3 commits into
stablyai:mainfrom
bbingz:fix/13209-worker-show-input-wait
Closed

bbingz wants to merge 3 commits into
stablyai:mainfrom
bbingz:fix/13209-worker-show-input-wait

Conversation

@bbingz

@bbingz bbingz commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

worker-show can now surface a worker's hook-reported agent status, including a pending permission prompt, without tailing its terminal. The signal is intentionally scoped: permission is authoritative when present, but absence does not prove a non-hook agent is unblocked.

What Changed

  • Add optional agentStatus to local orchestration.workerShow results only when the Dispatch still owns the exact live process.
  • Probe on the worker host for federated workers and forward the optional field; older hosts that omit it map to null.
  • Show agent status in CLI text output and document the hook-only visibility boundary.
  • Cover local success, identity mismatch, probe rejection, federated forwarding, and old-host omission.

Why

Parallel workers stalled on harness permission prompts looked ready at the orchestration layer. Reusing the existing hook-derived terminal status exposes an exact positive signal without adding PTY-output inference.

Linked Issue

Fixes #13209

Visual Proof

N/A — this changes RPC/CLI JSON and text output plus documentation, not renderer UI.

Testing

  • I manually tested these changes locally

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

  • pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts — 12/12 passed.

  • pnpm run typecheck — passed.

  • Changed-file oxlint and oxfmt --check — passed.

  • pnpm run verify:bundled-skill-guides and git diff --check — passed.

  • Full pnpm test: 5,827 files / 54,516 tests passed; 10 tests in two unchanged renderer IME files failed. The branch has no diff from origin/main under src/renderer, package.json, pnpm-lock.yaml, or config/vitest.config.ts; both files reproduce when run alone.

Test-change rationale: rebasing picked up upstream commit 7afce2ea41, which replaced the worker observation's canonical running value with live. Four status values in this PR's newly added recovery tests were updated to that current contract. No existing assertion was deleted or weakened, and the old-host running compatibility case remains covered.

AI Disclosure

OpenAI Codex was used for rebase/conflict resolution, the documentation follow-up, and verification.

External second-model review unavailable: Grok 4.6 and 4.5 produced no output or VERDICT: within the single five-minute budget; verified via focused tests, typecheck, changed-file lint/format, and local diff review.

Review

  • Mixed-version remote compatibility: agentStatus is an optional field on an existing RPC result; newer clients fall back to null when older hosts omit it.
  • Exact-process guard remains required before local or host-side probing.
  • The guide now states that missing/non-permission status does not rule out prompts for agents without hook coverage.

Agent skill upstream boundary

  • Not applicable; this changes Orca's own orchestration guide and copies or mechanically translates no upstream skill-installer material.

Notes

  • Security/authorization: no authorization decision uses this field.
  • Cross-platform/SSH/folder workspace: the signal uses the existing runtime terminal handle and federated host probe; no path, shell, shortcut, or git-worktree assumption was added.
  • Performance: at most one existing status lookup is added to an exact-process worker-show call.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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 (typecheck and scoped checks pass; full-test baseline failures are documented above, and full lint/build are left to CI)

Author

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: deaee636-c387-4fd1-b997-13aececa9f1f

📥 Commits

Reviewing files that changed from the base of the PR and between 7fad71e and d8aecdb1e9c2f5fcca1078d2902683e9dad44b10.

📒 Files selected for processing (8)
  • skill-guides/orchestration.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/orchestration.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/runtime/rpc/methods/orchestration-federation-control.ts
  • src/main/runtime/rpc/methods/orchestration-worker-control.ts
  • src/main/runtime/rpc/methods/orchestration-worker-observation.ts
  • src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/runtime/rpc/methods/orchestration-worker-observation.ts
  • skill-guides/orchestration.md
  • src/cli/handlers/orchestration.ts
  • src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-control.ts
  • src/main/runtime/rpc/methods/orchestration-federation-control.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

orchestration.workerShow retrieves optional agent status for the exact terminal associated with the live worker process. Federated responses forward agent status and normalize omitted values to null. The CLI output includes agent status and process-running information when available. Documentation defines the status values, including permission prompts. Recovery guidance explains that a ready Dispatch can still have an agent terminal blocked on a permission or tool-approval prompt. Tests cover local and federated status reporting.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: exposing agent permission-wait status through worker-show.
Description check ✅ Passed The description covers the required sections, explains scope and limitations, and documents testing and known baseline failures.
Linked Issues check ✅ Passed The PR adds orchestration-level agentStatus reporting for permission waits, including local, federated, compatibility, and process-identity handling required by issue #13209.
Out of Scope Changes check ✅ Passed The changes remain focused on exposing hook-derived agent status through worker-show, related CLI output, documentation, federation, and tests.

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

🧹 Nitpick comments (1)
src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts (1)

76-95: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Cover lookup failure and exactness guards.

The production code maps a rejected status probe to null and skips the probe when the observation is not exact. This test covers only successful permission reporting. Add cases for both paths. Assert that a rejected probe still returns agentStatus: null, and assert that a non-exact observation does not call runtime.getTerminalAgentStatus.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 86fafa81-68ea-4b78-93a0-e0b63b49a28a

📥 Commits

Reviewing files that changed from the base of the PR and between 6da7b8e and 3ada33f1acf80e0a2c8cc022cf073ce7c655c9fb.

📒 Files selected for processing (6)
  • skill-guides/orchestration.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/orchestration.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/runtime/rpc/methods/orchestration-worker-control.ts
  • src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts

@bbingz

bbingz commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Campaign review (batch 31–40)

Confirmed finding: federated worker-show still omits agentStatus because federationShow never probes host-local agent status and the home-side early-return only forwards terminal/observation.

Local path + optional field remain good. Follow-up before merge:

  1. Compute agentStatus on the worker host inside federationShow (same exact-process gate as local).
  2. Forward optional agentStatus through federated workerShow.
  3. Tests: federated forward, identity_changed/unattached skip probe, rejection → null.

@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.

🧹 Nitpick comments (1)
src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts (1)

123-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add direct federationShow probe coverage.

This test mocks callOrchestrationWorkerServer, so it verifies home-side forwarding only. It does not execute orchestration.federationShow or verify its exact-process guard, unattached behavior, terminal handle, and rejected-probe fallback. Add handler-level tests, or confirm that this coverage exists elsewhere. This coverage is required by the PR objective.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e0e5287d-aaaa-4c70-a85a-eda4764f7782

📥 Commits

Reviewing files that changed from the base of the PR and between 3ada33f1acf80e0a2c8cc022cf073ce7c655c9fb and c3699c150b7804d3d924b29de7ac74468c675f41.

📒 Files selected for processing (4)
  • src/main/runtime/rpc/methods/orchestration-federation-control.ts
  • src/main/runtime/rpc/methods/orchestration-worker-control.ts
  • src/main/runtime/rpc/methods/orchestration-worker-observation.ts
  • src/main/runtime/rpc/methods/orchestration-workers-recovery.test.ts

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@bbingz
bbingz force-pushed the fix/13209-worker-show-input-wait branch from fe7d9de to 381224d Compare August 13, 2026 21:01
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@Tauri-EPO

Copy link
Copy Markdown
Contributor

Coverage note from the field, not a review objection — this PR is solving a real problem and I would like it to land.

worker-control reaches the wait state through runtime.getTerminalAgentStatus(worker.agent_terminal_handle). That status is hook-derived: src/shared/agent-status-types.ts is explicit at the top of the file that status comes from agent hooks and is never inferred. So agentStatus.status === 'permission' will fire for hook-capable agents — Claude, Codex — and stay silent for agents whose harness prompts never reach a hook.

That silence is not hypothetical. Two prompts I hit on cursor-agent in one night, both of which stalled a lane with no orchestration-level signal:

Approval 1 of 2
 $  cd "…/packages/domain" && npx vitest run src/parties.spec.ts
    Run this command?
 ⚠  Auto-review: An error occured while classifying this action. Please review manually.
  → Run (once) (y)
⚠ Workspace Trust Required
Cursor Agent can execute code and access files in this directory.
Do you trust the contents of this directory?
▶ [a] Trust this workspace
  [q] Quit

The second one is worth a second look: that worktree had just been created by orca worktree create --agent cursor, so Orca created it and the agent still blocked on trusting it.

Neither produces a hook event, so on this PR's path both lanes would keep reporting ready while doing nothing. In my case the most critical lane of the batch sat about an hour that way, and I only found it because I opened the screen for an unrelated reason.

I am not suggesting this PR should cover them. Reading the hook status is the right first cut — it is exact where it applies, and inferring a permission prompt from raw PTY output is a much harder problem that would sink this change. The ask is smaller: if the field's contract says what it is derived from, a coordinator knows that agentStatus absent or non-permission does not mean "not blocked" for a non-hook agent. Right now the guide text added here reads as universal.

More detail and measurements in #14854, including a controlled comparison showing that cursor advancement proves life while stagnation proves nothing. Related: #13209 (this PR's issue) and #14896, which I opened before finding #13209 and am closing as the duplicate.

Happy to test this against a cursor-agent fleet on Windows once it lands, since that is the configuration it cannot currently see.

@bbingz

bbingz commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — confirmed. agentStatus is hook-derived, so an absent or non-permission value is not a universal negative for agents whose harness prompts do not emit hooks (including the Cursor cases you measured).

I’ll clarify that contract in the orchestration guide while refreshing this PR against current main. I’ll keep raw PTY inference out of scope for this change.

@bbingz
bbingz force-pushed the fix/13209-worker-show-input-wait branch from 381224d to d8aecdb Compare August 17, 2026 08:40
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

bbingz added 3 commits August 18, 2026 06:51
Attach terminal agentStatus (working|permission|idle) for the exact live
worker process so coordinators can detect harness permission stalls
without tailing each pane.

Closes stablyai#13209
Probe getTerminalAgentStatus on federationShow for the exact remote
process and forward the optional field through home workerShow so
multi-server fleets surface permission waits (stablyai#13209/stablyai#13215).
Document the hook-only visibility boundary and align this PR's recovery tests with the upstream live liveness verdict introduced while rebasing.
@bbingz

bbingz commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased and conflict-resolved at 86d234b87f6b4c3b110ea6c45cbad89ff2ced93a: focused 39/39, typecheck, oxlint/type-aware lint, format, bundled-guide verification, max-lines, and diff-check passed; full Vitest reached 54,953 passing with only the known 10 renderer IME baseline failures, and bounded Grok review hit its 8-turn limit without returning a verdict.

@bbingz

bbingz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by maintainer-led #15261, merged as 79be5b7fde1a78bf5aca52999167b55d2d72ffdf on 2026-08-18.

#15261 explicitly closes #13209 and ships the broader observation.agentWait contract on local and federated worker-show: hook, prompt-text, and title evidence; null versus absent/unevaluated semantics; and CLI output. This covers the original hook-only agentStatus change here and also the non-hook Cursor gap raised during review.

Verified against current origin/main@73f7767edd: the three focused suites pass (3 files, 35 tests).

Fallback: if the merged replacement is reverted or a #13209 coverage regression is confirmed within 14 days, reopen this PR or recut only the missing delta against current main.

@bbingz bbingz closed this Aug 19, 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.

Surface worker input-wait state: parallel workers stalled on a permission prompt with no orchestration-level signal

4 participants