Repository navigation
feat(acp): advertise session list/fork, fix inference_speed category - #275
Conversation
dirac-run
left a comment
There was a problem hiding this comment.
Requesting changes: session forking has two runtime-safety blockers.
P1 — Deleting the source can delete the fork's workspace and uncommitted edits.
cli/src/agent/sessionHistory.ts:112–128 permits the source's working directory to become the fork's directory, and DiracAgent.ts:1527–1562 registers the fork without shared worktree ownership or an independent worktree. Create source session S with a Dirac-managed worktree W, fork S using cwd: W, make uncommitted edits in the fork, then delete S. deleteSessionResources (DiracAgent.ts:220–226) calls deleteWorktree(..., true), which executes git worktree remove --force W. The fork remains registered while its workspace and edits are deleted. This requires no concurrency.
Please allocate an independent worktree, retain shared ownership until all dependent sessions release it, or reject this configuration. Add a source-deletion/fork-survival regression including uncommitted changes.
P1 — Forking does not capture a consistent source snapshot.
At DiracAgent.ts:1480–1509, the Processing check is outside runSessionRuntimeMutation, and the mutation protects only source-state resolution. Its barrier is released before cloneForkedSessionArtifacts copies task files and the journal (sessionHistory.ts:187–209). A new source prompt can write during the copy. A prompt already awaiting initialization can also leave the session apparently idle long enough for the early check to pass, then set Processing before the queued fork reads state without rechecking it. The active-prompt queue serializes prompts, not forks. Files and journal can therefore represent different conversation states. The inventory lock also begins after the filesystem copy, leaving deletion uncoordinated with that copy.
Please check source status inside synchronization and protect the entire snapshot against prompt mutation and deletion. Add controlled interleaving regressions for a prompt initializing before fork, a prompt starting during copy, and source deletion during copy. The sequential fork test does not cover these conditions.
Static code review of head 6b4d1cf04b652ac61c6190f7e345ff88975b1393, reassessed after #252/#272/#273 merged into master 441c5766c0b6f57f6ec2f9abd0e3745709d603b5. No tests or builds were run. These are intrinsic lifecycle/data-safety blockers, not dependency-only or missing-CI objections.
- Advertise sessionCapabilities.list and fork in DiracAgent.initialize - Implement DiracAgent.unstable_forkSession and AcpAgent.unstable_forkSession with isolated sessionId, task directory copy, and renumbered update journal - Change inference_speed category from model to model_config
- Remove input.hint duplication in sendAvailableCommands - Replace unsafe _meta cast with runtime isObject guard in copySessionUpdates - Extract resolveForkSourceState, resolveForkSourceCwd, cloneForkedSessionArtifacts into sessionHistory.ts and registerForkedSession helper in DiracAgent.ts
- keep shared worktree until last owner deletes or integrates - hold session barrier and history lock across fork snapshot - expose listSessions and resumeSession for ACP SDK wire dispatch
6b4d1cf to
e0be9b8
Compare
|
Rebased onto
|
Summary
sessionCapabilities.listandsessionCapabilities.forkininitialize(), and exposelistSessions/resumeSessionalongsideunstable_listSessions/unstable_resumeSessionso@agentclientprotocol/sdkwiressession/listandsession/resumeover JSON-RPC.unstable_forkSessioninDiracAgent/AcpAgent: fresh session + task UUIDs, task-dir and ACP-journal copy underDATA_DIR, isolated runtime config,sessionStatesregistration,modes/configOptionsin response; no history replay (matches resume semantics).resolveSharedSessionWorktree,getWorktreeOwnerSessionIds,hasOtherSessionWorktreeOwners): physical worktree removal on session deletion ordeleteAfterMergeintegration runs only when no other session still owns the worktree, and integration rejects while any co-owning session has an active task.runSynchronizedSessionOperation+withTaskHistoryInventoryLock): source status check, source state resolution, task-directory copy,taskHistoryupsert, and ACP journal copy all run under per-session synchronization and a single inventory lock hold, serialized against prompt initialization and session deletion.inference_speedfrommodeltomodel_configper ACP spec.input.hint(description text) from slash commands.Verification
check-types:generated,check:arch,lintall pass.cli/dist/cli.mjs --acpstdio verification: worktree fork + source deletion survival + last-owner cleanup, plussession/prompt→session/fork→session/list→session/resume/session/load.dev/acp-zed-gaps/ISSUE_AND_RCA.md; review notes:CODE_SMELL_REVIEW.md.User test (live Zed +
cli/dist/cli.mjs --acp)agent: fork thread— new thread forks with context, shared worktree and uncommitted edits survive source deletiondefault/standard/fastselector on anthropic