Skip to content

fix(sessions): preserve context and lifecycle when forking chats - #132227

Merged
steipete merged 6 commits into
mainfrom
steipete/session-forking-and-live-tests-47dd9d
Aug 29, 2026
Merged

steipete merged 6 commits into
mainfrom
steipete/session-forking-and-live-tests-47dd9d

Conversation

@steipete

@steipete steipete commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #131954 — message-level incognito forks returned an unreadable child.

What Problem This Solves

Fixes an issue where users choosing Fork from here could remain in the parent without an error when the parent was incognito. The same fork-lifecycle audit found delayed results overwriting a newer session selection/draft, failed forked subagents leaving copied history behind, and native Codex forks rejecting unchanged text or losing their source connection.

Live verification also exposed a named-thread failure: Codex correctly inherited the source name, but the importer reused it as a unique OpenClaw label already owned by the parent. This PR fixes that collision without renaming native threads or weakening label uniqueness.

Why This Change Was Made

Forking now carries the facts actually committed by its owners—storage class, verified transcript boundary, current mutation authority, prepared child generation, and effective context—instead of reconstructing them from requested options or stale state. Native source forks use the existing supervised materializer to apply real tools/instructions; failure compensation preserves successor ownership and tracks native artifacts even when a tracking write throws.

The repair removes duplicate context branches, a separate CAS-cleanup loop/error marker, an unreachable linked-native-incognito specialization, and an unused prompt parameter. No SQLite schema, configuration option, dependency, protocol-version, or startup-budget changes.

User Impact

Incognito children open, retain the correct prefix, and remain in memory. Old fork responses cannot steal focus or replace a newer draft. Failed child creation cleans up only its own generation. Local transcript copies respect harness locks and revalidate captured mutation authority at commit. Spawn results expose actual context, and nested children follow their current assignment rather than an inherited task envelope. Native catalog user prompts, verified source cut points, secondary-home routing, and native model ownership are preserved.

Explicit limitation: messages newly added to an adopted Codex Chat's canonical thread are not yet supported as descendant fork points. Native model history can contain injected messages absent from projected turns; reconstructing a child from that view would lose history. Correct support requires a separately accepted child-initialization/subscription/readiness/cleanup lifecycle. This PR preserves original-source forks and documents the boundary rather than adding unapproved persistent state or claiming that resume applied configuration. Duplicate names when adopting distinct native sources remain a separate naming-policy follow-up; existing adoption behavior is unchanged.

Evidence

Implementation and review were AI-assisted. I inspected the owner/caller/sibling paths and the pinned Codex rust-v0.150.1 source (90854393966b21e9ebfd21b122334eb09a20c93d), including exclusive beforeTurnId, history projection/injection, fork configuration/subscriptions, and inherited thread names. Independent Codex review found two cleanup leaks; both received failing regressions and owner-level fixes. The complete repair and subsequent naming follow-up reviews are clean, with no actionable P0–P2 findings.

Current candidate: e91f79ae416db8b498edba3d5bfaf7f90d4ceafe, based on inspected main 710a38588f8b9ffe88c0cb0b883967009c8c725f. Full-build and live-runtime proof ran at b2877cda37cdc9e76e95e916aa01657747f47acc. Subsequent corrections are a type-only import, generated prompt fixtures, and duplicate attachment-type removal. An actual documentation conflict required the latest rebase; native plugin code is unchanged across it. The combined main/repair owner paths received the additional focused verification below.

Proof Observed result
Incognito, real Control UI + embedded provider and ordinary Codex runtime Child opens, exclusive prefix and draft restored, real child recalls inherited word, parent unchanged, child reloads.
Retained pane A → B → A Delayed genuine successful fork response no longer changes the selected source or overwrites its newer draft. Same retained pane object; no mocked fork or UI mutation.
Named native Codex source, secondary home Repeated forks succeed; selected turn and later source messages are excluded; first child turn recalls inherited context.
Native child after Gateway/app-server restart Same child continues with inherited context; excluded tail stays absent; parent unchanged.
Actual root → child → grandchild delegation Both accepted spawn results report context: "fork"; grandchild's task omits the remembered word, but its own response is apricot LEAF_TASK_COMPLETE. Verified the child tool call/result and grandchild transcript, not only the root's claim.
Named-fork regression Both pending and materialized cases fail before the naming fix with label already in use; both pass afterward. Six import/fork/adoption suites: 95 passed. The test runtime explicitly models label uniqueness; actual SDK creation is proven by the live UI flow.
Integrated owner/sibling proof 687 tests passed before the final main integration. After integration: 152 native + 41 UI tests passed, plus the changed-file checks, canonical production/test type lanes, lint, formatting, and guards. Counts describe separate, overlapping runs—not unique tests.
Full build pnpm build passed in 30m 19.4s. Startup JS: 344,957 B against 345,947 B enforcement limit.
Exact-head hosted CI Run 33230038980, attempt 1 completed successfully at e91f79ae416db8b498edba3d5bfaf7f90d4ceafe; openclaw/ci-gate is green.

CI follow-up: the first exact-head run found a type-only sessions-barrel cycle and stale generated prompt artifacts. The import now points to the same defining type module; its emitted JavaScript is byte-identical. The prompt artifacts were regenerated from the corrected source guidance, without weakening assertions or budgets. Both cycle checks, the snapshot check, and 55 focused model/storage/fork/prompt tests passed; independent review of this follow-up is clean.

The required rebase preserves main's model-aware operator fork capacity, the fixed 100K automatic/subagent fallback, and the newly captured Gateway resolver. 83 additional focused tests passed across capacity selection/clamping/fallback, same/cross-store parent forks, locks, last-completed cuts, rejecting resolver ownership, and all prepared-child cleanup cases. All seven prompt artifacts remain current; the rebased Madge graph has zero cycles. The incoming resolver argument exposed a 701-line spawner; reusing its existing attachment-result type removed ten lines instead of weakening the guard. The integration review is clean. One local operator-suite setup timeout produced a secondary teardown error; its unchanged retry passed, and the test-resource cleanup problem is recorded separately.

The native-incognito review finding and both rank-up moves are addressed in the source-backed maintainer disposition. Ordinary Codex-backed incognito sessions use the local fork path; supported native-catalog adoptions are durable. No supported producer reaches the alleged initial native-incognito write, and pinned Codex rejects the required turn-history read for genuine ephemeral threads. The removed direct mock did not represent the Gateway/creator contract.

The earlier build correctly failed on a pre-existing startup-size overage: the candidate was 227 B over, while the same pinned main was 235 B over. We waited for and integrated the canonical startup import fix, rather than raising a budget. Disk-exhaustion runs and initial mis-synchronized browser attempts were discarded as evidence; the results above are from completed healthy runs.

The additional Codex package-project typecheck also passed after the repository's required boundary-artifact preparation. A direct post-build invocation initially failed on duplicate declaration identities and a local-only test export because it omitted that preparation; no source changes, casts, or new SDK exports were needed. The unprepared invocation is recorded as a failed diagnostic, not a product regression or a passing check.

Inspected before/after screenshots and live recordings

All content is synthetic test data. Screenshots and recordings were inspected before upload. Comparisons show before on the left, after on the right.

Incognito: inaccessible child → correct prefix and restored draft

Incognito fork before and after

after-incognito-flow.webm

Retained pane: late response steals selection/draft → newer source presentation preserved

Retained-pane fork race before and after

after-presentation-flow.webm

Named native source: label collision → independently continued child

Named native fork before and after

after-native-flow.webm

Same native child after Gateway/app-server restart

Native fork recalls context after restart

Real nested fork completion

Nested fork completes the current child task

Focused final commands
node scripts/check-changed.mjs -- extensions/codex/src/app-server/session-history-import.ts extensions/codex/src/session-catalog-adoption.ts extensions/codex/src/app-server/upstream-fork-import.test.ts extensions/codex/src/app-server/upstream-session-fork.test-support.ts
node scripts/run-vitest.mjs extensions/codex/src/app-server/dynamic-tool-build.test.ts extensions/codex/src/app-server/upstream-session-fork-continuation.test.ts extensions/codex/src/app-server/upstream-fork-import.test.ts extensions/codex/src/app-server/transcript-mirror.test.ts
node scripts/run-vitest.mjs ui/src/pages/chat/chat-pane.message-cut.test.ts ui/src/pages/chat/chat-pane-history.test.ts
pnpm build
node --import ./scripts/tsx.mjs scripts/prepare-extension-package-boundary-artifacts.mts
node scripts/run-tsgo.mjs -p extensions/codex/tsconfig.json --noEmit

Rebase integration commands:

node scripts/run-vitest.mjs src/config/sessions/session-accessor.parent-fork.test.ts src/auto-reply/reply/session-fork.test.ts src/auto-reply/reply/session-parent-fork-prepare.test.ts src/sessions/model-overrides.test.ts src/agents/subagents/spawn/subagent-spawn-gateway.test.ts src/agents/subagents/spawn/subagent-spawn.fork-cleanup.test.ts
node scripts/run-vitest.mjs src/agents/context.test.ts src/agents/subagents/registry/subagent-gateway-context-binding.test.ts src/gateway/server-plugin-in-process-dispatch.authorization.test.ts -t 'can exclude unscoped cache entries|prefers per-model contextTokens|keeps configured contextTokens|prefers verified provider discovery|keeps verified provider discovery|keeps configured native windows|caps prepared runtime tokens|subagent Gateway context binding|Gateway binding'
node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts -t 'fork|model-selection-locked'
node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts -t 'retains the 100K fallback|clamps configured capacity'
node --import ./scripts/tsx.mjs scripts/generate-prompt-snapshots.ts --check
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts

Live browser drivers used an isolated state directory, workspace, and non-operator port, with real OpenAI/Codex turns. Only the retained-pane race delays a genuine WebSocket response. Assertions—not sleeps or forced clicks—drive the scenarios. No operator Gateway or saved operator state was modified.

Production LOC: +357/−344, net +13. Tests/support: +2671/−394; generated prompt fixtures: +28/−28; docs: +34/−21. The small production increase carries authoritative cleanup identity/effective context, commit-time checks, and explicit naming ownership; cleanup consolidation itself is net +1, and attachment-type deduplication removes another ten lines. Test totals include fixture moves/splits as well as new regression coverage.

Provenance, without claiming first release exposure: the key builder comes from message-level forks; the native binding/import naming path comes from upstream Codex forks, both authored and merged by steipete. Provisional cleanup identity comes from deterministic subagent recovery, authored by steipete and merged by vincentkoc.

@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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR labels Aug 29, 2026
@steipete
steipete marked this pull request as ready for review August 29, 2026 00:19
@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 11:18 PM ET / August 29, 2026, 03:18 UTC.

ClawSweeper review

What this changes

The branch preserves context, lifecycle fencing, incognito storage identity, and upstream Codex linkage when users or agents fork chats.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No introduced defect was found in the inspected Gateway, SQLite, UI, subagent, or Codex-plugin paths. The pull request remains necessary because fetched main does not contain its head; the final merge review cannot be completed until the pinned Codex app-server contract is directly available for inspection.

Priority: P1
Reviewed head: e91f79ae416db8b498edba3d5bfaf7f90d4ceafe

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The local implementation and targeted boundary coverage are coherent, but the required upstream Codex contract review is unavailable.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-associated PR supplies reported runtime evidence; the outstanding gate is direct upstream contract inspection, not missing contributor behavior proof.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-associated PR supplies reported runtime evidence; the outstanding gate is direct upstream contract inspection, not missing contributor behavior proof.
Evidence reviewed 7 items Incognito and local session ownership: The fork handler derives a child dashboard key from the source incognito state, while the SQLite message-cut owner persists the same state; its transaction invokes the lifecycle guard before copying.
Authorization reaches the mutation owner: The handler revalidates lifecycle/sharing authority before delegating; the SQLite owner rechecks it inside the synchronous write transaction and rejects newly locked history.
Focused regression coverage: The added storage suite covers locked history, incognito child resolvability, and revoked queued sharing authority through the real Gateway/SQLite boundary; this read-only review did not execute it.
Findings None None.
Security None None.

How this fits together

Fork requests enter through the Gateway, which authorizes and fences the lifecycle before it copies a child session into SQLite for chat or subagent continuation. Codex-backed sessions also request an upstream app-server fork and attach the resulting thread to OpenClaw supervision.

flowchart LR
  A[Chat or subagent fork request] --> B[Gateway authorization]
  B --> C[Lifecycle fence]
  C --> D[SQLite child session]
  C --> E[Codex app-server fork]
  D --> F[Chat or agent continuation]
  E --> F
Loading

Before merge

  • Resolve merge risk (P1) - The pinned @openai/codex app-server fork and turn-history contract could not be inspected directly, leaving compatibility of the upstream-linked fork path unverified before merge.
  • Complete next step (P2) - Merge review is paused only for direct inspection of the upstream Codex contract; no concrete local repair is indicated.
Agent review details

Security

None.

PR surface

Source +153, Tests +2137, Docs +13. Total +2303 across 49 files.

View PR surface stats
Area Files Added Removed Net
Source 27 497 344 +153
Tests 18 2559 422 +2137
Docs 4 34 21 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 49 3090 787 +2303

Review metrics

Metric Value Why it matters
Production versus test delta production +358/-344 (net +14); tests/test support +2698/-422; docs +34/-21 The small production increase implements lifecycle and upstream-session fencing; most of the branch volume is focused regression coverage.

Stored data model

Persistent data-model change detected: serialized state: extensions/codex/src/app-server/session-binding.ts, serialized state: extensions/codex/src/app-server/session-history-import.ts, serialized state: extensions/codex/src/session-catalog-adoption.ts, serialized state: extensions/codex/src/session-catalog-transcript-item.ts, serialized state: src/agents/tools/sessions-spawn-tool.ts, serialized state: src/auto-reply/reply/session-fork.ts, and 10 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the upstream fork contract (recommended)
    Provide access to the pinned Codex app-server source and verify its thread/fork and retained-turn semantics before merging this session-state change.

Technical review

Best possible solution:

Make the pinned Codex app-server source available for direct contract inspection, then refresh the merge review against the exact head.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: the branch contains real Gateway/SQLite boundary scenarios for the reported locked-history, incognito, and revoked-authority fork cases, though this read-only review did not execute them.

Is this the best way to solve the issue?

Unclear: local owner-boundary inspection found no introduced defect, but the upstream Codex contract required by the changed path could not be directly inspected.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The PR repairs a fork path that can otherwise create unusable chat or subagent session state.
  • merge-risk: 🚨 session-state: It changes child-session copying, lifecycle fencing, and fork context for existing chat and agent sessions.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-associated PR supplies reported runtime evidence; the outstanding gate is direct upstream contract inspection, not missing contributor behavior proof.

Evidence

Acceptance criteria:

  • [P1] Inspect the pinned @openai/codex app-server thread/fork and turn-history contract.
  • [P1] Run the focused Gateway/SQLite storage and Codex upstream-session-fork suites at e91f79a.

What I checked:

  • Incognito and local session ownership: The fork handler derives a child dashboard key from the source incognito state, while the SQLite message-cut owner persists the same state; its transaction invokes the lifecycle guard before copying. (src/gateway/server-methods/sessions-rewind.ts:377, 891ae8728f04)
  • Authorization reaches the mutation owner: The handler revalidates lifecycle/sharing authority before delegating; the SQLite owner rechecks it inside the synchronous write transaction and rejects newly locked history. (src/config/sessions/session-accessor.sqlite-message-cut.ts:244, e91f79ae416d)
  • Focused regression coverage: The added storage suite covers locked history, incognito child resolvability, and revoked queued sharing authority through the real Gateway/SQLite boundary; this read-only review did not execute it. (src/gateway/server-methods/sessions-rewind.storage.test.ts:285, e91f79ae416d)
  • Affirmative Codex dependency signal: The changed plugin implements app-server session forks and the plugin pins @openai/codex 0.150.1, so the upstream thread/fork and turn-history contract is directly relevant. (extensions/codex/package.json:11, e91f79ae416d)
  • Codex contract inspection blocked: The required sibling Codex checkout is absent and network resolution failed, so the reviewer could not directly inspect the pinned upstream app-server contract; this is a review-environment limitation. (e91f79ae416d)
  • Current-main and release check: Fetched main is 383a293 and does not contain this PR head; no local release tag contains the head, so the change is neither implemented on fetched main nor released. (383a293b32d9)

Likely related people:

  • steipete: Peter Steinberger introduced the current fork lifecycle repair and the earlier upstream session-fork feature. (role: recent session and Codex area contributor; confidence: high; commits: 891ae8728f04, ea5406022313; files: src/gateway/server-methods/sessions-rewind.ts, extensions/codex/src/app-server/upstream-session-fork.ts)
  • wszkxlllll: Current upstream-fork cleanup lines and recent Codex lifecycle maintenance trace to this contributor. (role: recent adjacent Codex lifecycle contributor; confidence: medium; commits: 221c89c1a20a; files: extensions/codex/src/app-server/upstream-session-fork.ts)

Rank-up moves

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

  • Inspect the pinned Codex app-server thread/fork and turn-history contract, then refresh the exact-head merge review.

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 (5 earlier review cycles)
  • reviewed 2026-08-29T00:19:09.738Z sha b2877cd :: found issues before merge. :: [P1] Preserve ephemeral native storage for incognito forks
  • reviewed 2026-08-29T00:26:45.439Z sha b2877cd :: needs changes before merge. :: [P1] Keep the initial incognito Codex fork ephemeral
  • reviewed 2026-08-29T01:59:46.719Z sha 754cfd5 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T02:36:03.454Z sha 754cfd5 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T03:05:42.066Z sha e91f79a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Addressing the incognito finding and both rank-up moves: I independently traced the candidate's producers and the pinned Codex source. I am not accepting this as a reachable P1 in the supported flow; restoring the old flag would reinstate a test-only path, not repair ordinary Codex-backed incognito forks.

The distinction is Codex-backed versus upstream-linked. The Gateway selects native forking only when an upstream-link row exists. Without a link it uses the local message-cut owner. The caller cannot independently choose an incognito child: its storage class comes from the source. Ordinary Codex-backed incognito sessions take that local path; their real UI/provider flow, prefix, draft, child continuation, parent preservation, and reload passed. The real SQLite boundary tests additionally verify the absence of durable incognito rows and their loss on memory-store close.

Native catalog adoption generates a deterministic durable harness key and creates it without an incognito option. The other production link writer is the native fork itself. Its real runtime creator does not forward incognito, and the underlying creator rejects an incognito-shaped key without that flag. Patch, alias, migration, and binding-import paths did not supply a supported linked-incognito producer. The removed mock changed only the child key on a durable-source fixture and replaced this real creator.

For the dependency-source rank-up: I personally read sibling Codex at rust-v0.150.1, commit 90854393966b21e9ebfd21b122334eb09a20c93d. An omitted fork ephemeral flag does default to false, so the review's conditional storage concern is valid. But that version rejects thread/turns/list for ephemeral threads, and our handler requires that read before the native fork. Merely linking a genuine ephemeral thread therefore cannot reach the alleged write either.

Qualification: trusted plugins have broad SDK mutation capabilities; I am not claiming they cannot manually manufacture inconsistent state. I found no documented supported producer or shipped migration contract for the state alleged here. A concrete such path would change this disposition. The ephemeral-restoration rank-up is skipped for that reason; pinned dependency inspection is complete. Durable original-source forks, including repeated creation and continuation after a Gateway/app-server restart, also passed live.

Separately, CI identified a type-only barrel cycle and stale generated prompt fixtures. Those are being corrected; this comment is not a claim that the PR is ready to merge before CI is green.

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
Preserve incognito storage, revalidate message-cut authority at commit, and keep late UI fork results scoped to their presentation. Carry prepared child identity and actual context through subagent cleanup and receipts. Verify native source cuts with canonical projection and preserve supervision connection and cleanup ownership. Document the separate canonical-descendant initialization limitation.
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 29, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Aug 29, 2026
@steipete
steipete force-pushed the steipete/session-forking-and-live-tests-47dd9d branch from 754cfd5 to e91f79a Compare August 29, 2026 02:53
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready at e91f79ae416db8b498edba3d5bfaf7f90d4ceafe.

Exact-head CI run 33230038980, attempt 1 completed successfully; openclaw/ci-gate is green. Native review artifacts validate with zero findings. Complete and follow-up independent reviews are clean. The incognito finding/rank-up disposition records direct producer and pinned Codex source inspection; the latest bot review has no concrete contributor-facing finding.

The body contains the full command list and inspected before/after recordings. Local proof includes the successful full build, 687 earlier integrated tests, 193 subsequent native/UI tests, 95 naming/import/adoption tests, 55 CI-correction regressions, and 83 tests for the required main integration; these are overlapping runs, not unique-test totals. Real isolated UI/provider proof covers both incognito runtimes, retained-pane response ordering, nested fork tasks, repeated named native forks, and continuation after Gateway/app-server restart. The final owned corrections are type-only/golden artifacts, while native code is unchanged across rebase.

Representative final integration commands:

node scripts/run-vitest.mjs src/config/sessions/session-accessor.parent-fork.test.ts src/auto-reply/reply/session-fork.test.ts src/auto-reply/reply/session-parent-fork-prepare.test.ts src/sessions/model-overrides.test.ts src/agents/subagents/spawn/subagent-spawn-gateway.test.ts src/agents/subagents/spawn/subagent-spawn.fork-cleanup.test.ts
node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts -t 'fork|model-selection-locked'
node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts -t 'retains the 100K fallback|clamps configured capacity'
node --import ./scripts/tsx.mjs scripts/generate-prompt-snapshots.ts --check
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts

Known limits and discarded attempts remain explicit in the body. Canonical native descendant initialization is not silently enabled; no new schema/config/protocol/dependency or startup-budget change is included. Production is net +13 after removing duplicate context, cleanup, and type structure.

Proceeding through OPENCLAW_TESTBOX=1 scripts/pr prepare-run and the native merge workflow, without bypassing CI.

@steipete
steipete merged commit 30772d5 into main Aug 29, 2026
260 checks passed
@steipete
steipete deleted the steipete/session-forking-and-live-tests-47dd9d branch August 29, 2026 03:22
@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 29, 2026
…nclaw#132227)

* fix(sessions): preserve fork lifecycle ownership and context

Preserve incognito storage, revalidate message-cut authority at commit, and keep late UI fork results scoped to their presentation. Carry prepared child identity and actual context through subagent cleanup and receipts. Verify native source cuts with canonical projection and preserve supervision connection and cleanup ownership. Document the separate canonical-descendant initialization limitation.

* refactor(agents): remove unused subagent prompt task input

* test(codex): validate native fork fixture request shapes

* fix(codex): avoid inherited labels in native session forks

* fix(test): align fork prompt fixtures and session type imports

* refactor(agents): reuse subagent attachment result type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR 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: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fork from here returns an unreadable child for incognito sessions

1 participant