Skip to content

fix(automations): a headless run never reads completed when its agent never ran - #25700

Merged
OrcaWin merged 2 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-orcad-automation-completion
Oct 5, 2026
Merged

OrcaWin merged 2 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-orcad-automation-completion

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​129 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​129
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​120

ELI5

On a remote Orca server, an automation whose agent wasn't installed (for example goose or claude missing on that host) was marked "completed" within about 10 seconds. The terminal only showed the command typed and "command not found". Now that run fails with the shell's own message. Agents that work keep completing as before.

What Changed

Before: orcad and Electron orca serve dispatch automations headlessly. A headless run counted as completed as soon as its terminal looked idle. A plain shell prompt also counts as idle, so "goose: command not found" followed by a prompt was recorded as completed.

After, once the terminal looks idle:

  • The agent reported status: if the agent's own status (hooks, OSC status or title) for the run's pane arrived after the dispatch, the run is completed. That's the desktop runner's signal. Status the pane held from an earlier run doesn't count.
  • The shell refused the agent's command: if one of the last lines is a shell's "command not found" message, the run fails with that line. This covers bash, zsh, dash, fish, PowerShell and cmd. The line must name one of the agent's own commands (its detect and launch commands), so an agent's tool output such as bash: pytest: command not found never fails the run.
  • Neither: the old rule applies, so idle means done, but only after the 2-minute agent-start window. While waiting, the run keeps checking every second and switches to the agent's status if it shows up.

How:

  • The completion check now lives in headless-run-completion.ts.
  • The runtime gets a public getAgentStatusRowsForPane(paneKey), which reads the status rows the host already keeps. Both orcad and Electron wire it.

Why

  • Why not require agent status. About 50 agents can be picked, and many report no status on orcad: no hooks on that host, or no title Orca recognises. Requiring status would fail their working runs.
  • Why the refusal is checked positively. Failing only when the shell itself names the agent's command as missing turns exactly the reported bug into an honest failure, without changing anything for agents that work.
  • Why wait 2 minutes before believing an idle pane. It closes the window where the shell prompt shows before the agent has even started. That's the same agent-start window the run-completion watcher uses.

Linked Issue

Fixes # (Phase 3 real-host BUG-19)

Visual Proof

N/A. No UI change. The run history status and its error text change, which the tests cover.

Testing

New tests in runtime-automation-service.test.ts drive the real headless dispatcher against a fake runtime, where a shell prompt always looks idle:

  • Missing command: the run fails with the shell's own message, for bash, zsh, dash, fish and PowerShell, and is never completed.
  • Agent reported status: the run completes as soon as the agent's status arrives.
  • Agent never reports status: the run still completes, but only after the start window.
  • Agent's own tool output: a tool's command not found line never fails the run.
  • Late agent: an agent that reports after the shell first looked idle still completes the run.

Against the old dispatcher, 7 of the 9 cases fail, and the missing-command cases read completed. The automations suites pass locally (32 files, 237 tests), and typecheck and the changed-code quality gate are clean.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

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

This applies to orcad on any host (Linux, macOS, Windows, or over SSH) and to Electron orca serve, which shares the headless path. The desktop runner is unchanged. No wire changes.

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)

… never ran

orcad (and Electron serve) finished a dispatched run on a satisfied
tui-idle wait, and a ready shell prompt satisfies it: a run whose agent is
not installed read 'completed' within seconds. Like the desktop runner,
completion now needs the agent's own status for the run's pane after
dispatch; without it the run fails after the agent-start window with the
reason, instead of claiming completion.
@pullfrog

pullfrog Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

…l only a refused command

Not every automation agent reports status on orcad (no hooks on the host, no
recognised title), so requiring it would fail their runs. A run completes on
the agent's own status, fails when the shell refused the agent's command
(bash, zsh, dash, fish, PowerShell, cmd), and otherwise keeps the old
idle-means-done rule after the agent-start window.
@OrcaWin
OrcaWin merged commit ead321a into OrcaWin/node-rt-phase3 Oct 5, 2026
30 checks passed
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