Repository navigation
fix(sessions): preserve defaults and managed parent repositories in visible spawns - #132364
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 29, 2026, 4:14 AM ET / 08:14 UTC. ClawSweeper reviewWhat this changesThe PR accepts inert visible-session defaults and makes same-agent visible worktree children inherit their live parent repository when no explicit source is supplied. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain The immediate worktree path is fenced, but the deferred first-turn path retains only a repository string and can perform worktree I/O after its parent session or worktree binding changes. This remains a blocking P1 correctness and authority-boundary defect. Priority: P1 Review scores
Verification
How this fits togetherThe agent spawn tool asks the Gateway to create a visible child session and optional managed worktree. Deferred first turns persist workspace intent, then later prepare the worktree before dispatching the child agent. flowchart LR
A[Agent spawn request] --> B[Visible-session validation]
B --> C[Gateway session creation]
C --> D[Parent repository selection]
D --> E[Persisted worktree intent]
E --> F[First-turn preparation]
F --> G[Child worktree and agent run]
Before merge
Findings
Agent review detailsSecurityNeeds attention: Deferred inherited repository authority can outlive the parent binding that authorized it and reach repository-side effects. PR surfaceSource +67, Tests +226, Docs 0. Total +293 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Carry an exact inherited parent/session/worktree binding with deferred intent, validate it together with child-run liveness immediately before repository resolution and every worktree side effect, and prove the rejected deferred path creates no worktree. Do we have a high-confidence way to reproduce the issue? Yes, by source: create a same-agent worktree child with an initial task, change or archive the parent after the child stores pending intent, then drive the first-turn preparation path. The current tests already provide the child, parent, and managed-worktree harness but do not execute that sequence. Is this the best way to solve the issue? No. The immediate creation closure correctly rechecks the parent, but deferred preparation discards that closure and validates only the child run; the source binding must survive until final worktree I/O. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ddd7fd91ec67. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
34bced8 to
2fbc318
Compare
Allow the one-shot mode and empty attachment options without weakening rejection of unsupported visible-session behavior. Add failing-before regression coverage and correct the model-facing guidance. Fixes #132348.
Preserve explicit source selection and cross-agent defaults. Revalidate the exact parent session and managed worktree at creation commit boundaries, including deferred worktree intent. Align visible-spawn schema guidance and documentation with accepted inert defaults. Fixes #132398.
60dca4b to
fcd30e7
Compare
|
The deferred-parent-binding finding is not accepted: it treats an authorized repository choice as a perpetual grant from the parent. Parent archive drains the parent's exact lifecycle identities and placement; it does not erase a durable child's accepted workspace choice ( Added production-path characterization uses real Gateway handlers, persisted session state, and real Git worktrees: after child acceptance, a real parent archive RPC, parent replacement, or parent worktree rebind leaves the child's authorized retry able to create its own checkout from the accepted repository. The child's identity and original lineage are preserved, repository setup remains disabled for operator.write, and the agent dispatch is reached. A fourth case replaces the child incarnation at workspace preparation and proves no repository lookup, checkout creation, or agent dispatch occurs. All four cases passed with the existing suite (12/12). The final patch replaces the old pending-only test with this stronger table, leaving 11 tests for exact-head CI; no behavior, schema, configuration, or protocol change was needed. The source comment now states that source validation lasts through the child creation commit, and the managed-worktree docs explain the accepted child's retry ownership. The existing pending-worktree shape is unchanged; no durable parent grant is added. There is no production database schema change in this PR. The unrelated CI test-fixture extraction was dropped during rebase after main supplied its own repair. |
|
Merged via squash.
|
…isible spawns (openclaw#132364) * fix(sessions): accept inert defaults when spawning visible sessions Allow the one-shot mode and empty attachment options without weakening rejection of unsupported visible-session behavior. Add failing-before regression coverage and correct the model-facing guidance. Fixes openclaw#132348. * fix(sessions): inherit trusted parent repositories for worktree spawns Preserve explicit source selection and cross-agent defaults. Revalidate the exact parent session and managed worktree at creation commit boundaries, including deferred worktree intent. Align visible-spawn schema guidance and documentation with accepted inert defaults. Fixes openclaw#132398. * test(sessions): refresh visible spawn prompt snapshots * fix(sessions): clarify accepted empty attachment hints * test(sessions): prove deferred child workspace ownership
What Problem This Solves
Agent-created sessions fail in two ordinary cases: harmless default attachment/mode fields are rejected, and a managed-worktree child loses its same-agent parent's selected repository when the agent's configured workspace is not Git.
Closes #132348. Closes #132398.
Why This Change Was Made
The visible-spawn owner accepts default
mode: "run"and empty attachment hints while retaining rejection of actual staging and persistent/thread mode. Tool descriptions, schemas, and docs now describe the same contract.The Gateway session-creation owner selects a same-agent trusted parent's live registered repository when no explicit source is supplied. Exact parent session/worktree validation composes with existing commit guards; replacement, archive, or registry changes during preparation reject and roll back. Explicit cwd/project choices, cross-agent workspaces, operator scope checks, and setup-script permissions retain their existing behavior. Immediate and deferred worktree creation use the same owner.
No configuration option, SQLite schema, migration, runtime fallback, or alternate creation path was added. Existing records keep their canonical shape; this repairs source selection before creating a new child.
Evidence
Both defects were reproduced with real agent calls through the official OpenAI Responses API using an API key. The isolated Gateway used a synthetic Git repository and a non-Git default workspace; the operator Gateway and channels were untouched.
Post-fix, the real web UI submitted the formerly rejected default fields and a worktree spawn without cwd/project. The child appeared under its parent, read the repository's README, and returned
WORKTREE_CHILD_OK_7C35. Gateway records confirm the same repository with distinct parent/child worktree IDs and directories. An independent default-field replay returnedacceptedand completed with its expected marker.The web UI also created and dispatched a real AWS cloud session. Its agent executed on the remote host, read README, and wrote
CLOUD_UI_OK_7C35; that file reconciled into the managed local worktree. A subsequent cloud-hosted agent's child creation reached a separate managed session but failed during node enrollment. That separate provisioning/recovery defect is tracked in #132468; it is not counted as successful cloud-child execution or as proof of this patch.Runtime proof package: source
ec7e201d9951c3ebec863893591a6ccbf1263015, SHA-256ef3460777760314f210e3ed8a6d9f51f82647e0071c46e9aa4a53dc3892d3378. Later commits align prompt text and generated snapshots. Head2fbc3183b37a7e7481fd4b590c8224750cba2d53passed all 138 focused tests, the seven-file prompt check, formatting, and fresh isolated review. A fresh package from that head also repeated real AWS UI creation, remote execution, and file reconciliation; cloud-child enrollment stalled on the broker lease GET, separately tracked in #132468. Headfcd30e7cff5c293cdb2e90f85fa1fdec41fa9feerebases onto main6b1eacad938: all task source, tests, docs, and snapshots remain byte-identical, with stable production patch ID5d1f9d0c341cfc7b1cfaa1da73459e0141417e5a. Fresh isolated review and targeted lint pass; exact-head CI33241865043 passes, including the requiredopenclaw/ci-gate.Recorded UI proof
Actual UI submission, agent tool call, child navigation, README read, and completion:
worktree-live-success.mp4
Review Follow-through
ClawSweeper's schema and preset wording findings, including the rank-up move about empty attachment hints, are addressed. Production delta is +67 lines, tests +362, docs +2; generated fixture changes are counted separately. The new lifecycle checks are necessary to select the exact trusted live parent without letting stale/replaced state authorize child creation. Passing raw cwd from the tool would bypass the Gateway owner and operator boundary; skipping validation would allow source selection to outlive its parent. No existing helper owns that combined invariant.
CI initially caught stale prompt snapshots and two default-account assertions introduced independently on main. The snapshots are regenerated; main's
c18ea58051019ef7a4339aa8820758b76357e068already fixes the account assertions. The first rebase regenerated conflicting prompt fixtures. A later CI run exposed two main-branch failures: media-test line count and suppression inventory. Main now contains both repairs. The final rebase retained main's fixture extraction and new regression, dropping this branch's redundant CI-only extraction; no test bodies or runtime repair changed.Separate follow-ups: startup plugin convergence hides package-level install progress; a Blacksmith full-checksum overlay sync damaged prepared dependencies/lockfile, avoided by fresh direct branch hydration; cloud-child node enrollment timed out and parent stale-run recovery interrupted the outstanding tool call. The bootstrap package-permission issue in the test setup was corrected with a scoped public-package
umask 022, without weakening private enrollment-file permissions.AI-assisted investigation and repair.
Deferred child ownership review
The later parent-binding finding is not accepted: saved workspace intent belongs to the accepted durable child, while preparation revalidates the current child admission and caller authority. See the source-backed disposition. A new test/comment/docs-only commit
98baef5ee81proves parent archive, replacement, and rebind retain the accepted repository, while replacement of the child blocks repository lookup, checkout creation, and agent dispatch. All four new cases passed in the 12-test development suite; the redundant pending-only test was then removed, leaving 11 for current-head CI. This addresses the Rank-up request with the established child-owned contract rather than adding a perpetual parent grant or changing persisted state. Final-head CI33243214311 passes, including the final 11-case worktree suite and the required CI gate.