Repository navigation
Description
Where were you using Orca?
Desktop only
Operating system
macOS
Remote host operating system
No response
Orca version
1.4.269 → 1.4.271 (the same pattern goes back to September builds)
Details
Short summary:
A scheduled terminal run whose launch line was eaten by a shell startup prompt is stored as completed although its agent never started. If Orca quits while it is watching the run, the run is stored as dispatch_failed instead.
What happened?
One scheduled terminal automation (Claude Code, existing workspace, weekdays 09:10) has 78 runs.
Five of them never started their agent. All five are the runs where oh-my-zsh showed its update
prompt (shell-ready-timeout in daemon.log for that run's PTY, 15000 ms each time).
| Run | Stored status | What the pane shows |
|---|---|---|
| Sep 8 | completed |
[oh-my-zsh] Would you like to update? [Y/n] ^[[200~claude '--dangerously-skip-permissions' … |
| Sep 21 | completed |
same |
| Oct 19 | dispatch_failed |
(no snapshot) |
| Nov 9 | completed |
[Y/n] . '/var/folders/…/orca-launch-….sh' then zsh: permission denied: …/orca-launch-….sh |
| Nov 23 | dispatch_failed |
same as Nov 9 |
The launch-line part is #12170 (open PR #47013). This issue is about what the run history records
afterwards. There are two separate problems.
How can we reproduce it? I have not run a minimal version; these steps follow from the logs.
- Use zsh with oh-my-zsh in its default update mode, with an update due (it asks
[Y/n]at shell start). - Let a scheduled terminal automation (Claude Code) fire. After the 15 s shell-ready deadline the launch line is written into the prompt.
- Leave it: after two minutes the run is
completedwith no agent output. Or quit Orca while the run is stilldispatched: it becomesdispatch_failed.
1. A run whose agent never started is stored as completed.
judgeIdleAgentTurn (src/main/runtime/agent-state-rules/agent-turn-idle-verdict.ts) completes a pane
with no agent status rows once AGENT_START_GRACE_MS (2 min) has passed, unless the tail shows a
missing-command refusal that names the agent command. The refusal here is
zsh: permission denied: …/orca-launch-<id>.sh: the prompt's read -k 1 took the . of
. '<staged script>', so zsh ran the script as a program. It matches no pattern and does not name the
agent, so the run completes. Three scheduled runs were missed without any failure shown.
2. Quitting Orca while a terminal run is watched stores it as dispatch_failed.
On Nov 23 the run was dispatched at 09:10:34. At 09:27:17 Orca quit to install 1.4.271
(updater_quit_and_install_started in main.trace.ndjson), and the run's error was written at
09:27:17: "Orca stopped watching this run before it reported completion."
Reading the source, the order on quit is:
mainWindow.on('closed')→runtime.markGraphUnavailable()→terminalWaiters.rejectRendererBound('terminal_handle_stale')- the observer's
waitForTerminalrejects;observeTerminalRunrethrows anything that is not a proven
exit,runtime_unavailableor a wait timeout AutomationRunCompletionWatcher.observeUntilTerminalsees a signal that is not aborted yet
(core.automations.stop()runs later, inwill-quit) and finalizesdispatch_failed
So the run is failed instead of being left for reconcileRetainedRuns at the next start. This is not
specific to a broken launch: a healthy run that is still working when Orca quits or installs an update
takes the same path. I have not reproduced that case in a running build; it follows from the code path
above and from the timestamps.
The stored error is also the same fixed sentence for every cause, and the real error only goes to
console.error, which a packaged app does not keep, so the cause cannot be read from a user's machine.
Update: #47368 now covers problem 1 and the failure code only. Problem 2 is held until it is shown in a real reload-and-quit run (see the maintainer's comment on the PR); I will file it separately with that evidence.
Expected
- A run whose staged launch script the shell refused fails as "agent did not start".
- A run being watched when the window closes, reloads or the app quits keeps its status and is picked
up again. - The stored error carries the runtime failure code.
Anything else that might help:
A launch line that is consumed whole (nothing refused, nothing printed) still completes after the
grace. Telling that apart needs to know whether the run's agent reports status on this host
(AGENT_HOOK_TARGETS, agentStatusHooksEnabled, remote hosts), which I left alone.
I have a branch with the three fixes and tests and will open a PR against this issue.
Activity
fix(automations): fail a run at once when the shell refuses its stage…
fix(automations): fail a run at once when the shell refuses its stage…