feat(subagent): add resume_from continuation chains to agent spawn - #5142
Merged
Hmbown merged 2 commits intoAug 3, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add task_id parameter to resume prior subagent
feat(subagent): add resume_from continuation chains to agent spawn
Aug 3, 2026
Add `resume_from` parameter to the `agent` tool's `action=start` path, implementing the continuation-chain contract from issue #425. Semantics: - `resume_from` accepts a settled child agent_id or session name. - The source agent must not be running (completed, interrupted, failed, cancelled, or budget_exhausted are all accepted). - The source must live in the same workspace as the spawning agent; cross-workspace sources are rejected with a clear error. - The full transcript is loaded from the on-disk artifact. When the artifact is unavailable (legacy record, archived child, process-restart resume) the checkpoint messages are used as a fallback. - The loaded transcript is injected into the child's `fork_context`, forcing `fork_context=true` so the new agent starts with the prior lineage and the provider can reuse prefix-cache entries. - Explicitly setting `fork_context=false` together with `resume_from` is rejected at spawn time as contradictory. Receipt traceability: - `SubAgentSpawnOptions.resume_from_agent_id` carries the source id into `ChildLaunchManifest.resume_from_agent_id` (persisted). - `WorkflowTaskSpawnMetadata.resume_from_agent_id` stamps the receipt returned to workflow/tool callers. Schema change: - New `resume_from` property added to the `agent` tool JSON schema. Tests (16 new, all green): - parse accepts resume_from / resumeFrom camelCase / absent / whitespace-only - parse accepts resume_from + fork_context=false (conflict detected at spawn) - manager rejects running source with actionable error message - manager rejects missing source - manager accepts completed / interrupted / failed / cancelled sources - manager rejects cross-workspace source - transcript artifact loaded when available - checkpoint fallback when artifact is missing - session name resolves to agent_id via resolve_agent_ref - SubAgentSpawnOptions carries resume_from_agent_id
Hmbown
force-pushed
the
copilot/add-resume-from-continuation-chains
branch
from
August 3, 2026 12:18
69f4b8f to
49e17e0
Compare
Hmbown
marked this pull request as ready for review
August 3, 2026 12:44
Contributor
There was a problem hiding this comment.
Pull request overview
Adds “continuation chain” support to the agent/subagent spawn path by introducing a resume_from parameter that rehydrates a settled agent’s transcript and injects it into the child’s initial fork context, allowing role/profile transitions without losing transcript lineage.
Changes:
- Added
resume_fromparsing + JSON schema support, plus validation (running/missing/cross-workspace, andfork_context=falseconflict). - Threaded
resume_from_agent_idthrough spawn metadata and persistedChildLaunchManifestfor receipt/lineage traceability. - Added extensive tests around parsing, validation, and transcript artifact loading/fallback.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/tui/src/tools/subagent/mod.rs | Implements resume_from parsing, schema, validation, transcript loading, and threads provenance into spawn options/metadata/manifest. |
| crates/tui/src/worker_profile.rs | Extends ChildLaunchManifest with resume_from_agent_id for durable lineage provenance. |
| crates/tui/src/fleet/worker_runtime.rs | Updates Fleet worker launch manifest construction to include the new field. |
| crates/tui/src/tools/subagent/tests.rs | Adds tests for resume_from parsing/validation and transcript artifact behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7720
to
+7721
| let messages = load_subagent_transcript_artifact(&source_workspace, &source_agent_id) | ||
| .unwrap_or(checkpoint_messages); |
Comment on lines
+7686
to
+7692
| return Err(ToolError::invalid_input(format!( | ||
| "resume_from: agent '{source_id}' (session '{}') is still running. \ | ||
| Only settled agents (completed, interrupted, failed, cancelled) \ | ||
| may be used as a resume source. Use action=wait to block until \ | ||
| it settles, or action=interrupt to stop it.", | ||
| source.session_name | ||
| ))); |
Comment on lines
+15576
to
+15580
| // The `resume_from_agent_id` on `SubAgentSpawnOptions` must be threaded | ||
| // into the persisted `ChildLaunchManifest` so receipts can trace lineage. | ||
| let options = SubAgentSpawnOptions { | ||
| resume_from_agent_id: Some("agent_source_abc".to_string()), | ||
| ..SubAgentSpawnOptions::default() |
Hmbown
pushed a commit
that referenced
this pull request
Aug 4, 2026
…5142) * Initial plan * feat(subagent): add resume_from continuation chains (#425) Add `resume_from` parameter to the `agent` tool's `action=start` path, implementing the continuation-chain contract from issue #425. Semantics: - `resume_from` accepts a settled child agent_id or session name. - The source agent must not be running (completed, interrupted, failed, cancelled, or budget_exhausted are all accepted). - The source must live in the same workspace as the spawning agent; cross-workspace sources are rejected with a clear error. - The full transcript is loaded from the on-disk artifact. When the artifact is unavailable (legacy record, archived child, process-restart resume) the checkpoint messages are used as a fallback. - The loaded transcript is injected into the child's `fork_context`, forcing `fork_context=true` so the new agent starts with the prior lineage and the provider can reuse prefix-cache entries. - Explicitly setting `fork_context=false` together with `resume_from` is rejected at spawn time as contradictory. Receipt traceability: - `SubAgentSpawnOptions.resume_from_agent_id` carries the source id into `ChildLaunchManifest.resume_from_agent_id` (persisted). - `WorkflowTaskSpawnMetadata.resume_from_agent_id` stamps the receipt returned to workflow/tool callers. Schema change: - New `resume_from` property added to the `agent` tool JSON schema. Tests (16 new, all green): - parse accepts resume_from / resumeFrom camelCase / absent / whitespace-only - parse accepts resume_from + fork_context=false (conflict detected at spawn) - manager rejects running source with actionable error message - manager rejects missing source - manager accepts completed / interrupted / failed / cancelled sources - manager rejects cross-workspace source - transcript artifact loaded when available - checkpoint fallback when artifact is missing - session name resolves to agent_id via resolve_agent_ref - SubAgentSpawnOptions carries resume_from_agent_id --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Hmbown
pushed a commit
that referenced
this pull request
Aug 4, 2026
…5142) * Initial plan * feat(subagent): add resume_from continuation chains (#425) Add `resume_from` parameter to the `agent` tool's `action=start` path, implementing the continuation-chain contract from issue #425. Semantics: - `resume_from` accepts a settled child agent_id or session name. - The source agent must not be running (completed, interrupted, failed, cancelled, or budget_exhausted are all accepted). - The source must live in the same workspace as the spawning agent; cross-workspace sources are rejected with a clear error. - The full transcript is loaded from the on-disk artifact. When the artifact is unavailable (legacy record, archived child, process-restart resume) the checkpoint messages are used as a fallback. - The loaded transcript is injected into the child's `fork_context`, forcing `fork_context=true` so the new agent starts with the prior lineage and the provider can reuse prefix-cache entries. - Explicitly setting `fork_context=false` together with `resume_from` is rejected at spawn time as contradictory. Receipt traceability: - `SubAgentSpawnOptions.resume_from_agent_id` carries the source id into `ChildLaunchManifest.resume_from_agent_id` (persisted). - `WorkflowTaskSpawnMetadata.resume_from_agent_id` stamps the receipt returned to workflow/tool callers. Schema change: - New `resume_from` property added to the `agent` tool JSON schema. Tests (16 new, all green): - parse accepts resume_from / resumeFrom camelCase / absent / whitespace-only - parse accepts resume_from + fork_context=false (conflict detected at spawn) - manager rejects running source with actionable error message - manager rejects missing source - manager accepts completed / interrupted / failed / cancelled sources - manager rejects cross-workspace source - transcript artifact loaded when available - checkpoint fallback when artifact is missing - session name resolves to agent_id via resolve_agent_ref - SubAgentSpawnOptions carries resume_from_agent_id --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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.
The
agenttool had no way to continue a prior agent's transcript lineage — each spawn always started fresh, losing prefix-cache affinity and requiring the parent to manually relay context across role transitions (explore → implement → verify).Changes
New
resume_fromparameter onaction=startAccepts a settled agent_id or session name. The source agent's full transcript is loaded and injected as the new child's fork context, enabling transcript-lineage continuation across role/profile transitions.
{ "action": "start", "type": "implementer", "prompt": "Now implement what the scout found", "resume_from": "agent_abc123" }Validation gates
action=waitoraction=interrupt)not founderrorfork_context=false+resume_from→ rejected at spawn time as contradictoryTranscript loading with fallback
Loads the full on-disk transcript artifact for prefix-cache reuse. Falls back to checkpoint messages for legacy records, archived agents, and process-restart resume scenarios.
Receipt traceability
ChildLaunchManifest.resume_from_agent_id— persisted in the durable launch recordWorkflowTaskSpawnMetadata.resume_from_agent_id— stamped on the spawn receiptresume_fromproperty added to theagenttool JSON schemaTests (16 new)
Covers parse variants (
resume_from/resumeFrom/absent/whitespace), all settled status variants (completed, interrupted, failed, cancelled), cross-workspace rejection, running-source rejection, transcript artifact load, checkpoint fallback, and session name resolution.