Skip to content

fix: bound Workshop turn lookup on large sessions - #193544

Merged
steipete merged 5 commits into
mainfrom
fix/193492-bounded-workshop-context
Nov 5, 2026
Merged

steipete merged 5 commits into
mainfrom
fix/193492-bounded-workshop-context

Conversation

@steipete

@steipete steipete commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #193492.

What Problem This Solves

Skill Workshop can exhaust a transcript worker while looking up the requester and model of a completed, tool-heavy turn.

User Impact

Background reviews prepare long turns through one bounded lookup with explicit tool-result omission. The completed-turn anchor, initiating sender policy, model selection, cancellation, and refusal when the initiating input is unavailable remain intact. The actual review window and incomplete-evidence warning are unchanged.

There is no public SDK contract change: omitted limits still return the full selected context. Full replay and reconciliation callers retain their existing behavior.

Why This Change Was Made

The final attempt in the old requester lookup read the whole model context. Replace the escalating attempts with one 8 MiB / 20,000-event read using toolResultOverflow: "omit". All six other unbounded callers were audited again and intentionally need complete reconstruction or reconciliation; no shared ceiling or new full-read sentinel is needed.

Thanks to @dengsc525 for the report and bounded-reader experiment.

Evidence

  • Existing main proof (6d49ef1c): real readSessionForkTurn failed with ERR_WORKER_OUT_OF_MEMORY on 492.1875 MiB of synthetic result text under the production 512/32 MiB worker limits. Subsequent bounded and small reads recovered in the same process. This baseline evidence is reused; the lookup source is unchanged on current main.
  • Fresh final-head proof: rebuilt the 2,800-tool-pair / 492.1875 MiB synthetic fixture; the real fork lookup and subsequent bounded/small reads passed in 97.19 s. Peak whole-process RSS was 1,773,109,248 bytes; the parent heap was capped at 1 GiB and transcript workers retained production limits.
  • Committed regression: the fork lookup fails on main's implementation (2 cases, 9.35 s test-project time / 28 s wrapper), then passes with this fix. The existing reader test also confirms that omitted limits return the complete context above 8 MiB; bounded suffix/decompression assertions remain.
  • Final focused suites: 69 tests passed across fork policy, reader limits, memory lifecycle, and worker continuation (220.99 s total). Reader limits took 34.21 s including transforms; its compatibility assertion took 1.02 s and the two fork cases took 0.91/0.88 s.
  • Core and session-test types, scoped lint, formatting, docs links (16,411, zero broken), and baseline ratchets including line-cap passed. No baseline ceilings changed.
  • Independent Codex autoreview: base 6d49ef1c through head daf081987420f13e7a9ea57790e4f3fdb2522149, scoped-clean through P2, no findings.
  • Prior live Workshop proof is explicitly reused: the fork implementation, Gateway adapter, bounded review window, numeric-limit path, and incomplete-evidence warning are unchanged. The isolated Gateway, real 30-second service scheduler, and Ollama qwen2.5:7b completed the callback successfully in 58.519 s with work counts returning to zero. The completed-turn event was synthetic; inference and settlement were real. This proves review execution, not successful skill authoring.

ClawSweeper reviewed exact head daf081987420f13e7a9ea57790e4f3fdb2522149: ready for maintainer review, Findings None, Before merge None.

CI remains pending in run 42076119496: 33 observed jobs passed and 25 skipped; the only queued job is checks-node-changed-compact-large-15. It requests blacksmith-32vcpu-ubuntu-2404 and has no assigned runner. Preflight and build prerequisites passed. No CI failure was observed and no rerun was requested. The prior head's scheduled-child-extra-automations failure remains prior-head evidence, not a claimed fix or a recurrence on this head. Do not treat the pending CI gate as green.

The prior Goal-authority CI repair is retained: assert structured forbidden status while preserving the later revocation and delivery checks. No permission policy changed.

Production: 38 additions / 41 deletions (net -3). Tests: net zero. Docs: net +5. No test allocation or ceiling changes.

Local proof is macOS arm64 with Node 26.12.1 and pinned OpenClaw Bun. Linux coverage is left to PR CI. Extremely large explicitly full reads retain their existing memory cost and can exhaust their worker; cold navigation also still scales with row count. This change bounds the one background lookup, not every possible transcript read.

Reject oversized implicit full model-context reads before payload hydration and keep anchored fork requester lookup bounded with explicit tool-result omissions. Preserve exact small reads and fail visibly when initiating input is outside the bounded window.

Fixes #193492. Thanks to @dengsc525 for the worker exhaustion report.
@clawsweeper

clawsweeper Bot commented Nov 5, 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 docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: S labels Nov 5, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Bounds the forked-turn requester and model lookup to 8 MiB and 20,000 events, with explicit tool-result omission.

Example: A completed turn contains 2,800 tool pairs and 492.1875 MiB of synthetic result text.

  • Before: The unlimited lookup exhausts the transcript worker.
  • After: The reported final-head bounded lookup succeeds without changing transcript contents.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with no blocking findings, supported by reported stress recovery, reused Gateway execution, and compatibility regressions; the large-session and full-lifecycle evidence are separate scenarios.
Proof confidence 🐚 platinum hermit (4/6) Maintainer-authored PR outside the ordinary contributor proof gate: the body reports final-head real-worker lookup success on macOS arm64 with production worker limits and reuses unchanged isolated-Gateway scheduler/Ollama settlement evidence; the inspected alternate-candidate screenshot corroborates only the failure mechanism.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Automatic Skill Workshop reviews repeatedly fail while preparing large, tool-heavy sessions.
Reason: The failure is concrete, the repair reuses existing bounded-reader support, and maintainer authorship settles the documented bounded-refusal tradeoff.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a concrete background-review failure without retaining the earlier foreground compatibility regression; no blocking defects found, and current-head CI remains pending.

Priority: P2
Reviewed head: daf081987420f13e7a9ea57790e4f3fdb2522149

Before merge

None.

Findings

None.

Agent review details

How this fits together

Skill Workshop passes a completed-turn anchor through the plugin Gateway adapter to the shared fork owner, which derives requester and model facts before admitting a bounded background review.

flowchart LR
  A[Completed turn] --> B[Workshop scheduler]
  B --> C[Plugin Gateway adapter]
  C --> D[Bounded requester lookup]
  D --> E[Transcript worker]
  D --> F[Source policy checks]
  F --> G[Hidden review and settlement]
Loading

Technical review

Best possible solution:

Use the existing bounded projection for fork lookup while preserving full-context reader semantics and refusing unavailable requester evidence.

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

Current-main source reaches an unlimited worker read before bounded review execution, supported by reported real-worker OOM results; this read-only review executed no reproduction.

Is this the best way to solve the issue?

The final patch is the smallest complete production repair: one bounded read through the existing projection owner, preserving anchor, cancellation, requester policy, and unrelated full-context consumers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0af74c76da98.

Provenance checked

  • Fork requester lookup and adapter refusal changes intended behavior with a stated reason (def6349: Discover the initiating requester across long tool loops, skip steering inputs, and refuse when requester evidence is unavailable.)
  • Public model-context reader contract keeps the original intent (83f9484: Optional limits bound model views while omitted limits retain existing full-context behavior.)
  • Reader payload and compatibility regressions keeps the original intent (1787e78: Avoid redundant decompression while preserving selected context and pre-hydration bounds.)
  • Workshop review window keeps the original intent (9a6c6b1: Keep background inference bounded and avoid competing with interactive provider capacity.)
  • Goal authority regression assertion keeps the original intent (9e86c84: Preserve restricted delegated returns and reject revoked effects; the revised assertion checks structured denial while retaining downstream effect checks.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit def6349 adds src/agents/session-fork-run.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: def63496ca8f; files: src/agents/session-fork-run.ts)
  • Peter Steinberger: Raw commit 9a6c6b1 adds docs/tools/self-learning.md:62 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9a6c6b1d0d14; files: docs/tools/self-learning.md)

PR surface

Source -3, Tests 0, Docs +5. Total +2 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 38 41 -3
Tests 2 19 19 0
Docs 2 7 2 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 64 62 +2

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +38/-41; tests +19/-19 The bounded lookup removes escalating attempts without introducing another owner or test scaffolding.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Repeated transcript-worker exhaustion prevents background learning on large sessions without establishing a foreground outage.
  • merge-risk: 🚨 compatibility: Forked-turn preparation now refuses initiating inputs outside its bounded window; the maintainer-authored change explicitly accepts and documents that behavior while preserving the public full-read contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-05T15:18:38.483Z sha a3c279f :: needs changes before merge. :: [P2] Document the new ceiling in the public SDK contract
  • reviewed 2026-11-05T15:49:10.722Z sha 2ea2054 :: needs changes before merge. :: [P1] Migrate foreground callers before enforcing the implicit ceiling
  • reviewed 2026-11-05T16:14:54.348Z sha 31fd930 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-05T16:41:42.468Z sha c185592 :: needs maintainer review before merge. :: none

Reviewed November 5, 2026, 12:41 PM ET / 17:41 UTC (Revision 5).

@steipete
steipete marked this pull request as ready for review November 5, 2026 15:36
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T17:37:33.810020Z daf0819 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3c279fa12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +88 to +90
throw new RangeError(
"Model context exceeds the implicit 8 MiB / 20000-event limit; pass explicit context limits.",
);

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.

P1 Badge Migrate foreground worker callers before enforcing the read cap

For admitted cloud-worker turns whose retained context exceeds 8 MiB or 20,000 events, this guard now prevents foreground execution: readWorkerTurnInputContext in src/gateway/worker-environments/worker-turn-user-message.ts still calls openModelContextAsync without explicit limits. executeWorkerTurn awaits that read before preparing the model or launching the worker, with no context-size recovery on this path, so subsequent turns in an otherwise usable session fail with this internal RangeError. Update those foreground callers to choose appropriate explicit limits as part of this cutover rather than making the background-review protection disable foreground conversations.

AGENTS.md reference: AGENTS.md:L52-L52

Useful? React with 👍 / 👎.

@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. and removed P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Nov 5, 2026
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
Keep the bounded Workshop requester lookup while restoring the public omitted-limits contract. Remove the implicit ceiling and null opt-ins; exercise the fork reader and full-context compatibility through existing regressions.
@steipete steipete changed the title fix: prevent background review worker exhaustion on large sessions fix: bound Workshop turn lookup on large sessions Nov 5, 2026
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@steipete
steipete merged commit 04d809b into main Nov 5, 2026
133 of 136 checks passed
@steipete
steipete deleted the fix/193492-bounded-workshop-context branch November 5, 2026 18:21
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
* fix: bound background transcript context reads

Reject oversized implicit full model-context reads before payload hydration and keep anchored fork requester lookup bounded with explicit tool-result omissions. Preserve exact small reads and fail visibly when initiating input is outside the bounded window.

Fixes openclaw#193492. Thanks to @dengsc525 for the worker exhaustion report.

* docs: explain implicit model context limits

* fix: preserve explicit full transcript replay

* test: assert Goal return denial by status

* fix: preserve full model context reads outside background lookup

Keep the bounded Workshop requester lookup while restoring the public omitted-limits contract. Remove the implicit ceiling and null opt-ins; exercise the fork reader and full-context compatibility through existing regressions.
wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 6, 2026
* fix: bound background transcript context reads

Reject oversized implicit full model-context reads before payload hydration and keep anchored fork requester lookup bounded with explicit tool-result omissions. Preserve exact small reads and fail visibly when initiating input is outside the bounded window.

Fixes openclaw#193492. Thanks to @dengsc525 for the worker exhaustion report.

* docs: explain implicit model context limits

* fix: preserve explicit full transcript replay

* test: assert Goal return denial by status

* fix: preserve full model context reads outside background lookup

Keep the bounded Workshop requester lookup while restoring the public omitted-limits contract. Remove the implicit ceiling and null opt-ins; exercise the fork reader and full-context compatibility through existing regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Bug]: Skill Workshop experience review reads unbounded model context and exhausts transcript worker on large sessions (2026.10.10)

1 participant