fix(coding-agent/session): suppressed subagent breadcrumbs so --continue resumes the parent session

- Added a `suppressBreadcrumb` option to `SessionManager.open()` so headless opens skip writing the per-TTY `--continue` breadcrumb, and passed it from the subagent opens in `task/executor.ts` and the HTML export open in `export/html/index.ts`, which run in the parent's terminal and were clobbering the breadcrumb with their own artifact-dir session file.
- Added `resolveBreadcrumbToInteractiveRoot()` and applied it in `continueRecent()` so already-poisoned breadcrumbs pointing inside a parent's artifacts dir (`<parent>/<agentId>.jsonl`) resolve back up to the top-level interactive session.
- Added `subagent-breadcrumb.test.ts` covering both that a subagent open keeps `--continue` on the parent and that a stale subagent-pointing breadcrumb is recovered.
This commit is contained in:
can1357
2026-06-16 16:05:50 +02:00
parent 623e9d3710
commit 6bbc573c6f
4 changed files with 155 additions and 4 deletions
+9 -2
View File
@@ -1927,7 +1927,12 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
const effectiveCwd = worktree ?? cwd;
const sessionManager = sessionFile
? await awaitAbortable(SessionManager.open(sessionFile, undefined, undefined, { initialCwd: effectiveCwd }))
? await awaitAbortable(
SessionManager.open(sessionFile, undefined, undefined, {
initialCwd: effectiveCwd,
suppressBreadcrumb: true,
}),
)
: SessionManager.inMemory(effectiveCwd);
if (options.parentArtifactManager) {
sessionManager.adoptArtifactManager(options.parentArtifactManager);
@@ -2048,7 +2053,9 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
// (createAgentSession → agent.replaceMessages). Isolated runs are not
// resumable (worktree is merged + cleaned) and never get a reviver.
reviveSession = async () => {
const reopened = await SessionManager.open(sessionFile);
const reopened = await SessionManager.open(sessionFile, undefined, undefined, {
suppressBreadcrumb: true,
});
if (options.parentArtifactManager) {
reopened.adoptArtifactManager(options.parentArtifactManager);
}