Skip to content

[Feature]: Add a supported context budget / skip policy for Skill Workshop Experience Review on oversized sessions - #159687

Open
sprintberlin wants to merge 7 commits into
openclaw:mainfrom
sprintberlin:fix/workshop-oversized-review-budget
Open

sprintberlin wants to merge 7 commits into
openclaw:mainfrom
sprintberlin:fix/workshop-oversized-review-budget

Conversation

@sprintberlin

@sprintberlin sprintberlin commented Sep 27, 2026 •

Copy link
Copy Markdown

Closes #150238

What Problem This Solves

Fixes: Skill Workshop Experience Review dies on an oversized assembled prompt when one foreground turn contains too much tool output, even if the source session itself is well inside its context window. Until now there was no supported budget or skip policy for that review.

User Impact

Operators can configure a review guard:

  • skills.workshop.autonomous.maxReviewContextBytes bounds context acquisition before assembly.
  • skills.workshop.autonomous.maxReviewContextTokens caps the assembled review prompt below the model window.
  • skills.workshop.autonomous.overflowPolicy selects skip (default once any guard is set) or fail.

With a guard configured, an oversized detached review is rejected whole before provider dispatch and recorded as skipped with an oversized-request reason. It does not spend a provider call and it does not fail as Agent couldn't generate a response. Set overflowPolicy: "fail" to surface the same rejection as a failure.

Installations that configure no guard keep the exact previous review path: unlimited context acquisition, no pre-dispatch admission check, no change to any review outcome. Upgrading never silently changes review behavior.

Ordinary foreground sessions keep their existing compaction and recovery behavior in all cases.

Why This Change Was Made

The review was loading the full retained model context and then admitting a prompt that preflight already knew could not fit. A shortened selection would drop earlier requirements and tool evidence, so a configured guard does not do that.

  • With maxReviewContextBytes set, context admission uses overflow: "reject" plus a 10,000-event cap: only the complete retained context is admitted, and exceeding the bound rejects the whole review before assembly.
  • With any guard set, the assembled prompt is checked against the effective context budget before submission. Checkpoint or preemptive pressure that is not fits stops provider submission for a review-owned run.
  • skipped is reserved for that pre-dispatch rejection. A provider context_overflow after dispatch stays a failed review: no compaction retry, failover, or model rotation.
  • Accepted configuration values align with runtime limits: maxReviewContextTokens is constrained to 1024..2,000,000 and maxReviewContextBytes to 1024..268,435,456 (256 MiB) in both schema and resolver, rejecting out-of-range values instead of silently reducing them.
  • The curator status protocol accepts skipped, and an existing curator state is upgraded by recording that outcome beside its previous outcomes.

Evidence

Validated on an isolated build host against the rebased head, because the authoring machine had no disk left for a local build.

Real behavior proof, not a mocked runner:

RUN  v5.0.1 /tmp/oc-build/openclaw
 ✓ src/skills/workshop/experience-review.e2e.test.ts > Workshop draft-only review through the real provider and tool owners > rejects an oversized review before provider dispatch and records the skipped outcome 97603ms
 ✓ src/skills/workshop/experience-review.e2e.test.ts (7 tests | 6 skipped) 97647ms

 Test Files  1 passed (1)
      Tests  1 passed | 6 skipped (7)
   Start at  17:51:22
   Duration  126.31s

That case runs the detached review through the real provider endpoint and tool owners with a configured guard (maxReviewContextTokens: 1,024, overflowPolicy: "skip"). The local provider server receives zero requests, and the curator state records outcome: "skipped" with oversized-request: estimatedPromptTokens=<n> promptBudgetBeforeReserve=<n>.

Unit coverage on the current head adds the upgrade-compatibility guarantee:

  • preserves the unbounded review path when no guard is configured proves no limits, no contextTokenBudget, and no reviewOverflowPolicy reach the run when nothing is configured.
  • passes the configured bound and records a skipped oversized review, surfaces an oversized review when the operator chooses fail, and records a provider context overflow after dispatch as a failed review cover the guarded paths.
  • preserves pre-fix curator outcomes when recording a skipped review covers stored-state upgrade.

Also validated:

  • check:max-lines-ratchet --base origin/main: 738 grandfathered suppressions, no new violation
  • check:line-cap-ratchet --base origin/main: changed source files show no new violations or over-cap growth
  • config:docs:check: docs/.generated/config-baseline.sha256 and docs/.generated/config-baseline.counts.json match

Review follow-up

All prior review findings are addressed on this head:

  • P1 (rev 1): the guard never selects a recent suffix or omits tool-result bodies. An oversized complete context is rejected before dispatch.
  • P2 (rev 1): overflow after provider dispatch remains failed; only the pre-dispatch rejection is skipped.
  • P2 (rev 2): maxReviewContextTokens and maxReviewContextBytes enforce their 2,000,000 and 256 MiB caps in OpenClawSchema rather than silently reducing out-of-range values at runtime. Documented in docs/tools/skill-workshop/configuration.md and covered in src/skills/workshop/config.test.ts.
  • P1 (rev 3): the default now preserves existing installations. The strict byte/event bound and pre-dispatch skip apply only when an operator configures a guard; unset config keeps the previous unbounded review path, covered by a dedicated unit test and documented in both docs pages.

The config growth is intentional and recorded in the generated config baseline: three optional review settings.

Full repository CI remains the PR check.

@clawsweeper

clawsweeper Bot commented Sep 27, 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 app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: L labels Sep 27, 2026
@sprintberlin
sprintberlin marked this pull request as ready for review September 27, 2026 14:16
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 12:58 PM ET / 16:58 UTC (Revision 4).

ClawSweeper review

What this changes

The branch adds optional size limits and skip-or-fail handling for oversized Skill Workshop Experience Reviews, records skipped outcomes, and updates the runner, protocol, docs, and tests.

Merge readiness

⛔ Blocked before merge - 4 items remain

This is a useful candidate for the linked oversized-review request. The latest head addresses the prior default-compatibility finding, and the supplied production-path proof supports the configured skip behavior. Acceptance of three new core settings and the guarded recovery policy still needs a Skill Workshop owner’s decision.

Priority: P2
Reviewed head: 676312c635e565170c77dbb28112bc7766478aef
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch preserves the prior default and has relevant production-path proof; the remaining gate is acceptance of the new product contract.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The contributor reports running the production detached-review entry point in an isolated setup with a local provider endpoint: a configured oversized prompt produced a persisted skipped outcome and zero provider requests. The existing-state writer merges the new outcome beside older values, and the PR includes a prior-state upgrade test; no storage migration is needed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The contributor reports running the production detached-review entry point in an isolated setup with a local provider endpoint: a configured oversized prompt produced a persisted skipped outcome and zero provider requests. The existing-state writer merges the new outcome beside older values, and the PR includes a prior-state upgrade test; no storage migration is needed.
Evidence reviewed 7 items Current main lacks the requested guard: Current main opens the source model context without review-specific limits; its Workshop configuration resolver has no review-budget settings.
Opt-in compatibility: The branch passes byte limits and a review overflow policy only when configured; otherwise the detached review keeps its prior context-open and runner arguments. This addresses the previous review’s default-skip finding.
Complete-context admission: The new reject path measures the selected retained entries and rejects an over-limit context before loading their model payloads, rather than selecting a shorter suffix.
Findings None None.
Security None None.

How this fits together

Skill Workshop starts a detached review after an eligible foreground turn and reads that turn’s retained model context. The review runner then submits a prompt to the provider and records the outcome in curator state.

flowchart LR
A[Completed foreground turn] --> B[Retained model context]
B --> C{Configured review guard}
C -->|Fits| D[Review runner]
C -->|Oversized| E[Skipped or failed outcome]
D --> F[Provider]
F --> G[Curator outcome]
Loading

Decision needed

Question Recommendation
Should Skill Workshop expose these three optional core review settings with skip-or-fail admission and no model rotation after a guarded provider overflow? Accept the opt-in guard: Approve the documented three-setting contract while preserving the unconfigured review path.

Why: The linked request asks for maintainer guidance, and the branch establishes a lasting configuration and recovery contract that source correctness alone cannot authorize.

Before merge

  • Resolve merge risk (P1) - A Skill Workshop owner has not confirmed the permanent three-setting core API or the opt-in policy that stops guarded reviews after provider context overflow instead of rotating models.
  • Complete next step (P2) - Obtain a Skill Workshop owner’s decision on the three-setting API and guarded provider-overflow recovery policy before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

Source +309, Tests +793, Docs +18, Generated 0. Total +1120 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 14 318 9 +309
Tests 10 796 3 +793
Docs 2 26 8 +18
Config 0 0 0 0
Generated 2 3 3 0
Other 0 0 0 0
Total 28 1143 23 +1120

Review metrics

Metric Value Why it matters
New operator settings 3 optional settings The configuration surface is the outstanding product decision.
Source growth production +318/-9 lines; tests +796/-3 lines The production growth implements admission, recovery, and outcome handling; the new real-path case reported 97.6 seconds of test time.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #150238
Summary: This PR is the open implementation candidate for the linked oversized Experience Review request.

Members:

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

Merge-risk options

Maintainer options:

  1. Approve the guarded contract (recommended)
    A Workshop owner accepts the opt-in settings and the documented guarded overflow behavior before merge.
  2. Narrow the settings
    Reduce the permanent core configuration and adjust the guarded recovery behavior to the owner-approved scope.
  3. Pause the feature
    Leave the linked request open if no owner wants to support this configuration contract.

Technical review

Best possible solution:

Keep the default review behavior, adopt a maintainer-approved guard in the existing Workshop owner, and retain an explicit curator outcome for each rejected review.

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

Not applicable as a feature request. Current-main source lacks a review guard, and the linked report describes an oversized retained session; the supplied branch proof exercises the proposed guarded path.

Is this the best way to solve the issue?

Unclear pending product approval. The opt-in implementation preserves existing defaults and keeps the policy with the Workshop review owner, but maintainers must choose whether these settings and recovery semantics should be supported.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The contributor reports running the production detached-review entry point in an isolated setup with a local provider endpoint: a configured oversized prompt produced a persisted skipped outcome and zero provider requests. The existing-state writer merges the new outcome beside older values, and the PR includes a prior-state upgrade test; no storage migration is needed.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded improvement to background review behavior with limited user impact.
  • merge-risk: 🚨 compatibility: The new opt-in configuration changes how guarded reviews recover from provider overflow and expands the curator outcome contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 contributor reports running the production detached-review entry point in an isolated setup with a local provider endpoint: a configured oversized prompt produced a persisted skipped outcome and zero provider requests. The existing-state writer merges the new outcome beside older values, and the PR includes a prior-state upgrade test; no storage migration is needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor reports running the production detached-review entry point in an isolated setup with a local provider endpoint: a configured oversized prompt produced a persisted skipped outcome and zero provider requests. The existing-state writer merges the new outcome beside older values, and the PR includes a prior-state upgrade test; no storage migration is needed.

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)
  • Ayaan Zaidi: 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 (3 earlier review cycles)
  • reviewed 2026-09-27T14:23:12.523Z sha 017aeb0d07baa23b1ac18a76b498a9b11809eeb9 :: needs real behavior proof before merge. :: [P1] Skip instead of silently shortening oversized review evidence | [P2] Keep post-dispatch overflow distinct from a skipped review
  • reviewed 2026-09-27T16:10:21.883Z sha 043f08250fe6130e0c32675d1325875474893e1e :: blocked before merge. :: [P2] Reject or document settings above the effective caps
  • reviewed 2026-09-27T16:27:30.983Z sha 2b1e44014dab804a7070de1b2daacec9484a878a :: blocked before merge. :: [P1] Preserve or approve the default for existing review sessions

@sprintberlin
sprintberlin force-pushed the fix/workshop-oversized-review-budget branch from 017aeb0 to c54e8f6 Compare September 27, 2026 16:00
@sprintberlin
sprintberlin force-pushed the fix/workshop-oversized-review-budget branch from c54e8f6 to 043f082 Compare September 27, 2026 16:00
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 27, 2026
@sprintberlin
sprintberlin force-pushed the fix/workshop-oversized-review-budget branch from 043f082 to 2b1e440 Compare September 27, 2026 16:18
…tch overflow, and prove state upgrade

- Require complete evidence admission for experience review via overflow: 'reject', avoiding silent truncation of earlier requirements or omitted tool result bodies (addresses ClawSweeper P1).
- Distinguish late provider context overflow after dispatch from preflight overflow; keep post-dispatch overflows as failed outcomes with their error preserved (addresses ClawSweeper P2).
- Remove unused exports in attempt-prompt-preflight and review-overflow to clear knip dead code check.
- Extract detached review overflow tests to attempt-recovery.review-overflow.test.ts to comply with line-cap ratchet (cap 1000).
- Add state-upgrade test verifying pre-fix curator state without skipped outcome is safely preserved when recording a skipped review.
…settings

Core config surface grows 2463 -> 2466 for skills.workshop.autonomous
maxReviewContextTokens, maxReviewContextBytes, and overflowPolicy.
@sprintberlin
sprintberlin force-pushed the fix/workshop-oversized-review-budget branch from 2b1e440 to 676312c Compare September 27, 2026 16:44
@clawsweeper clawsweeper Bot added 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 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 Sep 27, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

This branch has not been deployed

No deployments
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 gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL stale Marked as stale due to inactivity 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.

[Feature]: Add a supported context budget / skip policy for Skill Workshop Experience Review on oversized sessions

1 participant