speakeasy-api / speakeasy-api/kit
Recover initial, terminal, and commit-uncertain subagent failures safely
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40
- Forks
- 4
- Avg merge
- 4h 18m
- Merged PRs (30d)
- 148
Description
Summary
Initial subagent() failures and terminal or commit-uncertain follow-up prompt() failures still need explicit, safe recovery. Recovery must distinguish a known reusable live child from an unusable session or unknown remote/durable completion state.
Already implemented
The original report said every unsuccessful dispatched follow-up removed its logical subagent. That is no longer universally true. #56 (ceb727e; shipped in v0.1.114) added regression coverage in src/tools/subagent/tests.rs: reusable_prompt_failure_remains_failed_idle_and_can_be_retried. A nonterminal refusal from a still-live child leaves the roster Idle with a Failed outcome; the prior successful handle can be explicitly prompted again, and the next success advances generation correctly. This does not establish that arbitrary transport failures or repeated effectful prompts are safe to retry.
Remaining acceptance criteria
- Cover both initial
subagent()failures (which may return no successful handle) and follow-upprompt()failures. - Use the provider-independent possible-effects metadata from #48 to distinguish confirmed pre-output/pre-tool failures from assistant output, emitted tool calls, started/completed tool execution, and unknown/unconfirmed state. Absence of evidence is not proof of no effects.
- Define an explicit recovery path for terminal/lost-child failures when safe recovery is established; reconcile durable/remote completion and handle generations, or restart from a known completed snapshot. Never blindly replay a possibly effectful turn. Unknown effects or commit status must yield an actionable conservative failure rather than silently recovering.
- Preserve existing live-child nonterminal follow-up reuse; distinguish it from terminal failure, cancellation, and transport loss. Reject stale handles and prevent concurrent generation corruption.
- Test initial failure, terminal follow-up failure, uncertain transport/completion, safe pre-effect recovery, failures after output/tool activity, cancellation, and generation/handle invariants. Ensure diagnostics expose no private prompts, tool arguments/results, or provider payloads.
Dependency and historical context
Depends on #48 for conservative possible-effects evidence; #48 owns diagnostic facts, this issue owns recovery/reusable-session policy. The #35 follow-up explicitly expanded scope to both initial and follow-up failures: https://github.com/speakeasy-api/kit/issues/21#issuecomment-5458466104.
The original retirement rule avoided continuing from a potentially changed transcript after dispatch. Preserve that safety goal while improving recovery. Relevant implementation: src/tools/subagent.rs (Subagents::prompt, initial creation, and terminal classification). The historical resolved trigger remains documented in the subagent keepalive note.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/tools/subagent.rs, focusing on Subagents::prompt, initial creation, and terminal classification; then review the regression coverage in src/tools/subagent/tests.rs and the possible-effects dependency in #48. Define recovery separately for initial and follow-up failures, preserving live-child reuse while rejecting unsafe or unknown states. Done means the listed failure, cancellation, generation, handle, and diagnostic-privacy cases are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai-infra-agents, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100