Skip to content

fix(sessions): restore Windows cron setup and session admission - #160075

Merged
steipete merged 6 commits into
mainfrom
upd/cron-dataclone-env-proxy
Sep 29, 2026
Merged

steipete merged 6 commits into
mainfrom
upd/cron-dataclone-env-proxy

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #157067
Closes #159339
Refs #157109 #157348

What Problem This Solves

Windows cron agent turns and session admission can fail before execution with DataCloneError when a case-insensitive environment Proxy reaches a session-history worker.

User Impact

Restores session reads during Windows cron setup and admission, including configured stores that require discovery. No configuration, database schema, dependency, or migration changes are required.

Why This Change Was Made

Capture plain storage facts at both the registered exact-entry request builder and the session-store discovery request builders, then restore platform environment semantics inside the worker. The existing storage-environment owner supplies the resolved state directory and external-supervisor mode; it now reads only the bounded inputs needed to resolve those facts instead of copying the whole environment. Local admission, retained database authority, and configured path resolution stay with their existing owners.

Thanks to @aniketkrs and @yashas-13 for identifying and proposing the exact-entry environment capture in the referenced PRs. This replacement covers the earlier discovery transport as well. Both GitHub-linked human commit authors are credited in the commit.

Evidence

  • Original real-worker negative control on Linux Testbox tbx_01m3jtnz69vq5cq2thp03vv3qn: exact-entry admission and configured-store cron preparation both failed before the fix with DataCloneError (136 ms / 32 ms).
  • Fetched main first and verified that it contains f5e5f75f2b775adef5fd87f5cd5d5017fe2d086b (refactor(config): deslop config fifth pass #161076). One rebase onto 88e0f4ac3acc0539ff05b144d8a452ebde3c4e9e preserves that rewrite: the worker differs from main by only two environment-normalization assignments inside readRequest. The shared database/reply boundary, direct reader returns, and removed wrappers remain as main defines them. Package JSON retains main plus the focused Windows test target.
  • Candidate 9f63c38245d962c3b762f28f579c306df742217e, tested tree 803cab09db8a2ff82600dcac4456b3f6213f4b15. Fresh proof ran on Linux Blacksmith Testbox run 36554368452, lease tbx_01m3pahxwxz4z19pfcrrq44v8s, with physical cwd and source SHA-256 checks.
  • All 45 unique touched/importer files ran once through node scripts/run-vitest.mjs: 741 passed, one existing skip, six project groups in 295.59 seconds. This includes both Windows-shaped Proxy transports, general cron preparation, worker error/cleanup behavior, storage snapshots, and the Windows planner/importer. No individual test exceeded 30 seconds.
  • Fresh direct-route independent Codex review at P1 is scoped-clean, with no actionable P0/P1 findings. It specifically reviewed integration with refactor(config): deslop config fifth pass #161076's shared worker dispatch.
  • node scripts/check-changed.mjs ran on Testbox. The earlier feat: connect Agents API sessions to HTTP MCP servers #160931 SDK surface-budget failure now passes on this fetched base; no baseline was edited. Core types, all 27 core test-type shards, script types, formatting, ratchets, dead-export scans, and other preceding guards passed. Core lint reported one inherited max-lines error: ui/src/pages/model-setup/model-setup-page.ts, 705/700. That file and .oxlintrc.json are byte-identical to the tested main base. Every subsequent selected check passed separately on the same verified tree, including script lint (0 warnings / 0 errors across 1,256 files), schema, storage, media, runtime-sidecar, import-cycle, webhook, and pairing guards. The full gate is recorded as failed on inherited lint, not as a clean pass.
  • Immediately before publication, fetched main again to a1ec6f7f4e1de7f2f27b52055096020f541b194f. git merge-tree --write-tree origin/main HEAD exited 0 without conflicts and produced tree bb4c2c36017791d0191fb46d98104d5b23cffee7. The reviewed/tested candidate was not changed after validation.
  • Final diff: production +48/−9 lines; tests +102/−2; tooling/package +9/−4. No dependency, configuration, schema, suppression, or baseline changes. Human contributor credit is retained.
  • Native Windows Testbox execution is unavailable; the focused regression remains in normal Windows push CI. No dispatches or reruns were requested. Auto-merge remains enabled; the maintainer owns the pinned-head landing.

CI classification: run 36397803629

Inspected the exact tested merge 9e8c473d2a0356d0e3fbe4e8d76f01093aceeddb (PR head b74b8f91a9224455e409634c2d03bc1f33fcf770, base 40019980f2687648942b0788fb8523fef58ff7ff). Its tree is identical to the PR head: 5a272aa3e1b254465c9133e072f02f530e38d16a.

Both actual Node test failures are inherited from scheduled main c7f4733f33a90442f7ddf5abea7b647c8e4dbd14, run 36399583824:

  • Reply recovery: main job 108854461248, shard core-runtime-infra-storage-state-hosted-28, has the same 120-second timeouts and retryRestartAbortedMainSessionRecovery called twice instead of once in reply-turn-admission.recovery.test.ts. That test has the same Git blob on the PR, its exact main base, and this failing main run. The PR failure belongs to core-runtime-infra-storage-state-hosted-13, not the Doctor shard.
  • Heartbeat: main job 108854461125, shard core-runtime-infra-heartbeat-runner-hosted-1, fails the identical does not infer admission rejection from a replacement run after an empty heartbeat assertion (failed versus ran). Its test blob is also unchanged.

The Doctor shard passed all 282 tests. Its foreign_key_check warning comes from the schema-preparation fixture deliberately inserting an orphan row and asserting refusal. The agents-support shard passed 420 tests (3 existing skips); engine cleanup failed is deliberately thrown by its disposal-failure fixtures, separate from the heartbeat assertion. All five Windows jobs in the PR run succeeded.

Replayed the recorded recovery and heartbeat group plans on Linux Blacksmith Testbox, lease tbx_01m3kmfsqvfq50g0x3yt939j14, with the exact merge tree and source hashes verified. Recovery passed once (635 passed, 1 skipped; 350.95 seconds); this does not establish a fix for its intermittent main failure. Heartbeat reproduced the identical failure (111 passed, 1 failed; 162.38 seconds). The lease is stopped.

No source change or fix push resulted from this classification. Auto-merge remains enabled. The separate CI compiler-sharing error was outside this investigation.

@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@steipete
steipete marked this pull request as ready for review September 28, 2026 03:44
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 29, 2026, 9:46 AM ET / 13:46 UTC (Revision 14).

ClawSweeper review

What this changes

The branch captures cloneable storage-environment facts before session worker requests, restores Windows environment lookup inside the worker, and adds regression and Windows CI coverage.

Regression provenance

Possible regression — suspected (failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still has the Windows worker-transfer defect, and native Windows evidence supports this repair. The PR remains useful, but its closing reference would prematurely close a broader issue with separately reported symptoms.

Priority: P1
Reviewed head: db18dac33d4a189759c54d5d09a01c79a67fbf9e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair has strong worker and native Windows evidence, with one PR-body issue-scope correction remaining before merge.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body reports a failing pre-fix and passing after-fix real session-worker transport run on Linux with a Windows-shaped Proxy; a native Windows 11 source-built comparison also reports repaired cron, configured-store, and webchat behavior on an earlier PR head. The pinned introduced code covers those request boundaries; the final merge head was not separately run on native Windows. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports a failing pre-fix and passing after-fix real session-worker transport run on Linux with a Windows-shaped Proxy; a native Windows 11 source-built comparison also reports repaired cron, configured-store, and webchat behavior on an earlier PR head. The pinned introduced code covers those request boundaries; the final merge head was not separately run on native Windows. No stored-data contract changes.
Evidence reviewed 10 items Introduced exact-entry transport: The PR captures storage facts before constructing the exact-entry worker request.
Introduced discovery transport: Both configured-store discovery request builders capture the environment before worker dispatch.
Windows semantics in worker: The worker restores case-insensitive environment lookup for store-target and exact-entry reads.
Findings None None.
Security None None.

How this fits together

Cron preparation and Gateway session admission read session rows through a shared worker. The caller supplies a session target and storage context; the worker locates the SQLite store and returns session facts or an error.

flowchart LR
A["Cron or chat request"] --> B["Session target"]
B --> C["Capture storage facts"]
C --> D["Worker transport"]
D --> E["Store discovery and SQLite read"]
E --> F["Session facts or error"]
Loading

Before merge

Agent review details

Security

None.

PR surface

Source +39, Tests +100, Config 0, Other +5. Total +144 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 48 9 +39
Tests 3 102 2 +100
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 1 8 3 +5
Total 9 159 15 +144

Review metrics

Metric Value Why it matters
Runtime and regression growth production +48/−9 lines; tests +102/−2 lines The added runtime boundary handling is paired with worker and cron regressions, as stated in the PR body.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #157067
Summary: This PR is a candidate fix for the precisely identified Windows worker-transfer defect; the broader cron report overlaps but also describes separate behavior.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Narrow the closing reference (recommended)
    Change the broader issue's PR-body reference to non-closing syntax so this focused repair can land without retiring separate work.

Technical review

Best possible solution:

Land the worker transport repair through the normal exact-head gates while keeping the broader cron report available for its distinct symptoms.

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

Yes for the worker defect: current-main source exposes the Proxy transfer, and the supplied native Windows comparison shows the affected flows failing before the repair and succeeding afterward. The broader linked report's distinct symptoms have not all been reproduced through this patch.

Is this the best way to solve the issue?

Yes for the demonstrated defect: capture cloneable storage facts at the worker boundary and restore Windows lookup semantics in the worker. The linked issue closure must match that narrower scope.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported Windows failures block scheduled agent work and session admission on affected installations.
  • merge-risk: 🚨 other: The PR body's closing reference could retire a report containing unresolved behavior outside this patch.
  • 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 (terminal): The PR body reports a failing pre-fix and passing after-fix real session-worker transport run on Linux with a Windows-shaped Proxy; a native Windows 11 source-built comparison also reports repaired cron, configured-store, and webchat behavior on an earlier PR head. The pinned introduced code covers those request boundaries; the final merge head was not separately run on native Windows. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports a failing pre-fix and passing after-fix real session-worker transport run on Linux with a Windows-shaped Proxy; a native Windows 11 source-built comparison also reports repaired cron, configured-store, and webchat behavior on an earlier PR head. The pinned introduced code covers those request boundaries; the final merge head was not separately run on native Windows. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit dbd3bf7 adds src/config/sessions/transcript-target-binding.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dbd3bf7da26b; files: src/config/sessions/transcript-target-binding.ts)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Replace the broader issue's closing reference with a non-closing reference.

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 (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-28T12:08:51.364Z sha 82fb83c :: blocked before merge. :: none
  • reviewed 2026-09-28T14:45:02.655Z sha 19948dc :: blocked before merge. :: none
  • reviewed 2026-09-28T15:37:35.412Z sha b5d0b78 :: blocked before merge. :: none
  • reviewed 2026-09-29T06:01:22.511Z sha 4710cc9 :: blocked before merge. :: none
  • reviewed 2026-09-29T07:39:32.423Z sha 4fd4b77 :: blocked before merge. :: none
  • reviewed 2026-09-29T10:16:09.261Z sha 4f3397d5b9a772699c59658648afc9da64129380 :: blocked before merge. :: none
  • reviewed 2026-09-29T11:10:59.286Z sha 9f63c38 :: blocked before merge. :: none
  • reviewed 2026-09-29T11:51:00.442Z sha 888f9e1 :: blocked before merge. :: none

@steipete
steipete enabled auto-merge (squash) September 28, 2026 04:18
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Sep 28, 2026
@steipete
steipete force-pushed the upd/cron-dataclone-env-proxy branch from b5d0b78 to 4710cc9 Compare September 29, 2026 05:53
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 29, 2026
steipete added a commit that referenced this pull request Sep 29, 2026
Consolidate equivalent embedded-runner projections and owner helpers, remove unused plumbing, and simplify redundant branches while preserving run authority, cancellation, prompt/transcript bytes, tool policy, transport shaping, and usage accounting. Production change: 361 added / 1,002 removed, net -641 lines.

Preserve real model-selection exports in the command test mock. Missing provider maps return undefined on both main and the refactor; the legacy automatic fallback still wins over the colliding alias. Keep the unchanged collision configuration in the existing fixture helper to satisfy the line-cap ratchet.

Validation: main/PR comparison with model-selection fully unmocked; 138 command tests; all 20 facade-mocking siblings plus embedded runner tests (355 files / 5,827 tests); final check-changed; independent autoreview through P2. No production behavior change is claimed.

Related: #159597

Exact-head CI exception: checks-node-compact-small-18 has the same two sparse-runner missing-prerequisite failures as unrelated PR #160075 run 36528303180. All other execution jobs passed or skipped. See PR Evidence.
@steipete
steipete force-pushed the upd/cron-dataclone-env-proxy branch from 4fd4b77 to 4f3397d Compare September 29, 2026 10:08
steipete and others added 4 commits September 29, 2026 03:13
Capture plain storage environment facts before exact-entry and store-discovery
worker dispatch, and restore platform lookup semantics inside the worker.
Reuse the storage environment owner while copying only its routing inputs.

Cover admission and configured-store cron preparation with the Windows env
Proxy through real worker transport, and include the regressions in Windows CI.

Closes #157067
Closes #159339
Refs #157109 #157348

Co-authored-by: Aniket Kumar <[email protected]>
Co-authored-by: Yashas Prakash <[email protected]>
Move the Windows environment Proxy cases into their own suite and point the Windows CI target at that owner. Await the asynchronous database admission claim release during test cleanup.

Validation: separate local runs passed 2 storage-environment tests and 13 preparation tests; oxfmt, focused type-aware lint, and P1 review passed.
Normalize planner sums to their recorded tenth-second precision so floating-point drift does not turn 424 seconds into 425. Keep the Windows inventory and budget unchanged.

Restore platform environment semantics directly on each worker-owned request, removing redundant envelope copies and keeping the worker within its line cap.
@steipete
steipete force-pushed the upd/cron-dataclone-env-proxy branch from 4f3397d to 9f63c38 Compare September 29, 2026 11:02
@jonathanlindsay

Copy link
Copy Markdown
Contributor

Native Windows result for this PR's head, since the body notes native Windows execution was unavailable.

Setup. Windows 11 (10.0.26200), Node 24.21.0. Each build from source with pnpm install --frozen-lockfile and pnpm build qaRuntime, run from its checkout. Fresh state per run, stock config except a loopback gateway with token auth and a stub OpenAI-compatible provider. Each case ran twice: first on a new session, then on an existing one.

Build isolated agentTurn cron session:<id> cron webchat chat.send openclaw status
2026.9.6 npm (eb377ac) DataCloneError, 50 to 290 ms DataCloneError ok ok
main 9c1b417 (this PR's base) ok ok WorkerTaskError: DataCloneError, 59 to 126 ms ok
main 9c1b417 with session.store set DataCloneError DataCloneError DataCloneError ok
this PR, 4f3397d5 ok ok ok ok
this PR, 4f3397d5, with session.store set ok ok ok ok
release/2026.9.7 62cf2f9 ok ok WorkerTaskError: DataCloneError, 89 ms and 2.9 s ok
release/2026.9.7 62cf2f9 with session.store set DataCloneError DataCloneError DataCloneError not run

On this PR's head there are zero could not be cloned lines in the gateway output or the runtime log across all 14 turns, with both store layouts. The chat.send failure is the diagnostic line message processed: channel=webchat ... outcome=error ... error="WorkerTaskError: DataCloneError: #<Object> could not be cloned.". On 2026.9.6 the same send completes, so on Windows this is a new failure after 2026.9.6.

About 2026.9.7. release/2026.9.7 was cut from main before this PR. On native Windows it fixes the default-store cron failure but brings in the webchat chat.send failure above, so a default Windows install would move from failing automations to failing Control UI chat. Could this PR, or its four production source files, go onto release/2026.9.7 before it ships?

openclaw status (text and --json) exited 0 everywhere it ran in this setup (on 2026.9.6, this PR and release/2026.9.7 also after the sessions above existed), so we could not reproduce the status reports in the issue.

RomneyDa added a commit that referenced this pull request Oct 1, 2026
* fix(sessions): restore Windows cron setup and session admission (#160075)

Windows cron isolated-agent runs and session transcript discovery failed with DataCloneError because the request carried the Windows process-environment proxy into the transcript worker. Exact-entry and discovery requests now capture a plain, bounded storage environment and the worker restores Windows lookup semantics.

Closes #157067. Closes #159339. Supersedes #157109 and #157348 (closed with credit).

Landed under the pre-existing-red rule (#161124 and session-store main reds).

(cherry picked from commit a181c3f)

* fix(codex): avoid browser auth in CUA readiness (#162467)

(cherry picked from commit 9f9dab3)

* chore(release): prepare 2026.9.7-1

* chore(release): prepare 2026.9.8

* fix(gateway): normalize quiescence recovery diagnostics

Keep the retained watchdog recovery error consistent with the single-line
workspace sync error surfaced to operators on single-digit days. Preserve
raw ps start identities for signal guards and existing watchdogs.

Make the existing exhaustion regression calendar-independent with padded
lstart input, retaining the exact recoveryError assertion and proving
that all stopped workers resume after process probes recover.

Verified the original UTC failure and the deterministic pre-fix failure.
The full quiescence script file passes under UTC, the exact regression
passes in the default timezone, and 15 sibling tests pass. Core typecheck,
formatting, diff checks, and independent review also pass.

---------

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

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. 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. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

2 participants