Skip to content

fix(windows): restore Gateway model runs with worker metadata - #155071

Merged
steipete merged 2 commits into
mainfrom
codex/windows-session-worker-env
Sep 22, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/windows-session-worker-env

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Windows Gateway model runs failing with “could not be cloned” when recording session model or thinking metadata.

Why This Change Was Made

The metadata command duplicated the host environment in its serialized payload. Windows environment snapshots use a case-insensitive Proxy, which V8 cannot serialize. The database worker already receives canonical captured state facts, so the repair removes the redundant payload and uses that existing context for initialization, appends and committed-view reads.

The migrated-update tests also reuse their existing prepared native candidate runtime across cases. Each case retains separate state, authority and fresh child processes; tracked work settles before shared fixture cleanup. Qualification, finalization, full-build prerequisites and deadlines are unchanged.

User Impact

Windows sessions can persist model and thinking changes through the canonical database worker. Database identity, writer authority, ordering, cancellation and transaction checks remain intact. No schema, public API or configuration change.

Related: #153216. Production LOC: +10/-7 (net +3), including ownership comments; tests/support: +116/-74. The final PR contains four files and no Codex question-test or workflow changes.

Evidence

  • The real metadata-worker regression fails before the fix with the exact V8 clone error and passes afterward using Windows environment semantics and a mixed-case state-directory key. All 46 focused and sibling tests passed, covering FIFO persistence, reopened history, target/environment capture and absence of host transcript writes.
  • Native packaged Windows proof passed on September 21. An isolated normal Gateway returned readiness HTTP200 in14.297 seconds, a real OpenAI model reply with the requested marker, then a separate persisted turn retrievable through chat.history. SQLite contained six expected events, including model_change, thinking_level_change, user and assistant messages. Total fixture time was48.566 seconds; the native lifecycle owner joined all children and removed private state.
  • That proof used package revision ad230637c7e59d5c55545a348e074cd49716b6a5, SHA256 b3d64a247ecb02904decb07c27208f30ae0ce6f8fb5d5748ef2ad98390efe32c. The metadata producer/worker and relevant admission/context source remain identical at current head a250c9e002cceff633de3b88a1e06cd22362d1a7. Existing static test authentication was used; production authentication was unchanged. This is isolated packaged proof, not a production rollout claim.
  • The final migrated-update fixture passed all20 cases on a fresh Blacksmith Testbox execution, with the original complete runtime prerequisite: build51.6 seconds, Vitest69.33 seconds, test wrapper124.11 seconds; the retained-finalizer case completed in4.934 seconds. Native command success and stopped-lease cleanup were independently verified. The hosting workflow can show cancellation when the one-shot lease stops; a later portal-summary synchronization warning did not change the command result.
  • Main independently fixed a pnpm diagnostic assertion and introduced fake-clock ownership in the question suite. The rebase adopts those changes and removes our now-obsolete question wait. All seven original main question cases passed in their original order against the repaired runtime in37.42 seconds. Earlier hosted failures are retained; no test or production timeout was increased and no assertion was weakened.
  • Fresh complete four-file independent review at a250c9e found no actionable P0–P2 findings (confidence0.96). Scoped lint and formatting passed. Current-head hosted CI remains the landing gate.

Measured changed-test costs: session-manager.test.ts,28 cases/10.622 seconds summed case time (46-test sibling run31.21 seconds total); update-command-migrated.test.ts,20 cases/69.33 seconds Vitest including setup. The native Windows proof and measured costs address the completed ClawSweeper review requests.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 7:20 PM ET / 23:20 UTC (Revision 8).

ClawSweeper review

What this changes

The PR restores Windows model and thinking-level persistence by using the database worker’s captured environment, and improves synchronization and shared setup in related tests.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. No blocking correctness or security finding emerged, and the recorded native Windows proof covers unchanged production source. Normal CI gates remain separate from this review.

Priority: P1
Reviewed head: 20dc1907e743e1892bc555d491bc5de3ad5be687

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant native Windows proof and meaningful regression coverage; no actionable patch finding remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured native Windows observations exercise the normal packaged Gateway through a real model response and persisted history, including both changed metadata operations; the two production files match the tested package at the reviewed head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured native Windows observations exercise the normal packaged Gateway through a real model response and persisted history, including both changed metadata operations; the two production files match the tested package at the reviewed head.
Evidence reviewed 9 items Pinned introduced changes: Reviewed the merge-base-to-head delta: two production files and three test files. The runtime change removes environment serialization and supplies the existing worker context to initialization, append, mutation reads, and committed-view reads.
Current main still carries the failing payload: Fetched main still assigns options.env to the metadata command scope. Windows environment cloning returns a Proxy, while the worker client serializes command input with V8. This establishes the failure mechanism without executing target code.
Existing context and authority owners retained: The worker context captures the resolved state directory and supervision mode from the admitted environment. Metadata retains its database-path equality check, borrowed-connection check, and transaction/commit admission. No schema, persisted-format, public API, or authority contract changes were found.
Findings None None.
Security None None.

How this fits together

Session metadata records model and thinking-level changes during agent runs. The session manager sends these changes through the database worker, which commits them and returns the resulting transcript state.

flowchart LR
 A[Agent model run] --> B[Session manager]
 B --> C[Ordered write admission]
 C --> D[Database worker]
 E[Captured host environment] --> D
 D --> F[SQLite session history]
 F --> G[Committed transcript state]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +49. Total +52 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 10 7 +3
Tests 3 125 76 +49
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 135 83 +52

Review metrics

None.

Technical review

Best possible solution:

Keep metadata persistence on its existing worker and use that worker’s captured environment consistently without changing stored data or admission semantics.

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

Yes: current main passes a Windows environment Proxy into V8 command serialization, and the regression exercises that exact boundary. This read-only review did not execute the failure.

Is this the best way to solve the issue?

Yes: reusing the already-captured worker environment removes the redundant payload while preserving the canonical database owner, ordering, and admission checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8acbd853756a.

Labels

Label justifications:

  • P1: The source-proven serialization failure prevents Windows Gateway model runs from persisting required session metadata.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured native Windows observations exercise the normal packaged Gateway through a real model response and persisted history, including both changed metadata operations; the two production files match the tested package at the reviewed head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured native Windows observations exercise the normal packaged Gateway through a real model response and persisted history, including both changed metadata operations; the two production files match the tested package at the reviewed head.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the merge-base-to-head delta: two production files and three test files. The runtime change removes environment serialization and supplies the existing worker context to initialization, append, mutation reads, and committed-view reads. (src/agents/sessions/session-manager-metadata.worker.ts:179, 20dc1907e743)
  • Current main still carries the failing payload: Fetched main still assigns options.env to the metadata command scope. Windows environment cloning returns a Proxy, while the worker client serializes command input with V8. This establishes the failure mechanism without executing target code. (src/agents/sessions/session-manager-persistence.ts:128, 8acbd853756a)
  • Existing context and authority owners retained: The worker context captures the resolved state directory and supervision mode from the admitted environment. Metadata retains its database-path equality check, borrowed-connection check, and transaction/commit admission. No schema, persisted-format, public API, or authority contract changes were found. (src/state/openclaw-state-worker-context.ts:17, 20dc1907e743)
  • Native Windows behavior proof: The captured PR body records a packaged Windows Gateway returning readiness HTTP 200, a real model response, a subsequent persisted turn retrieved through chat.history, and six expected SQLite events including model and thinking changes. The tested package was ad230637c7e59d5c55545a348e074cd49716b6a5, SHA-256 b3d64a247ecb02904decb07c27208f30ae0ce6f8fb5d5748ef2ad98390efe32c. GitHub contents responses and local tree entries confirm both changed production files have identical blobs at that package revision and the reviewed head. Downloaded images were inspected and belong to related UI work, so they were not used as Windows proof. (src/agents/sessions/session-manager-metadata.worker.ts:179, ad230637c7e5)
  • Regression and fixture coverage: The expanded session-manager case exercises real metadata persistence with a non-cloneable Windows-semantics environment, preserving ordered entries, reopened history, and absence of host transcript writes. The Codex test awaits actual prompt delivery while retaining response and steering assertions. Update tests reuse the existing prepared runtime while keeping separate state and native qualification/finalization. The body records focused test costs and 20 passing migrated-update cases on Testbox. (src/agents/sessions/session-manager.test.ts:52, 20dc1907e743)
  • Affirmative Codex dependency signal: The changed test sends item/tool/requestUserInput through the Codex app-server adapter, and the PR explicitly claims compatibility with the upstream request/response flow. This makes direct Codex contract inspection applicable to the test repair. (extensions/codex/src/app-server/run-attempt.question-refresh.test.ts:180, 20dc1907e743)

Likely related people:

  • Peter Steinberger: Raw commit fd578cb adds src/agents/sessions/session-manager-metadata.worker.ts:193 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fd578cb8a62c; files: src/agents/sessions/session-manager-metadata.worker.ts)

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 (7 earlier review cycles)
  • reviewed 2026-09-21T18:09:53.434Z sha ad230637c7e59d5c55545a348e074cd49716b6a5 :: needs changes before merge. :: none
  • reviewed 2026-09-21T19:17:53.745Z sha 35dc861 :: needs changes before merge. :: none
  • reviewed 2026-09-21T19:45:24.626Z sha 65c9e7fbf2a35b35fe6dc091f1a0291c2864445c :: needs changes before merge. :: none
  • reviewed 2026-09-21T20:00:32.927Z sha 83bd788f7dbbea7e9ea5e932be33a76cfc4de3cb :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T21:06:36.379Z sha 983cec7 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T22:34:11.824Z sha d7abc568c2e7fb2b351e58e62b0ddda0a3aeafc9 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T22:51:18.191Z sha 2abb5cc4f37a0400b56051648ece0e5378bf3df6 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/windows-session-worker-env branch from ad23063 to 35dc861 Compare September 21, 2026 19:10
@clawsweeper clawsweeper Bot added 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 Sep 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 21, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 21, 2026
@steipete
steipete force-pushed the codex/windows-session-worker-env branch from 83bd788 to 077eea4 Compare September 21, 2026 20:23
@steipete
steipete force-pushed the codex/windows-session-worker-env branch from 077eea4 to 983cec7 Compare September 21, 2026 20:57
@openclaw-barnacle openclaw-barnacle Bot added size: S cli CLI command changes size: M and removed gateway Gateway runtime size: M size: S labels Sep 21, 2026
Prepare the existing complete candidate runtime once per suite while keeping each state, executor grant and qualification/finalization process isolated. Retain native inspection and finalization work until the shared fixture can safely clean up. Preserve full runtime build qualification and the existing 30-second test budget.

Validation: all 20 cases passed on the configured Blacksmith Testbox with the unchanged build prerequisite; the retained-owner case completed in 4.934 seconds. Scoped native lint and fresh independent P2 review passed. The original CI timeout and local prerequisite failure remain recorded; no same-host speed ratio is claimed.
@steipete
steipete force-pushed the codex/windows-session-worker-env branch from 20dc190 to a250c9e Compare September 21, 2026 23:29
@steipete
steipete merged commit 66627e1 into main Sep 22, 2026
188 checks passed
@steipete
steipete deleted the codex/windows-session-worker-env branch September 22, 2026 00:25
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…aw#155071)

* fix(windows): restore Gateway model runs with worker metadata

* test(update): share prepared candidate runtime across migration cases

Prepare the existing complete candidate runtime once per suite while keeping each state, executor grant and qualification/finalization process isolated. Retain native inspection and finalization work until the shared fixture can safely clean up. Preserve full runtime build qualification and the existing 30-second test budget.

Validation: all 20 cases passed on the configured Blacksmith Testbox with the unchanged build prerequisite; the retained-owner case completed in 4.934 seconds. Scoped native lint and fresh independent P2 review passed. The original CI timeout and local prerequisite failure remain recorded; no same-host speed ratio is claimed.
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant