Repository navigation
fix: preserve project and current task context in visible spawns - #145102
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 1:44 PM ET / 17:44 UTC. ClawSweeper reviewWhat this changesThe PR preserves project selection and current conversation context when creating visible child sessions, clarifies their assigned task, and adds regression and live-provider coverage. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still rejects active-parent forks and misses direct-project inheritance. No blocking defect was found in the introduced changes; the maintainer-owned work should remain open. Priority: P2 Review scores
Verification
How this fits togetherVisible child sessions are persistent tasks created through the Gateway from an agent's spawn request. Session creation selects their repository, copies requested conversation history, and starts the delegated task. flowchart TD
A[Parent agent and assigned task] --> B[Visible spawn request]
B --> C[Validate live requester]
C --> D[Resolve registered project]
C --> E[Copy current conversation]
D --> F[Create child session and worktree]
E --> F
F --> G[Run explicit child assignment]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +148, Tests +701, Docs +2. Total +851 across 16 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep visible spawning on the shared task-envelope, session-creation, and worktree owners, with live requester checks guarding inherited context and repository selection. Do we have a high-confidence way to reproduce the issue? Yes, from source: a visible fork during an active parent turn hits main's active-work rejection, and a direct-project parent lacks the managed-worktree binding required for inheritance. This read-only review did not execute either failure. Is this the best way to solve the issue? Yes. The patch extends existing owners, preserves explicit selections and ordinary fork restrictions, and uses one task envelope for hidden and visible children. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 48a32fc72206. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…nclaw#145102) * fix: preserve project and current task context in visible spawns * test: inline single-use daemon install assertions
What Problem This Solves
Fixes an issue where a visible child task could not start from the current conversation when its parent was still running. A worktree child also selected the agent's default workspace instead of the registered project when its parent worked directly in that project. Once those failures were removed, live testing exposed that a forked visible child could follow the parent's earlier assignment instead of its own task.
Related: #144583.
Why This Change Was Made
Resolve inherited worktree repositories through the parent's live registered project, with the existing preparation and rollback guards. Allow a same-agent spawn to snapshot its own active parent only while the admitted requester remains current; ordinary active-parent forks retain their existing restrictions. Reuse the native subagent task-message owner for visible children so the current assignment follows inherited history with explicit child context.
The existing session creation and transactional transcript-fork owners remain authoritative. This adds no protocol fields, storage schema, or configuration options.
User Impact
Visible tasks can start in a separate worktree of the selected project, retain context from the parent's first in-progress turn, and execute their own assignment while the parent continues. Explicit directory/project choices and cross-agent boundaries keep their existing behavior.
Evidence
pnpm buildpassed. Both real-provider live probes passed (2 tests, 33.85 seconds): EOF recovery and visible worktree spawn. All changed-code checks passed, including core/test typechecks, lint, dead exports, schema and storage guards.CI note: the first merge-ref run failed core lint because a concurrent main change left the existing daemon-install test at 1,001 executable lines (limit 1,000). This PR inlines two one-use locals into unchanged assertions; no test, assertion, or limit was removed. Targeted lint and an independent review of that cleanup passed.
Final exact-head CI run passed. ClawSweeper reviewed the same head with no actionable findings.