Skip to content

fix(runtime): deliver Devin launch prompts via argv instead of stdin-after-start - #26387

Closed
ggbdpq wants to merge 1 commit into
stablyai:mainfrom
ggbdpq:fix/stdin-after-start-early-write
Closed

ggbdpq wants to merge 1 commit into
stablyai:mainfrom
ggbdpq:fix/stdin-after-start-early-write

Conversation

@ggbdpq

@ggbdpq ggbdpq commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

ELI5

Launching a Devin worker with a prompt (orca worktree create --agent devin --prompt "...") reported success, but the prompt never reached Devin — it was written ~30ms after launch, while Devin was still printing its banner, before its input loop existed. Now the prompt rides the launch command itself (devin -- "<prompt>"), which the reporter verified end-to-end: the prompt is submitted reliably (~3s) instead of being dropped.

What Changed

  • Devin's entry in the TUI agent config moves from promptInjectionMode: 'stdin-after-start' to promptInjectionMode: 'argv' with argvPromptSeparator: '--' (the pattern the Devin CLI documents and the reporter verified).
  • Startup-plan tests updated to assert the new shape (followupPrompt: null, prompt on the launch command), plus a new integration case that reproduces the race: the foreground process is devin from t≈0, and the test asserts the prompt lands on the spawn command while no write ever happens across the full 30×150ms follow-up polling window.
  • No-prompt launches are byte-identical (both modes take the same early exit), and reviewer-facing draft semantics stay on the draft path (startupDraft → bracketed paste, no auto-submit) where feat: add Devin CLI as supported TUI agent #5282/feat(devin): managed hooks, sleeping resume, AI Vault #5380 placed them.

Why

The stdin-after-start readiness poll matches on the foreground process name, and the devin wrapper execs into devin acp almost instantly — the name matches at t≈0.03s while the REPL input loop doesn't exist yet. The reporter's measured acceptance windows on a real PTY make this concrete: plain writes are only accepted in a ~1s-wide early window, and everything from t=2s onward is discarded — which means a stability heuristic (my first candidate) cannot work: waiting for the process name to stabilize slides the write into the discard zone. The reporter's own end-to-end verified alternative (argv delivery, 3/3 runs) eliminates the race entirely instead of trying to time it, so this PR adopts it. Rejected alternatives, with reasons: a paste-protocol variant had a single harness data point and would need synchronized changes to three writers; an agent-specific readiness rule would require a Devin transcript this PR deliberately avoids.

Linked Issue

Fixes #26302

Visual Proof

N/A for attached media in this environment (headless run). Behavior is pinned by tests: the integration case reproduces the t≈0 name match and asserts the prompt is on the spawn command with zero PTY writes across the whole polling window (red before: the spawn command lacked -- 'fix it' and the write happened); the startup-plan suites flip to the argv shape.

Testing

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

Commands actually run locally (macOS): startup-plan suites red→green (2 failed before); the new integration case via -t "Devin" red→green; 16 affected suites (478 tests) — startup, prompt transport/carry, quick commands, dsh, zcode contract, renderer new-tab/background-session, executor, readiness; readiness suites (131 tests); the full orca-runtime.test.ts compatibility entry 1337 passed | 1 skipped; pnpm tc exit 0; oxlint/oxfmt --check clean on all four touched files. Real Devin CLI was not available locally — the reporter's measured acceptance windows and their 3/3 end-to-end verification of the argv form are the empirical basis this PR adopts; the automated pin is that the write path is no longer exercised for Devin at all.

AI Disclosure

Investigation, coding and verification by GLM-5.3-Flash (ZCode agent); orchestrated, reviewed and committed by a main agent with the same model, human overseeing. The reporter's measurements and end-to-end verification of the argv form are the empirical foundation of the approach.

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

One-line config change at its core; no wire/protocol change; other stdin-after-start agents are untouched (the readiness heuristic stays for them). Known scope edges: orchestration dispatch --inject to a running Devin worker uses a different delivery path (transcript-gated paste) whose long-prompt reliability is out of scope here, and whether the Devin REPL stays alive after a round is per-CLI behavior the reporter's verification implies but did not state explicitly.

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)

…after-start

The stdin-after-start follow-up polls for the foreground process name,
and the devin wrapper execs into `devin acp` almost instantly — so the
prompt was written ~30ms after launch, while Devin was still printing
its banner and its REPL input loop did not exist yet. The write was
dropped (or stranded as an unsubmitted draft) while the launch reported
success.

Switch Devin to argv delivery with the documented `--` separator: the
prompt rides the launch command itself, which the reporter verified
end-to-end (3/3 runs, ~3s to submission) against the measured
acceptance windows — a stability heuristic cannot hit the ~1s early
window without sliding into the discard zone. No-prompt launches are
unaffected (both modes take the same early exit), and the reviewer-facing
draft semantics stay on the draft path where they belong.

Fixes stablyai#26302

Generated-by: GLM-5.3-Flash (ZCode)
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a1a199e-5961-41d2-871e-68732cf77d3c
📥 Commits

Reviewing files that changed from the base of the PR and between 3062b9d and 5f73fca.

📒 Files selected for processing (4)
  • src/main/runtime/orca-runtime-tests/worktree-setup-and-startup-part-04.spec.ts
  • src/renderer/src/lib/tui-agent-startup.test.ts
  • src/shared/tui-agent-config.ts
  • src/shared/tui-agent-startup.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Devin startup configuration now places the prompt in the launch arguments after -- and does not schedule a follow-up prompt. Startup tests expect this command shape. A CLI-created worktree test checks that the PTY receives no prompt writes after the readiness-poll period and restores fake timers.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 5f73f

Devin launch prompts are now passed on the command line after --, matching how other agents receive prompts. This should stop prompts from being dropped at startup. No blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: Devin launch prompts now use argv instead of stdin-after-start.
Description check ✅ Passed The description follows the repository template and explains the user impact, implementation, rationale, linked issue, testing, scope limits, and checklist status. It also documents the unavailable lo…
Linked Issues check ✅ Passed #26302 requires reliable launch-time delivery for worktree create --agent devin --prompt. src/shared/tui-agent-config.ts now sets Devin to promptInjectionMode: 'argv' with `argvPromptSeparator: …
Out of Scope Changes check ✅ Passed The reviewed changes are limited to Devin startup configuration and related startup-plan and runtime regression tests. The tests directly verify the #26302 launch-prompt behavior. No unrelated product…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

nwparker added a commit that referenced this pull request Oct 25, 2026
…after-start (#33349)

Devin launch prompts are delivered as argv (`devin [flags] -- '<prompt>'`, Devin's documented interactive-prompt form) instead of typed after start, where they were lost before Devin was ready. Fixes #26302. Supersedes #26387.

Co-authored-by: ggbdpq <67929842+ggbdpq@users.noreply.github.com>
@nwparker

Copy link
Copy Markdown
Contributor

Thanks @ggbdpq! Your commit landed via #33349 (rebased, kept as-is, plus Co-authored-by on the squash); verified with the real devin CLI that devin -- '<prompt>' submits and stays interactive. Closing as superseded.

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

Labels

None yet

Projects

None yet

2 participants