Repository navigation
Conversation
Headless workers/stewards spawned without --prompt or --resume have no input source and exit immediately, producing the cryptic 'Session exited before init' error. Refuse the invocation with a clear message that names the cause and lists the three fixes (--prompt, --resume, --mode interactive). Refs stoneforge-ai#61.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #61.
sf agent start <id>for a worker defaults to headless mode, which feeds prompts via stdin. Without--promptor--resumethe spawned process has no input, exits immediately, and the user seesFailed to start agent: Session exited before init.This PR makes that path explainable.
agentStartHandlernow refuses headless invocations with no input source up front and prints the cause plus the three fixes (--prompt,--resume,--mode interactive). The note also clarifies that dispatch-driven workflows respawn workers automatically.A spawner-side enrichment of the
Session exited before initmessage was considered as a backstop, but the headless path emits a synthetic exit code (0 or 1 derived fromresumeErrorDetected) rather than the underlying child process exit, so enriching with that code produces misleading output for the exact case the issue is about. Tracked as a follow-up if a real exit-code propagation path is needed.The dispatch daemon path is untouched: it always supplies an
initialPromptand never hits this case.Test plan
bun test packages/smithy/src/cli/commands/agent.bun.test.ts(new validation test + all pre-existing tests pass)turbo typecheckcleanpnpm buildcleansf agent start <worker-id>with no flags prints the new validation error;sf agent start <worker-id> --prompt "..."proceeds to spawn.🤖 Generated with Claude Code