Skip to content

fix(sessions): capture plain env object for exact-entries worker request - #157109

Closed
aniketkrs wants to merge 1 commit into
openclaw:mainfrom
aniketkrs:fix/session-exact-entries-proxy-env
Closed

aniketkrs wants to merge 1 commit into
openclaw:mainfrom
aniketkrs:fix/session-exact-entries-proxy-env

Conversation

@aniketkrs

Copy link
Copy Markdown
Contributor

Fixes #157067

What Problem This Solves

On native Windows, isolated AgentTurn cron setup fails before inference: the exact-session-entry worker request carries input.env straight from cloneEnvWithPlatformSemantics, which returns a Proxy on Windows. worker.postMessage cannot structured-clone a Proxy, so setup dies with DataCloneError and the automation backs off without ever creating a session. The reporter observed seven consecutive setup failures.

User Impact

Windows users with isolated cron automations get silent cron-setup failures (no inference session, just backoff plus error). Linux and macOS are unaffected.

Why This Change Was Made

The sibling readRowFacts reader already captures env: { ...input.env } into a plain object before posting to the worker. This change applies the same established pattern to readExactEntries, the one reader still passing the Proxy through. The fix sits at the reader layer rather than in captureSessionEntryReadScope on purpose: the Proxy carries Windows platform semantics other code paths rely on, so we only flatten at the worker boundary.

Evidence

  • Before (main): readExactEntries built the worker message as ({ kind: "session-exact-entries", ...input }) with no env capture. Issue [Bug]: Windows isolated cron setup passes an uncloneable environment Proxy to session history worker #157067 reproduces via structuredClone({ kind: "session-exact-entries", env }) where env is the Proxy, which throws DataCloneError.
  • After (this branch): the message is built from captured = { ...input, env: { ...input.env } }; spreading a Proxy yields a plain object, which structured-clones cleanly.
  • SessionExactEntriesWorkerInput.env is required (NodeJS.ProcessEnv), so the spread cannot introduce an undefined env.
  • Linux/macOS behavior is unchanged: env values are identical, only the container changes from Proxy to plain object.

Copilot AI lite review requested due to automatic review settings September 24, 2026 07:04
@clawsweeper

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

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@clawsweeper clawsweeper Bot added 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 24, 2026, 8:50 AM ET / 12:50 UTC (Revision 3).

ClawSweeper review

What this changes

The branch adds a session-history reader module that copies the environment into a plain object before requesting exact session entries from a worker.

Merge readiness

⛔ Blocked before merge - 7 items remain

The linked Windows failure remains in the active reader on current main. This PR contains the narrow repair, but its new module is unused at the pinned head and cannot supply that repair as submitted.

Priority: P1
Reviewed head: 25b6e52cdfd4d2acf49f266d5796cd6a75a4498f

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The reported repair mechanism has useful Windows evidence, but this branch does not change its active runtime path and has unresolved imports.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The linked reporter observed a successful exact-entry worker read and progress through cron preparation on a locally rebuilt v2026.9.6 repair. That is useful real Windows evidence, but it does not exercise this PR's unregistered new module or show an after-fix result from this branch. A redacted PR-build worker and cron-setup trace would close the gap; redact private environment values, addresses, keys, and endpoints before posting. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. 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 🧂 unranked krab (1/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The linked reporter observed a successful exact-entry worker read and progress through cron preparation on a locally rebuilt v2026.9.6 repair. That is useful real Windows evidence, but it does not exercise this PR's unregistered new module or show an after-fix result from this branch. A redacted PR-build worker and cron-setup trace would close the gap; redact private environment values, addresses, keys, and endpoints before posting. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. 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 patch: The pinned PR delta adds the entire reader module; its exact-entry method captures a plain environment at lines 282–289.
Active PR-head path: At the pinned head, the runtime still defines readExactEntries itself and sends input.env without copying it; it does not call the newly added reader module.
Current main path: Main now registers a reader module, but its exact-entry method still spreads input without converting the environment to plain data. The branch's four-line repair remains useful after integration into this active method.
Findings 2 actionable findings [P1] Apply the capture to the registered exact-entry reader
[P1] Remove the added module's unresolved imports
Security None None.

How this fits together

Isolated cron setup reads session entries through the session-history worker before an agent turn can proceed. The reader sends the request and its environment to the worker, which returns the stored entries.

flowchart LR
  A[Isolated cron setup] --> B[Session entry reader]
  B --> C[Capture environment]
  C --> D[Worker request]
  D --> E[Session database]
  E --> F[Stored entries]
  F --> G[Agent turn preparation]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The linked reporter observed a successful exact-entry worker read and progress through cron preparation on a locally rebuilt v2026.9.6 repair. That is useful real Windows evidence, but it does not exercise this PR's unregistered new module or show an after-fix result from this branch. A redacted PR-build worker and cron-setup trace would close the gap; redact private environment values, addresses, keys, and endpoints before posting. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. 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.
  • Apply the capture to the registered exact-entry reader (P1) - The added method is never called at this head: the runtime still owns readExactEntries and passes input.env into the worker request. On Windows that remains the reported uncloneable Proxy, so the isolated cron failure is unchanged. Move this capture into the active reader when updating the branch against main.
  • Remove the added module's unresolved imports (P1) - At the pinned head, the imported prepared-input type, row-facts constant, and read-error decoder are absent from their source modules. The new TypeScript file therefore has unresolved contracts even though it is not registered. Rebase onto the current reader and retain only the targeted repair.
  • Resolve merge risk (P1) - The PR is currently reported as conflicting with main's reader extraction; a refreshed branch and merge result are needed before its repair can be evaluated for landing.
  • Complete next step (P2) - Rebase onto current main, put the environment capture in the active exact-entry reader, resolve the module contracts, and provide redacted real Windows proof from the PR build.
  • Improve patch quality - Rebase and apply the small environment capture in main's registered exact-entry reader.
  • Improve patch quality - Show a redacted after-fix exact-entry worker read and isolated cron setup using the PR build.

Findings

  • [P1] Apply the capture to the registered exact-entry reader — src/config/sessions/session-transcript-worker-readers.ts:282-289
  • [P1] Remove the added module's unresolved imports — src/config/sessions/session-transcript-worker-readers.ts:4-11
Agent review details

Security

None.

PR surface

Source +407. Total +407 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 407 0 +407
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 407 0 +407

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #157067
Summary: The linked issue reports the exact Windows worker-transfer failure this PR attempts to repair.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Put the plain-environment capture in the registered exact-entry reader, preserve Windows environment semantics inside the worker, and cover the worker request through isolated cron preparation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Put the plain-environment capture in the registered exact-entry reader, preserve Windows environment semantics inside the worker, and cover the worker request through isolated cron preparation.

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

Yes. The linked report supplies a native Windows failure trace and local repair observation, while current main still sends the Proxy through the exact-entry path; this review did not execute current main on Windows.

Is this the best way to solve the issue?

Yes, after moving the capture into the registered reader. Copying the environment at the worker boundary matches the existing row-facts pattern without changing the environment helper.

Full review comments:

  • [P1] Apply the capture to the registered exact-entry reader — src/config/sessions/session-transcript-worker-readers.ts:282-289
    The added method is never called at this head: the runtime still owns readExactEntries and passes input.env into the worker request. On Windows that remains the reported uncloneable Proxy, so the isolated cron failure is unchanged. Move this capture into the active reader when updating the branch against main.
    Confidence: 0.98
  • [P1] Remove the added module's unresolved imports — src/config/sessions/session-transcript-worker-readers.ts:4-11
    At the pinned head, the imported prepared-input type, row-facts constant, and read-error decoder are absent from their source modules. The new TypeScript file therefore has unresolved contracts even though it is not registered. Rebase onto the current reader and retain only the targeted repair.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4d69dd020015.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The linked native Windows report shows isolated cron jobs repeatedly failing during session setup before inference.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦐 gold shrimp and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The linked reporter observed a successful exact-entry worker read and progress through cron preparation on a locally rebuilt v2026.9.6 repair. That is useful real Windows evidence, but it does not exercise this PR's unregistered new module or show an after-fix result from this branch. A redacted PR-build worker and cron-setup trace would close the gap; redact private environment values, addresses, keys, and endpoints before posting. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. 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

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-24T07:10:15.335Z sha 25b6e52 :: needs real behavior proof before merge. :: [P1] Apply the env capture to the active exact-entry reader | [P1] Restore the contracts required by the new reader module
  • reviewed 2026-09-24T08:39:31.569Z sha 25b6e52 :: needs real behavior proof before merge. :: [P1] Apply the env capture to the active exact-entry reader | [P1] Remove or supply the new module's missing contracts

@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(sessions): capture plain env object for exact-entries worker request This is item 1/3 in the current shard. Shard 76/89.

This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

Copy link
Copy Markdown
Contributor

Thanks, @aniketkrs, for the exact-entry environment Proxy investigation and proposed repair. I’ve carried the finding forward in #160075, which covers both the registered exact-entry reader and the earlier session-store discovery transport, with real-worker regression proof. You’re credited in the PR body and commit. Closing this overlapping PR so review and the pending native Windows CI validation can continue in one place.

@steipete steipete closed this Sep 28, 2026
steipete added a commit that referenced this pull request Sep 29, 2026
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]>
steipete added a commit that referenced this pull request Sep 29, 2026
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]>
steipete added a commit that referenced this pull request Sep 29, 2026
)

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).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…claw#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 openclaw#157067. Closes openclaw#159339. Supersedes openclaw#157109 and openclaw#157348 (closed with credit).

Landed under the pre-existing-red rule (openclaw#161124 and session-store main reds).
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

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. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows isolated cron setup passes an uncloneable environment Proxy to session history worker

3 participants