Skip to content

agent_prompt_stalled: dispatch fails ~8s after launch for slow-booting agents (Hermes, agy) — worker completes task but worker_done rejected #16660

Description

@fredogemilang

Summary

orca orchestration worker-start marks a dispatch failed with agent_prompt_stalled ~8 seconds after launch, before slow-booting agents (Hermes Agent CLI, Google Antigravity CLI agy) reach their first prompt. The worker agent then does complete the assigned task in its worktree and attempts orca orchestration send --type worker_done — but the send is rejected (exit 1) because the dispatch capability was already revoked. The task stays failed in the UI despite the work being done.

Environment

  • Orca v1.4.188, headless orca serve --pairing-address <tailscale-ip> on Ubuntu 24.04 (systemd, user dev)
  • Agents tried as workers, both hit the same issue:
    • Hermes Agent v0.20.5 (hermes --tui default launch, and hermes --cli via agentCmdOverrides) — boots in ~15–60s (Python venv, model init)
    • Antigravity CLI agy v1.1.21 (first-run onboarding prints help) — boots >8s

Steps to reproduce

  1. orca serve running (headless, Tailscale)
  2. From a live agent terminal (coordinator):
    orca orchestration run-create --objective "test" --from <coordinator-terminal>
    orca orchestration task-create --spec "append a line to README.md" --run <run_id> --from <coordinator-terminal>
    orca orchestration worker-start --task <task_id> --worktree new-child --name test-worker --agent hermes --repo name:<repo> --timeout-ms 120000 --from <coordinator-terminal>
    
  3. Dispatch returns "state": "failed" / "lastError": "agent_prompt_stalled" within ~8s (dispatched_at → completed_at delta ≈ 8s), capability_revoked_at set, last_heartbeat_at: null.
  4. Meanwhile the worker terminal shows the agent booting and eventually executing the task:
    • Hermes: edits README.md, runs orca orchestration send --type worker_done --outcome succeeded --files-modified "README.md" → [exit 1] (rejected, capability revoked)
    • The work is present in the worktree (uncommitted diff), proving the task was executed
  5. orca orchestration worker-show --dispatch <id> → "status": "failed", "last_failure": "agent_prompt_stalled"

Expected behavior

The dispatch should wait for the agent's first prompt longer than 8s (or the stall window should be configurable), so slow-booting agents like Hermes/agy can complete the dispatch_input stage. --timeout-ms 120000 on worker-start did not change the stall window.

Notes

  • Direct connectivity is fine: getUpdates-style API calls and agent one-shot invocations complete in <2s; the delay is purely agent startup (venv/init/onboarding).
  • Workaround attempt that did NOT help: settings.agentCmdOverrides = {"hermes": "hermes --cli"} (line-based CLI instead of TUI); dispatching to an already-running agent terminal via worker-start --terminal fails with agent_unconfigured unless the terminal was launched by Orca; dispatch --inject to a manually-started agent terminal was not accepted either.

Happy to provide logs/terminal captures or test a patch.

Activity

  1. fredogemilang commented on Aug 26, 2026

    @fredogemilang
    Author

    Follow-up after local patch test

    We patched the installed bundle (v1.4.188): AGENT_PROMPT_EFFECT_TIMEOUT_MS from 5e3 → 120e3 and repacked app.asar. Results:

    • The stall window now correctly waits 120s (dispatch dispatched_at 18:35:57 → completed_at 18:38:06 ≈ 129s). The timeout itself is not the (only) problem.
    • After 120s the dispatch STILL fails with agent_prompt_stalled — because verifyAgentPromptSubmission never observes workingSequence advancing past baseline.
    • The worker is demonstrably working the whole time: Hermes TUI shows progress (deepseek-v4-pro, 2% context, synthesizing) and the task IS completed in the worktree (README modified per the task spec). It even attempts worker_done (rejected, exit 1, capability revoked after the stall).

    Suspected root cause

    Hermes has the Orca-managed status-hook plugin installed (~/.hermes/plugins/orca-status, reports on_session_start/pre_llm_call/post_llm_call/... via ORCA_AGENT_HOOK_ENDPOINT), and the runtime's readActivity() for hermes maps pre_llm_call/on_session_start to working-sequence advancement. In the dispatched-worker launch (hermes --tui --yolo + injected preamble), the LLM clearly runs (UI shows synthesizing), yet no activity advance is observed — suggesting the hook events either don't fire in that launch context or their reporting to the hook endpoint is failing (e.g., env not propagated to the dispatched PTY, or the plugin is skipped in this mode).

    Request

    Would it be possible to make the prompt-verification either (a) fall back to terminal output activity (any new bytes since baseline) when agent status hooks are unavailable/silent, or (b) expose AGENT_PROMPT_EFFECT_TIMEOUT_MS via env/setting? Both would make slow-booting or hook-silent agents (Hermes, agy) usable as dispatched workers. Happy to test a patch or provide the hook logs.

  2. fredogemilang commented on Aug 26, 2026

    @fredogemilang
    Author

    Root cause fully mapped — final update

    After extensive local testing (all with the 120s AGENT_PROMPT_EFFECT_TIMEOUT_MS bundle patch), the complete causal chain for Hermes as a dispatched worker:

    What works

    • Preamble injection works with the ORIGINAL launch (hermes --tui --yolo): the worker receives the full 91-line preamble, performs the task in the worktree, and attempts worker_done. README modified correctly in every run.
    • The worker's own forensics confirmed: the dcap_ capability token is minted at dispatch and embedded ONLY in the preamble text (dispatch_contexts stores its sha256). With the original launch the token reaches the agent via the startup query path.

    The single remaining blocker: Hermes TUI emits no OSC terminal titles

    1. Orca's agent-status tracking for hermes comes exclusively from OSC 0/2 terminal titles via applyTrackedPtyTitle → detectAgentStatusFromTitle (agent-title-status.ts), which requires the title to contain hermes + working|thinking|running (or a spinner glyph).
    2. The Hermes TUI (ui-tui, Ink-based) emits no OSC 0/2 titles at all (verified by raw PTY capture: only OSC 1 bell + OSC 52 clipboard). No config option exists to enable them.
    3. Therefore workingSequence never advances past baseline → agent_prompt_stalled always fires at the (now 120s) window → capability revoked → the worker's worker_done is rejected with dispatch_capability_invalid (--dispatch-capability token never reaches it via the normal path since the TUI composer collapses the injected preamble to a placeholder — see below).

    Additional finding: wrapper/override breaks hermes-query injection

    planHermesStartupQuery (hermes-startup-query.ts) requires the launch executable token to be hermes (isHermesExecutableToken). Setting settings.agentCmdOverrides = {hermes: '<anything-not-hermes>'} silently disables the -q/--query startup injection and falls back to pasting the 91-line preamble into the Ink composer, which collapses to [[ You are working.. [91 lines] .. or: <title> ]] — the worker then receives only the placeholder (no task, no capability token). This is a footgun worth documenting or guarding.

    Suggested upstream fixes (any one unblocks Hermes workers)

    1. Hermes side: emit OSC 0/2 titles from the TUI status bar (hermes working / hermes idle transitions) — feature request for NousResearch/hermes-agent.
    2. Orca side: fall back to PTY output activity (bytes produced since baseline) for workingSequence when agent status hooks/titles are silent — most robust for all slow/headless agents.
    3. Orca side: when planHermesStartupQuery fails (non-hermes executable), fail loudly instead of silently degrading to composer paste.

    Happy to test any of these if a patch is proposed.

  3. JSanchezFDZ commented on Aug 27, 2026

    @JSanchezFDZ

    Same failure on the same version, but with a bundled agent — opencode — so this is not
    limited to custom agentCmdOverrides CLIs. Repro rate 6/6 on Orca 1.4.188, headless
    orca-serve.service, Ubuntu 24.04, opencode 1.18.23.

    orca orchestration worker-start --from <coord> --task <id> \
      --repo path:/home/orca/repos/HOKENFI --worktree new-child --name t --agent opencode
    → ok: true, state: failed, stage: dispatch_input, last_failure: agent_prompt_stalled
    

    The agent then works normally and its first action is the heartbeat Orca handed it, which comes
    back as Dispatch <id> capability is revoked. — exactly the sequence described above.

    Measurements, in case they narrow it down. I tried to rule out the obvious candidates before
    reporting:

    • Not the composer-ready signal. opencode's render-cursor-after-bracketed-paste does arrive:
      on a raw PTY, ESC[?2004h at 1.5–1.7 s and ESC[?25h after it at 5.4–6.4 s — inside the
      8 s render budget. Measured in a warm checkout and in a freshly created worktree with MCP servers
      configured.
    • Not the status plugin's location. orca-opencode-status.js is materialized in
      ~/.config/orca/opencode-hooks/shared/plugins/ with OPENCODE_CONFIG_DIR pointing at it, and
      marker plugins confirm opencode 1.18.23 loads both <config>/plugin/ and <config>/plugins/.
    • Not a stale terminal. Reproduced with every opencode process and terminal killed, a brand-new
      worktree, and --setup skip. The effects always show action: "reused_agent_terminal" for the
      agent terminal created by the agent-first worktree flow.
    • --timeout-ms 45000 on worker-start does not change the outcome, and
      orca orchestration dispatch --inject into the idle TUI fails the same way.
    • The prompt itself is fine: the composer holds the full preamble, and submitting it by hand makes
      the worker execute the task correctly.

    Two things that look load-bearing from the source:

    1. agent-prompt-submission-verification.ts accepts three proofs. workingSequence comes from the
      synthetic-title route, which the comment in that file says does not survive headless serve
      ([Bug]: agent_prompt_stalled for codex/kimi workers — fixed 5s confirmation window vs ~20s first hook-event latency (root-cause evidence) #16095); observedDeliveryEvidence requires baseline.status === 'working', false for an idle
      agent taking its first task; so only the hook edge is left — and opencode is not in
      HOOK_OBSERVED_TURN_START_AGENTS, so it gets 5 s instead of the 15 s that codex/kimi got from
      [Bug]: agent_prompt_stalled for codex/kimi workers — fixed 5s confirmation window vs ~20s first hook-event latency (root-cause evidence) #16095. A reasoning model behind a remote API easily exceeds that: in my runs the first tool call
      landed at 12.9 s. opencode and mimo-code (same profile, synthesizeTerminalTitle: false)
      look like they belong in that set.
    2. TUI_AGENT_CONFIG.opencode.promptInjectionMode is flag-prompt, and tui-agent-startup.ts
      builds <cmd> --prompt <quotedPrompt> for it — but the supervised path starts the agent through
      createManagedWorktree({ startupAgent }) without a prompt (process argv on the host is a
      bare opencode) and then pastes into the live TUI. Honouring the declared flag-prompt launch
      when the terminal is created for the dispatch would skip the paste-and-verify step for these
      agents entirely.

    Happy to send a PR for (1) if maintainers agree with the direction; I held off because I cannot
    rebuild and test the Electron app on this headless host and would rather not ship an untested
    change to this path.

    Workaround, for anyone else blocked: launch the agent with the task text and stop expecting
    worker_done:

    orca terminal create --worktree path:/path/to/worktree \
      --command "opencode --model <provider>/<model> --auto --prompt '<task text>'"

    then follow the worker with orca terminal read / git instead of the dispatch state.

  4. nakedsleepwalker commented on Aug 28, 2026

    @nakedsleepwalker

    Same shape with a bundled agent (Grok) on 1.4.190 / Windows: stall at 14s, capability revoked, task completed in the worktree, worker_done rejected. Details: #16902

  5. added theissue type on Sep 19, 2026
  6. nwparker commented on Sep 19, 2026

    @nwparker
    Contributor

    Fresh live verification on the current migration stack (head 4ef37c14709, draft #21655), macOS, installed agy 1.2.7, isolated non-git folder:

    • The host's terminal.isRunningAgent recognized a newly launched agy pane.
    • Actual dispatch --inject returned injected: true with input_accepted; the task marker reached the CLI.
    • Actual worker-start --agent antigravity returned ready, stage input_accepted. Its Dispatch was still dispatched with zero failures 63 seconds later. It did not fail with agent_prompt_stalled after eight seconds.
    • A subsequent send --to @antigravity enqueued two messages, one in each test Dispatch mailbox. The first group send shortly after direct injection had returned no recipients; the later send included both the direct and supervised dispatches. That transient first lookup is not yet explained.

    ELI5: current Orca can deliver the task and keep its assignment alive without pretending it observed the agent start working. This machine's agy receives the task but generation returns HTTP401 ACCESS_TOKEN_TYPE_UNSUPPORTED. The receipt correctly says turn observation is unsupported; it is not proof of successful execution, mailbox consumption, or accepted worker_done.

    This was normal local startup, not a reproduced 15–60 second boot or a Windows/SSH test. Both test Dispatches were explicitly stopped and their test terminals closed afterward. Authentication and hooks were unchanged. No new production change was needed for the injection/receipt checks; #21655 changes group addressing separately.

    Visual proof below is a rendered report derived from the actual CLI receipts, rather than a screenshot of the lifecycle preamble (which contains private capability material).

    Live orchestration receipts

  7. nwparker commented on Sep 19, 2026

    @nwparker
    Contributor

    Follow-up verification on the migration draft stack (b109d5083be): a deliberately delayed local agy launch did not reproduce the eight-second dispatch failure.

    In plain language: I made the launcher wait 20 seconds before starting the installed Antigravity 1.2.7, then asked Orca to start a supervised worker with a 90-second timeout. Orca waited and delivered the task instead of failing at eight seconds.

    Evidence:

    • Used a temporary launcher override in an isolated macOS validation profile: sleep 20, then exec agy "$@". Restored the original override afterward.
    • Dispatch creation was recorded at 12:57:50 UTC; the successful CLI receipt was written at 12:58:14.914 UTC (about 25 seconds later).
    • Receipt: ready, input_accepted. At 12:58:38 UTC, the dispatch remained dispatched, with zero failures and no last failure.
    • Actual agy terminal output contains the requested task marker, then HTTP 401 ACCESS_TOKEN_TYPE_UNSUPPORTED. No successful generation or real worker_done report is claimed.

    Current source also already preserves reporting capability when dispatch input fails specifically with agent_prompt_stalled (worker-start-receipt.ts). The existing database recovery tests verify that a subsequent worker report can correct that failed record, while other startup failures still revoke capability. Eight focused recovery/classification tests passed.

    This is stronger than the earlier normal-startup check, but it does not cover Hermes, Ubuntu/headless/remote execution, first-run onboarding, or successful task completion. No production patch is justified by this local non-reproduction; keeping the issue open for those remaining conditions.

  8. JSanchezFDZ commented on Sep 21, 2026

    @JSanchezFDZ

    Retest of my 6/6 opencode repro on 1.4.206 — the Ubuntu/headless/remote gap is now covered, and it passes.

    Same setup as my August report: headless orca-serve.service on Ubuntu 24.04, dispatched from a separate machine with --environment, bundled opencode (now 1.18.31), child worktrees off a real repo, trivial task ("create a file, don't commit, then report worker_done").

    Dispatch input: 3/3 accepted (was 0/6 on 1.4.188).

    orca orchestration worker-start --environment <remote> --from <coord> --task <id> \
      --repo path:/home/orca/repos/<repo> --worktree new-child --name <n> --agent opencode
    → ok: true, state: ready, stage: input_accepted, turnStart: "unsupported", timeoutMs: 60000
    

    No agent_prompt_stalled in any of the three, and turnStart: "unsupported" is exactly the honest receipt described above: Orca says it cannot observe the turn instead of failing the dispatch over it.

    worker_done accepted end to end: 2/3 — the condition the previous comment explicitly did not cover.

    task A  dispatched_at 20:39:14Z  completed_at 20:41:36Z  failure_count 0
            result: {"provenance":"worker_report","outcome":"succeeded", ...}
    task B  dispatched_at 20:39:51Z  completed_at 20:44:08Z  failure_count 0
    

    Both worktrees contained the requested file, uncommitted, as asked.

    The third run is not an Orca failure. Its agent's first model turn hung at the provider (no output, no tool call) and it never acted. The Dispatch stayed healthy throughout:

    status: "dispatched", failure_count: 0, last_failure: null,
    capability_revoked_at: null, dispatched_at 20:35:53Z   — still true 13 minutes later
    

    On 1.4.188 that same run would have been killed at ~5s with agent_prompt_stalled and its capability revoked before the agent produced anything. I stopped it with worker-stop --dispatch <id> and removed all three worktrees.

    So from my side: Ubuntu 24.04 + headless orca-serve + remote dispatch + bundled opencode + successful completion is covered and working on 1.4.206. I can't speak to Hermes, Windows, or first-run onboarding.

  9. OrcaWin commented on Oct 9, 2026

    @OrcaWin
    Collaborator

    Fixed by #16904, which made orchestration dispatch durable. The headless Ubuntu retest on 1.4.206 passed 3/3 with no agent_prompt_stalled, and a deliberately delayed 20s launch no longer fails at 8s. Thanks for the thorough repro! If you still see this on a current build, please reopen with details and we'll take another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions