feat(agent): add durable agent invocations and spawning - #1065
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2f3b985 to
b3aea1f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b3aea1f. Configure here.
| } | ||
| if (!context.attempt.isFinalAttempt) { | ||
| throw error; | ||
| } |
There was a problem hiding this comment.
Stranded child never terminates
High Severity
recoverRunningSession throws when a stranded running child has no model or no resumable boundary, but empty resume wakes set isFinalAttempt to false, so the catch rethrows instead of failing the invocation. The worker then re-wakes forever while status stays running, which also keeps a named agent permanently busy.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit b3aea1f. Configure here.


Adds durable agent invocations and a
spawnAgenttool so a parent agent can schedule named or one-off child work through Junior's existing conversation mailbox and lease worker. Unnamed invocations use isolated child conversations; named agents reuse their child conversation and prior agent history. Different named agents can run concurrently, repeated tool calls are idempotent, overlapping work for one name is rejected, and one child's failure does not affect its siblings.The model supplies only the task, optional name, and optional reasoning level. The runtime keeps parent identity, actor, credentials, routing, and idempotency bound to the active run, and the tool returns only a durable invocation handle. Child creation shares the root conversation mutation lock with retention purge, and bindings and invocations are deleted with the conversation tree.
Child work uses the existing provider-neutral mailbox worker. Local chat processes child wakes in-process, while production continues to use Vercel Queues. The rebased schema change is generated as migration
0012_sour_vargasafter the newer conversation-history and reporting migrations onmain.SQL-backed regression coverage exercises isolated and named agents, history and reasoning reuse, concurrent replay, overlap rejection, sibling failure isolation, validation failure, recovery, and retention cleanup. This slice returns invocation handles; parent result delivery, deterministic result recovery, cancellation, and recursive children remain follow-up work on #880.
Fixes #879
Refs #880