Repository navigation
fix(context): preserve provider-scoped prompt budgets before reply maintenance - #141052
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 9:35 PM ET / September 16, 2026, 01:35 UTC (Revision 10). ClawSweeper reviewWhat this changesPreserves 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 Review scores
Verification
How this fits togetherOpenClaw'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
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +18, Tests +218. Total +236 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
9678df2 to
8e7a250
Compare
8e7a250 to
08a2ade
Compare
|
Refresh complete for
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. |
|
🦞🧹 I asked ClawSweeper to review this item again. 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.
Verified ordinary-reply before/after proofAll 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 Every case returned the exact assistant text Observed budgetsValues are tokens. “Runtime/handoff” gives the actual model-call budget and durable inference-handoff budget; those two values agreed in every case.
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 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 scopeThe 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 The earlier lower-cap probe used Observation and permission boundariesRead-only debugger queries record selected metadata, early and maintenance budgets, and existing cache values. Public history supplies the actual session identity and assistant output. Permitted 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 artifactsOne 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.
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 Downloadable proof artifactsVerified 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. |
|
Merged via squash.
|
…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]>
Maintainer update — September 15, 2026
Current head:
44b06f21fec6e92c36315918d1f0ad0862384228. Main41d443f123184789c71f2700cefa9bde3d0f49e3was 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.contextTokenstogether with main'scontextWindowsandcontextWindowDefault.fixture/m's distinct sibling modelm, and lost one configured row. Both intended assertions failed; four cases covering both selected IDs and both row orders now pass.pnpm buildpassed onc89898442de; all five PR files are byte-identical after the main refresh. Exact-head hosted CI 35019032186, attempt 2, passed on44b06f21fec; the final runtime proof also independently built and installed that exact head. Fresh full-PR P2 autoreview on the current head is scoped-clean.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
contextTokensin persisted/dynamic model projections. Ordinary reply selection also drops prepared plugin-owned catalog rows when that provider has no authoredmodels.providersrow.The patch is not superseded. September 12 main controls at
c51ce7bff77223c4c2f6104abe883a104edcb758reproduce all five original assertion failures; the affected production files remain unchanged through refresh base9ebef910b792eaea853838beb95e6d9ceedf0557: 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
contextWindowand outputmaxTokensremain 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:
08a2ade13cc874c80a78ccfa756cbac6775f40c6Rebase/validation base:
9ebef910b792eaea853838beb95e6d9ceedf0557c51ce7bff77223c4c2f6104abe883a104edcb758: five intended assertion failures, not startup failures. The same regressions pass on this patch.0ea2a6852b319d9d7cecf4746fd093bc4e105086; after the final patch-identical rebase, 135/135 focused tests were rerun and passed on08a2ade13cc874c80a78ccfa756cbac6775f40c6.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 on08a2ade13cc874c80a78ccfa756cbac6775f40c6.pnpm buildpassed on0ea2a6852b319d9d7cecf4746fd093bc4e105086, 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.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:
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
fab8d8726a0aaf9bdd3f71081060d71a7373b569are 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
335ff0661b93d1b95add925d0ca543dd506c30c8changes 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
Verified ordinary-reply runtime proof
Eight-case before/after evidence and artifact identities. All eight real OpenAI replies passed on independently built/installed baseline
41d443fand candidate44b06f2. 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.