Skip to content

fix(sessions): preserve defaults and managed parent repositories in visible spawns - #132364

Merged
steipete merged 5 commits into
mainfrom
codex/cloud-session-live-fixes
Aug 29, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/cloud-session-live-fixes

Conversation

@steipete

@steipete steipete commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

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 returned accepted and 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-256 ef3460777760314f210e3ed8a6d9f51f82647e0071c46e9aa4a53dc3892d3378. Later commits align prompt text and generated snapshots. Head 2fbc3183b37a7e7481fd4b590c8224750cba2d53 passed 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. Head fcd30e7cff5c293cdb2e90f85fa1fdec41fa9fee rebases onto main 6b1eacad938: all task source, tests, docs, and snapshots remain byte-identical, with stable production patch ID 5d1f9d0c341cfc7b1cfaa1da73459e0141417e5a. Fresh isolated review and targeted lint pass; exact-head CI33241865043 passes, including the required openclaw/ci-gate.

  • Three default-field regressions fail on the pre-fix owner. Four workspace/authority regressions fail on the pre-fix creation owner; explicit-source and operator-boundary cases pass there.
  • 138 focused tests pass; broader Gateway/session/worker suites pass.
  • Full changed-file gate passes: production and all 15 core-test type graphs, lint, formatting, architecture/storage guards, and dead-code checks. Canonical package build and integrity checks pass.
  • Generated prompt fixtures were refreshed on Linux/Node 24. The final accepted-empty guidance assertion also fails before the copy correction and passes afterward.
  • Independent Codex autoreview found no actionable findings at its default P0 scope. Manual owner-boundary review and ClawSweeper findings are addressed separately.

Recorded UI proof

Actual UI submission, agent tool call, child navigation, README read, and completion:

worktree-live-success.mp4

Inherited repository child completes in its own managed worktree

Default-field replay child completes

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 c18ea58051019ef7a4339aa8820758b76357e068 already 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 98baef5ee81 proves 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.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 29, 2026, 4:14 AM ET / 08:14 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: fcd30e7cff5c293cdb2e90f85fa1fdec41fa9fee

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The normal visible-spawn behavior is well described and the inert-default repair is covered, but a P1 deferred authority gap prevents readiness.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied UI recording and screenshots describe successful normal inheritance, but the changed deferred owner stores only a workspace and the available source/tests do not demonstrate that parent archive, replacement, or rebind rejects before worktree I/O. Add redacted real-path evidence for that rejected scenario after the code repair. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied UI recording and screenshots describe successful normal inheritance, but the changed deferred owner stores only a workspace and the available source/tests do not demonstrate that parent archive, replacement, or rebind rejects before worktree I/O. Add redacted real-path evidence for that rejected scenario after the code repair. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Introduced deferred trigger: The introduced deferred branch stores only workspace, name, base reference, and title source after selecting the parent repository; it does not retain the parent session/worktree binding needed at later execution.
Deferred owner omits parent revalidation: First-turn preparation reloads the child pending intent and passes only child-run liveness as the worktree commit guard; it does not reload or validate the parent session or its managed-worktree record.
Final side effect follows the incomplete guard: Managed worktree preparation performs base resolution, directory creation, git worktree creation, provisioning, and setup after the supplied guard, so child-only validation is too late to protect the inherited parent source.
Findings 1 actionable finding [P1] Revalidate deferred inherited worktrees
Security Needs attention Deferred source outlives parent authority: The persisted deferred intent contains a raw workspace but no exact parent worktree identity, while the later owner checks only the child run before creating and provisioning a worktree.

How this fits together

The 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]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied UI recording and screenshots describe successful normal inheritance, but the changed deferred owner stores only a workspace and the available source/tests do not demonstrate that parent archive, replacement, or rebind rejects before worktree I/O. Add redacted real-path evidence for that rejected scenario after the code repair. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Revalidate deferred inherited worktrees (P1) - When an initial task defers worktree setup, this branch persists only workspace; later preparation checks the child run but never the parent session or managed-worktree binding. Archive, replacement, or rebind after this write can therefore still reach git provisioning and repository setup. Retain an exact source binding and validate it before deferred repository I/O; extend the deferred test beyond its current persisted-state assertion.
  • Resolve security concern: Deferred source outlives parent authority - The persisted deferred intent contains a raw workspace but no exact parent worktree identity, while the later owner checks only the child run before creating and provisioning a worktree.
  • Resolve merge risk (P1) - A child created with an initial task can later allocate a worktree from a parent repository after that parent is archived, replaced, or rebound, including repository setup execution.
  • Resolve merge risk (P1) - The durable deferred-intent repair must prove that existing non-inherited pending worktrees still prepare correctly while inherited intent fails closed when its exact parent binding changes.
  • Complete next step (P2) - The blocking repair is mechanically clear, but this maintainer-labeled PR changes a durable deferred lifecycle contract and needs the exact-head code/proof follow-through.

Findings

  • [P1] Revalidate deferred inherited worktrees — src/gateway/server-methods/sessions-create.ts:436-444
  • [medium] Deferred source outlives parent authority — src/gateway/server-methods/sessions-create.ts:436
Agent review details

Security

Needs attention: Deferred inherited repository authority can outlive the parent binding that authorized it and reach repository-side effects.

PR surface

Source +67, Tests +226, Docs 0. Total +293 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 4 92 25 +67
Tests 7 294 68 +226
Docs 1 3 3 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 389 96 +293

Review metrics

Metric Value Why it matters
Production versus test delta production +67, tests +226, docs 0 net, generated fixtures 0 net The production growth implements a new lifecycle fence, but its deferred branch lacks the matching final-effect validation.

Stored data model

Persistent data-model change detected: serialized state: src/agents/tools/sessions-spawn-tool.ts, serialized state: src/agents/tools/sessions-spawn-visible.ts, serialized state: src/gateway/server-methods/sessions-create.ts, unknown-data-model-change: src/agents/tools/sessions-spawn-tool.ts, unknown-data-model-change: src/agents/tools/sessions-spawn-visible.ts, unknown-data-model-change: src/gateway/server-methods/sessions-create.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Fence deferred inheritance before merge (recommended)
    Persist or otherwise retain the exact inherited parent/worktree binding, revalidate it through deferred preparation, and add a regression that changes the parent before first-turn worktree I/O.
  2. Pause the inherited-source feature
    Do not merge the parent-repository inheritance portion until deferred session creation has an owner-bound authority check.

Technical review

Best 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:

  • [P1] Revalidate deferred inherited worktrees — src/gateway/server-methods/sessions-create.ts:436-444
    When an initial task defers worktree setup, this branch persists only workspace; later preparation checks the child run but never the parent session or managed-worktree binding. Archive, replacement, or rebind after this write can therefore still reach git provisioning and repository setup. Retain an exact source binding and validate it before deferred repository I/O; extend the deferred test beyond its current persisted-state assertion.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ddd7fd91ec67.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove proof: 🎥 video: Current real behavior proof evidence kind is none.

Label justifications:

  • P1: An ordinary visible-session worktree spawn can execute against a parent repository after its source authority has changed.
  • merge-risk: 🚨 session-state: Deferred child state persists a workspace detached from the exact parent session/worktree identity that selected it.
  • merge-risk: 🚨 security-boundary: The stale deferred path can reach git provisioning and repository setup after parent authority has been withdrawn or replaced.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied UI recording and screenshots describe successful normal inheritance, but the changed deferred owner stores only a workspace and the available source/tests do not demonstrate that parent archive, replacement, or rebind rejects before worktree I/O. Add redacted real-path evidence for that rejected scenario after the code repair. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Deferred source outlives parent authority — src/gateway/server-methods/sessions-create.ts:436
    The persisted deferred intent contains a raw workspace but no exact parent worktree identity, while the later owner checks only the child run before creating and provisioning a worktree.
    Confidence: 0.99

What I checked:

Likely related people:

  • Peter Steinberger: Authored the branch’s inherited-source implementation and several earlier merged session/worktree lifecycle changes in the same owner boundary. (role: session and worktree feature owner; confidence: high; commits: b99b1d382917, 54a53583565c, 295a48b59102; files: src/gateway/server-methods/sessions-create.ts, src/gateway/server-methods/session-create-project.ts, src/gateway/session-worktree-preparation.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Persist and revalidate the exact inherited parent/worktree binding on deferred preparation.
  • Drive a deferred first turn after parent archive, replacement, and registry rebind, proving no worktree or setup action occurs.
  • Attach redacted real-path evidence for the rejected final-effect scenario; updating the PR body should trigger re-review automatically.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-29T04:48:34.956Z sha d42d7ea :: found issues before merge. :: [P3] Align schema guidance with accepted inert values
  • reviewed 2026-08-29T06:07:22.599Z sha ec7e201d9951c3ebec863893591a6ccbf1263015 :: needs changes before merge. :: [P3] Describe the accepted empty attachment fields
  • reviewed 2026-08-29T06:28:15.114Z sha c0a13264f5fbcbeccafc51fa59ff040f84f3ceca :: found issues before merge. :: [P3] Describe accepted empty attachment fields
  • reviewed 2026-08-29T06:49:33.373Z sha 34bced80892152a14de2d2fa7636bff40dc11938 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T07:15:39.058Z sha 2fbc3183b37a7e7481fd4b590c8224750cba2d53 :: found issues before merge. :: [P1] Fence deferred inherited worktrees
  • reviewed 2026-08-29T07:41:49.195Z sha 60dca4be33e634cc73e0a791f6909dfbc6b9069e :: needs real behavior proof before merge. :: [P1] Fence deferred inherited worktrees
  • reviewed 2026-08-29T07:49:05.567Z sha 60dca4be33e634cc73e0a791f6909dfbc6b9069e :: needs real behavior proof before merge. :: [P1] Fence deferred inherited worktrees
  • reviewed 2026-08-29T08:03:15.630Z sha fcd30e7 :: needs real behavior proof before merge. :: [P1] Revalidate deferred inherited worktrees

@steipete steipete changed the title fix(sessions): accept inert defaults when creating visible sessions fix(sessions): preserve defaults and managed parent repositories in visible spawns Aug 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: M and removed size: S labels Aug 29, 2026
@steipete
steipete marked this pull request as ready for review August 29, 2026 05:58
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 29, 2026
@steipete
steipete force-pushed the codex/cloud-session-live-fixes branch from 34bced8 to 2fbc318 Compare August 29, 2026 07:04
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 29, 2026
@steipete steipete closed this Aug 29, 2026
@steipete steipete reopened this Aug 29, 2026
@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
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.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 29, 2026
@steipete
steipete force-pushed the codex/cloud-session-live-fixes branch from 60dca4b to fcd30e7 Compare August 29, 2026 07:53
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. labels Aug 29, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The deferred-parent-binding finding is not accepted: it treats an authorized repository choice as a perpetual grant from the parent. InternalSessionEntry.pendingWorktree is explicitly “Authorized worktree intent awaiting preparation by an admitted turn” (src/config/sessions/types.ts:620). Commit 54a5358 (#131559) introduced that durable acceptance/retry boundary. Its preparation owner validates the exact current child session, admitted run/controller, lifecycle generation, pending intent, and calling runtime authority before binding; repository setup is authorized from the current caller, never the creator's saved privilege (src/gateway/server-methods/session-create-project.ts:70). The existing real-handler test “chat.send rechecks setup scope when a write-only caller retries an admin's failed worktree” demonstrates that a different authorized caller can resume the already-created session without inheriting admin setup authority (src/gateway/server.sessions.create.projects.test.ts:464).

Parent archive drains the parent's exact lifecycle identities and placement; it does not erase a durable child's accepted workspace choice (src/gateway/server-methods/sessions-patch-archive.ts, src/gateway/server-methods/sessions-lifecycle-drain.ts). Parent replacement/rebinding likewise does not revoke already-created session workspaces. The native sibling stores inherited workspace/cwd on the child for reuse on later turns (src/config/sessions/types.ts:348, src/agents/subagents/spawn/subagent-spawn-session-patch.ts:124). A durable parent binding would make operator retries fail according to whether checkout preparation happened just before or just after parent archival, contrary to that session-owned retry contract. The original caller still must remain live for its own privileged operations; this does not make copied runtime authority reusable.

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.

@steipete
steipete merged commit 1e42dbc into main Aug 29, 2026
250 checks passed
@steipete
steipete deleted the codex/cloud-session-live-fixes branch August 29, 2026 08:40
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant