Skip to content

fix(context): preserve provider-scoped prompt budgets before reply maintenance - #141052

Merged
jalehman merged 7 commits into
openclaw:mainfrom
snotty:fix/provider-scoped-reply-context-20260907
Sep 16, 2026
Merged

jalehman merged 7 commits into
openclaw:mainfrom
snotty:fix/provider-scoped-reply-context-20260907

Conversation

@snotty

@snotty snotty commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer update — September 15, 2026

Current head: 44b06f21fec6e92c36315918d1f0ad0862384228. Main 41d443f123184789c71f2700cefa9bde3d0f49e3 was merged without rebasing or replacing contributor ancestry. This incorporates the already-landed fixture repairs #149301 and #149349. Both earlier CI workflows finished before their recovery pushes; no duplicate fixture patch or CI cancellation was needed. The original contributor commit remains an ancestor.

  • Resolved the three registry conflicts by preserving contextTokens together with main's contextWindows and contextWindowDefault.
  • Fixed the reviewed P2 catalog identity collision: literal provider/model tuples remain separate, and exact selected IDs precede display-key alias fallback.
  • Before repair, the ordinary-selection regression returned 64,000 instead of 1,000,000 for fixture/m's distinct sibling model m, and lost one configured row. Both intended assertions failed; four cases covering both selected IDs and both row orders now pass.
  • 151 tests across the three affected suites plus both Codex attribution cases passed after the fixed-main merge. The four identity cases were rechecked after a test-only lint variable rename; final changed-file lint has zero warnings/errors. Main's full automatic-model thinking catalog contract is retained.
  • Core and all core-test typechecks, all three Knip scans, and required changed-surface guards passed. Full pnpm build passed on c89898442de; all five PR files are byte-identical after the main refresh. Exact-head hosted CI 35019032186, attempt 2, passed on 44b06f21fec; the final runtime proof also independently built and installed that exact head. Fresh full-PR P2 autoreview on the current head is scoped-clean.
  • The additional Codex fixture lint/declaration check passed in a standalone physical checkout with a frozen-lockfile install. The nested native worktree was rejected by the new ancestor-dependency isolation guard; the guard was not bypassed and shared dependencies were untouched.
  • Production delta against the integrated main: +27/-9; tests +218/-0. Existing optional-budget schema/projections and literal-identity selection account for production growth.

Exact-head CI and the eight-case real ordinary-reply before/after proof passed. Native review, preparation, and merge verification remain required. The previous #148596 SDK proof supports the shared metadata defect but does not prove this PR's additional ordinary-reply behavior. Its three baseline CLI routes already retained the smaller budget; those are not a successful widening reproduction. The broader runtime report is not claimed resolved here.

The earlier contributor evidence below is retained for provenance; its exact-head statements refer to the revisions named there, not this new head.


Related: #103275, #106198, #138087

What Problem This Solves

Ordinary replies can use the generic 200K context budget, or a model's native window instead of its effective prompt ceiling, even when correct provider-scoped metadata was already prepared.

The registry drops optional contextTokens in persisted/dynamic model projections. Ordinary reply selection also drops prepared plugin-owned catalog rows when that provider has no authored models.providers row.

The patch is not superseded. September 12 main controls at c51ce7bff77223c4c2f6104abe883a104edcb758 reproduce all five original assertion failures; the affected production files remain unchanged through refresh base 9ebef910b792eaea853838beb95e6d9ceedf0557: two registry projections omit the prompt cap, registry-to-budget resolution returns 1000000 instead of 872000, and two provider-scoped ordinary-selection cases return 200000 instead of 872000/922000.

Why This Change Was Made

Carry the existing optional prompt cap through the registry schema, registration input and both projections. Merge the already-prepared catalog by provider/model key, retaining plugin-owned rows as well as configured fallback metadata. Existing policy still filters visibility afterward.

The production delta remains +13/-8 across two files. No new discovery call, credential selection, provider-specific budget, cache, configuration option or persisted-session format is added. Native contextWindow and output maxTokens remain separate; authored caps and current runtime-selection validation remain intact.

September 12 conflict resolution retains both the newly landed authored-context-floor test and this PR's registry replacement flow test. Range-diff has only surrounding-context changes; the original patch semantics, author and commit message are preserved. The remaining cold-discovery/provenance work discussed in #138087 is not duplicated here.

User Impact

Plugin-owned models retain already-supplied effective prompt budgets through registry snapshots/forks and ordinary reply selection without redundant authored provider configuration. Early maintenance and inference agree on that budget.

Evidence

Refreshed head: 08a2ade13cc874c80a78ccfa756cbac6775f40c6
Rebase/validation base: 9ebef910b792eaea853838beb95e6d9ceedf0557

  • Main controls on c51ce7bff77223c4c2f6104abe883a104edcb758: five intended assertion failures, not startup failures. The same regressions pass on this patch.
  • 462/462 tests across 12 files passed during this refresh, covering registry, ordinary selection, authored caps/floors, maintenance, native-harness ownership, context provenance and credential/provider isolation. That 12-file run was on initial refreshed head 0ea2a6852b319d9d7cecf4746fd093bc4e105086; after the final patch-identical rebase, 135/135 focused tests were rerun and passed on 08a2ade13cc874c80a78ccfa756cbac6775f40c6.
  • Changed-surface repository gates: The full gate passed on 0ea2a6852b319d9d7cecf4746fd093bc4e105086 (production and all 18 test-type programs, all three dead-export scans, lint/format and repository guards). Production and the affected test-type programs, changed-file lint/format, diff/ancestry and the real production flow were rerun successfully on 08a2ade13cc874c80a78ccfa756cbac6775f40c6.
  • Full build: pnpm build passed on 0ea2a6852b319d9d7cecf4746fd093bc4e105086, including declarations, packaged plugin/control-plane checks and Control UI artifact checks. This is pre-final-rebase local build evidence, not a claim that an older hosted run proves the new head.
  • git diff --check, clean tree and range-diff: passed; no unexplained semantic drift.
  • Node 24.17.0, pinned pnpm 12.3.4, frozen task-owned dependencies. Source execution used an isolated HOME/state and cleared environment, without host credentials or operator configuration.

Fresh unmocked production-module execution: the existing runnable synthetic source probe was rerun on the refreshed source. It composes the registry/fork, ordinary selection, maintenance's thinking-catalog lookup/threshold and embedded policy:

Primary supplied prompt:     872000 -> 64000 -> 872000
Primary reply/maintenance/
inference budget:            872000 -> 64000 -> 872000
Same-id sibling budget:      922000 throughout
Native windows:              1000000 / 1050000, unchanged
Output ceilings:             128000, unchanged

These are synthetic fixtures and actual source execution, not live provider discovery or inference. No operator state is involved.

Exact-head hosted CI: PASS — run 34704000073, attempt 1, head 08a2ade13cc874c80a78ccfa756cbac6775f40c6. 145 successful jobs, 17 skipped, zero failed or unfinished. The repository exact-head rollup watcher returned GREEN, excluding six superseded checks.

Review: Fresh ClawSweeper review explicitly names 08a2ade13cc874c80a78ccfa756cbac6775f40c6: no actionable findings, no security findings, sufficient proof, ready for maintainer review, no before-merge items. Review workflow completed successfully. This is a fresh source review, not a separate live-provider invocation.
The September 7 review and CI on fab8d8726a0aaf9bdd3f71081060d71a7373b569 are historical only, not evidence for this refreshed head.

Base freshness: main continued advancing during three complete refresh/validation/push windows. The tested base is pinned above; it is not claimed to be the absolute current tip. Subsequent main 335ff0661b93d1b95add925d0ca543dd506c30c8 changes neither repaired budget owner; a read-only merge-tree check against that exact tip is conflict-free. No branch merge or PR merge was performed.

No other PR was modified in this task. No installed OpenClaw runtime, configuration, services, sessions or authentication were changed; nothing was restarted or merged.

Worked on by

  • @snotty (existing sole commit author; attribution preserved)

Verified ordinary-reply runtime proof

Eight-case before/after evidence and artifact identities. All eight real OpenAI replies passed on independently built/installed baseline 41d443f and candidate 44b06f2. Early selection changed from 200,000 to 272,000; model-call and durable-handoff budgets changed from 1,050,000 to 272,000. Maintenance remained correctly at 272,000. The documented explicit 128,000 cap, native-only and warm controls passed, with native/output metadata preserved and no conversation-access grant. This supplies the requested live proof; current native review, CI and merge gates remain required.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 7, 2026
@snotty
snotty marked this pull request as ready for review September 7, 2026 08:50
@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 9:35 PM ET / September 16, 2026, 01:35 UTC (Revision 10).

ClawSweeper review

What this changes

Preserves provider-specific prompt limits through model registration and ordinary reply selection while keeping distinct literal model IDs separate.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary. Current main still loses the supplied prompt budget, and the new eight-case ordinary-reply evidence resolves the previous proof blocker. No actionable correctness or security findings remain.

Priority: P2
Reviewed head: 44b06f21fec6e92c36315918d1f0ad0862384228

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong comparative runtime evidence, useful regression coverage, and no remaining actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The updated proof records eight real authenticated ordinary replies through independently installed baseline and candidate Gateways, demonstrating corrected early-selection and registry/runtime budgets with explicit-cap, warm-cache, and native-only controls; maintenance remains unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The updated proof records eight real authenticated ordinary replies through independently installed baseline and candidate Gateways, demonstrating corrected early-selection and registry/runtime budgets with explicit-cap, warm-cache, and native-only controls; maintenance remains unchanged.
Evidence reviewed 10 items Current main still drops the prompt limit: Both runtime projections retain contextWindow but omit contextTokens. The two production files are unchanged between the pinned baseline and fetched main.
Prepared-only metadata remains missing on main: Main's mergePreparedConfiguredCatalog maps only configured rows, discarding prepared rows without a configured counterpart; the candidate retains them and prefers exact selected IDs before alias fallback.
Latest-release check: The supplied latest release, v2026.9.4, also omits contextTokens from the registry schema and both projections; it does not contain this repair.
Findings None None.
Security None None.

How this fits together

OpenClaw's model registry and reply selection carry provider catalog metadata into conversation budgeting. Those limits determine how much context the reply runtime and maintenance logic can use.

flowchart TD
  A[Provider catalog metadata] --> B[Model registry]
  C[Configured model metadata] --> B
  A --> D[Prepared reply catalog]
  C --> D
  D --> E[Model selection policy]
  E --> F[Early reply and maintenance budgets]
  B --> G[Inference budget]
  F --> H[Ordinary reply]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +18, Tests +218. Total +236 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 27 9 +18
Tests 3 218 0 +218
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 245 9 +236

Review metrics

Metric Value Why it matters
Runtime comparison 8 cases across baseline and candidate Real ordinary replies cover prepared-only metadata, warm caches, explicit caps, and native-only fallback.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #148575
Summary: This PR is a candidate repair for the registry field loss and additionally fixes early reply selection; broader runtime observations remain outside its demonstrated scope.

Members:

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

Technical review

Best possible solution:

Keep one provider-owned prompt limit intact through registry snapshots, reply selection, and inference while preserving explicit caps, native capacity, and existing selection policy.

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

Yes: current-main source retains both lossy paths, and the supplied installed-Gateway baseline demonstrates their budget discrepancies. This review did not execute current main.

Is this the best way to solve the issue?

Yes: preserving the existing field at its projections and retaining prepared catalog rows repairs the owning paths without provider-specific fallbacks or another configuration mechanism.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The updated proof records eight real authenticated ordinary replies through independently installed baseline and candidate Gateways, demonstrating corrected early-selection and registry/runtime budgets with explicit-cap, warm-cache, and native-only controls; maintenance remains unchanged.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The updated proof records eight real authenticated ordinary replies through independently installed baseline and candidate Gateways, demonstrating corrected early-selection and registry/runtime budgets with explicit-cap, warm-cache, and native-only controls; maintenance remains unchanged.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs bounded model-budget inconsistencies without evidence of an emergency or broadly unusable workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The updated proof records eight real authenticated ordinary replies through independently installed baseline and candidate Gateways, demonstrating corrected early-selection and registry/runtime budgets with explicit-cap, warm-cache, and native-only controls; maintenance remains unchanged.
  • proof: sufficient: Contributor real behavior proof is sufficient. The updated proof records eight real authenticated ordinary replies through independently installed baseline and candidate Gateways, demonstrating corrected early-selection and registry/runtime budgets with explicit-cap, warm-cache, and native-only controls; maintenance remains unchanged.

Evidence

What I checked:

  • Current main still drops the prompt limit: Both runtime projections retain contextWindow but omit contextTokens. The two production files are unchanged between the pinned baseline and fetched main. (src/agents/sessions/model-registry.ts:853, cdba90dd5cdc)
  • Prepared-only metadata remains missing on main: Main's mergePreparedConfiguredCatalog maps only configured rows, discarding prepared rows without a configured counterpart; the candidate retains them and prefers exact selected IDs before alias fallback. (src/auto-reply/reply/model-runtime-normalization.ts:158, cdba90dd5cdc)
  • Latest-release check: The supplied latest release, v2026.9.4, also omits contextTokens from the registry schema and both projections; it does not contain this repair. (src/agents/sessions/model-registry.ts:752, 3a9d69db306c)
  • Existing configuration and selection contracts: The documented per-model contextTokens field already separates active input from native capacity. Reply selection still applies the existing visibility policy after catalog composition, and runtime resolution still honors explicit configured limits. This repairs metadata propagation without adding configuration, changing storage formats, or transferring authorization. Public docs: docs/gateway/config-tools/custom-providers.md. (docs/gateway/config-tools/custom-providers.md:99, 44b06f21fec6)
  • After-fix ordinary-reply proof: The fully supplied comment at fix(context): preserve provider-scoped prompt budgets before reply maintenance #141052 (comment) records independently installed baseline 41d443f and candidate 44b06f2 using authenticated chat.send, agent.wait, public history, and real OpenAI responses. Across eight cases, candidate early selection and runtime/handoff use the supplied 272000 cap; the explicit 128000 cap, warm-cache and native-only controls pass. Maintenance was already correct on baseline and remains so. Fixture metadata establishes propagation, not vendor capacity or high-token compaction coverage. This addresses both retained prior rank-up requests. (44b06f21fec6)
  • Proof workflow qualification: The linked Testbox workflow was cancelled after provisioning and running the lease, with cleanup steps successful. Its workflow checkout is distinct from the independently built revisions in the recorded proof. Workflow status is not treated as a behavioral PASS; the detailed copied runtime observations establish the result.

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: 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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-07T09:12:39.115Z sha fab8d8726a0aaf9bdd3f71081060d71a7373b569 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T09:20:04.937Z sha fab8d8726a0aaf9bdd3f71081060d71a7373b569 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T16:10:45.942Z sha 08a2ade :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T16:35:37.687Z sha 08a2ade :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T18:21:37.562Z sha c898984 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T19:00:57.648Z sha b98e018 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T20:34:50.060Z sha 44b06f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T00:06:33.075Z sha 44b06f2 :: needs real behavior proof before merge. :: none

@snotty
snotty force-pushed the fix/provider-scoped-reply-context-20260907 branch from 8e7a250 to 08a2ade Compare September 12, 2026 16:01
@snotty

snotty commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Refresh complete for 08a2ade13cc874c80a78ccfa756cbac6775f40c6 (tested base 9ebef910b792eaea853838beb95e6d9ceedf0557).

  • Still necessary: five original main regression failures reproduced; no superseding repair in the inspected budget owners.
  • Exact-head CI: 145 successful jobs, 17 skipped, 0 failed/pending; native rollup GREEN.
  • Fresh ClawSweeper review: exact head verified, no actionable/security findings, sufficient proof, ready for maintainer review.
  • Final-head 135 focused tests, production/affected-test types, lint/format and unmocked synthetic registry → selection → maintenance/inference flow passed. The separate 462-test/full-gate/full-build proof is explicitly bound to the earlier refresh candidate in the PR body.
  • Original author/date/message and added/removed patch text preserved; both sides of the overlapping test insertion retained.
  • Main advanced during three complete validation windows. The latest tested head was retained rather than indefinitely restarting CI; inspected main 335ff0661b93d1b95add925d0ca543dd506c30c8 changes neither repaired budget owner, and a read-only merge-tree check is conflict-free. This does not claim latest-tip ancestry.

Post-publication check qualification: ClawSweeper Dispatch run 34705384251 was cancelled after the proof update. Main CI and the fresh review above are successful, and no checks remain pending, but GitHub's overall merge state is currently UNSTABLE (still mergeable). A native rerun request returned HTTP 403: “Must have admin rights to Repository.” A repository-authorized maintainer must resolve/retry that dispatcher if a fully clean overall check state is required; no workflow, permissions or source changes were made to work around it.

PR remains open and unmerged. No other PR, installed runtime, configuration, services or authentication were changed. No merge requested.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Keep configured and prepared rows distinct when their display keys collide, and prefer an exact model ID before alias matching. Covers both selected IDs and row orders.
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 15, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@jalehman

jalehman commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Verified ordinary-reply before/after proof

All eight real-request cases passed. The final comparison exited 0. I checked the underlying response, model-call, public-history, and host-issued commit records as well as the aggregate result.

Both revisions were independently cloned, built, packaged, and installed in detached temporary directories in the same invocation. Each case started a separate installed Gateway with fresh HOME, state, configuration, workspace, and session. The request used normal authenticated chat.send, then agent.wait and public chat.history; it did not call the reply implementation directly or inject private prepared-runtime authority.

Every case returned the exact assistant text PROOF141052_OK from OpenAI Responses using proof-openai-141052/gpt-6-astra. Every run ended ok, every model call ended completed, all run/session/history/commit correlations passed, and zero fallback events were observed. All case drivers exited 0, including cleanup.

Observed budgets

Values are tokens. “Runtime/handoff” gives the actual model-call budget and durable inference-handoff budget; those two values agreed in every case.

Case Early reply Maintenance Runtime/handoff
Baseline, prepared-only 200,000 272,000 1,050,000
Candidate, prepared-only 272,000 272,000 272,000
Baseline, warm 272,000 272,000 1,050,000
Candidate, warm 272,000 272,000 272,000
Baseline, explicit lower cap 128,000 128,000 128,000
Candidate, explicit lower cap 128,000 128,000 128,000
Baseline, native-only 200,000 1,050,000 1,050,000
Candidate, native-only 1,050,000 1,050,000 1,050,000

In the prepared-only cases, the baseline had the prepared 272,000-cap row but no selected row; the candidate retained it. The baseline resolved models lacked contextTokens; candidate resolved models retained contextTokens: 272000 alongside the unchanged native contextWindow: 1050000 and output ceiling maxTokens: 128000. Every relevant resolved-model observation was checked, not just one matching row.

The warm controls observed actual cache values together with their early budget. Warming recovered the baseline early budget but did not recover its runtime/handoff limit. The candidate honored the input cap at both boundaries.

Maintenance was already correct on the baseline because main retains the full thinking catalog. It remains correct on the candidate. The demonstrated changes are early catalog selection and registry/runtime input-limit preservation; no maintenance failure was manufactured.

Control configuration and scope

The external test plugin supplies fixture catalog metadata, not live vendor discovery or a vendor-capacity claim: native window 1,050,000, input cap 272,000, output ceiling 128,000. The transport, authentication, and responses are real.

Prepared-only, warm, and native-only cases have no authored models.providers model row. The separate lower-cap control uses the documented models.providers.<provider>.models[].contextTokens: 128000, preserving the same native window and output metadata. The native-only control omits the input cap.

The earlier lower-cap probe used agents.defaults.contextTokens, which did not cap these paths. That invalid probe remains recorded as HOLD; the final run corrects only the control configuration and still requires 128,000 on both revisions. No production code, model policy, expected numeric bound, or cache was changed to make it pass.

Observation and permission boundaries

Read-only debugger queries record selected metadata, early and maintenance budgets, and existing cache values. throwOnSideEffect remains enabled. The observer does not clear or prime caches, replace model results, or fabricate runtime authority.

Public history supplies the actual session identity and assistant output. Permitted model-call-ended metadata links the acknowledged run to that session and provider/model; host-issued admission and terminal anchors link the durable commit. No conversation-access permission was granted to the non-bundled plugin. Absent prompt/output hooks are explicitly recorded and are not substituted with invented receipts.

The pass-through context engine records metadata and message digests and acknowledges actual host advancement atomically/idempotently. This small-turn test proves budget propagation, not maximum vendor capacity, high-token stress behavior, or an actual compaction trigger. Debugger pauses affect timing. Literal prefixed-ID and row-order regressions are covered separately by the focused source tests, not by claiming OpenAI accepts artificial model IDs.

Commands and immutable artifacts

One content-hashed harness invocation ran the independent builds/installations and all eight cases:

corepack pnpm install --frozen-lockfile
corepack pnpm build
node scripts/package-openclaw-for-docker.mjs \
  --allow-unreleased-changelog --skip-build \
  --output-dir <revision-artifacts> --output-name proof-openclaw.tgz
npm install --prefix <fresh-consumer> --no-audit --no-fund <tarball>
# Separate fresh installed Gateways:
# chat.send -> agent.wait -> chat.history, plus read-only budget/commit observations.

--skip-build avoids repeating the immediately preceding successful build. The canonical packer's integrity checks remain enabled.

  • Baseline tarball SHA-256: 0bec0cffec778804687a294e942f794ca407d6e7897d23345f38658e2251cddc
  • Candidate tarball SHA-256: d0d4c54db1c8117dacfa868a475b8f75a3e583eb2d0f8b9d2c0e0ee71362921e
  • Executed harness SHA-256: f13c9ceb92db5e98711d0314b4218093e480543c9cae7b220af1991957f92ef7

The previous partial attempt and invalid-control matrix are retained as historical HOLD results; neither was retroactively changed to PASS. This final invocation supplies the complete comparison. Source remains at the exact candidate above, with contributor ancestry preserved and no rebase or force-push.

Proof lease cleanup: final evidence is retained locally. Lease tbx_01m2ks3y1t6x5jdsc62dv0hpsk was stopped; native Blacksmith status independently confirms completed. No other lease was stopped. Native review, CI, repository rules, and merge verification remain separate requirements.

Downloadable proof artifacts

Verified artifact manifest contains the sanitized evidence, report, and exact executed harness. File bytes were downloaded and checked against their SHA-256 values. Download links expire on September 23, 2026 (UTC). The source and artifact hashes above remain the durable identifiers.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026
@jalehman
jalehman merged commit 5600c4d into openclaw:main Sep 16, 2026
412 of 416 checks passed
@jalehman

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…intenance (openclaw#141052)

* fix(context): preserve provider-scoped prompt budgets before reply maintenance

* fix: preserve literal identities in reply catalog selection

Keep configured and prepared rows distinct when their display keys collide, and prefer an exact model ID before alias matching. Covers both selected IDs and row orders.

* test: align prepared budget coverage with automatic model policy

* test: avoid shadowing expected context window

---------

Co-authored-by: jalehman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants