Repository navigation
fix(agents): preserve provider ownership in error diagnostics - #134029
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 9:24 AM ET / 13:24 UTC. ClawSweeper reviewWhat this changesThe PR keeps prepared provider ownership, or explicit no-owner state, through agent error formatting and diagnostic displays, and updates compiled-worker test fixtures for the same boundary. Merge readinessNo introduced correctness or security defect was found. Keep this maintainer-authored, maintainer-labelled PR open for human merge handling after its exact-head CI completes. Priority: P1 Review scores
Verification
How this fits togetherAgent runs prepare provider-specific failure policy before model execution; formatter, lifecycle, TUI, and Gateway history paths later turn failures into recovery copy. The change prevents those presentation-only consumers from borrowing another loaded provider’s policy when no owner was prepared. flowchart LR
A[Provider preparation] --> B[Prepared owner or no owner]
B --> C[Assistant error classifier]
C --> D[Agent reply formatting]
C --> E[Lifecycle and TUI diagnostics]
C --> F[Gateway history display]
D --> G[Recovery copy]
E --> G
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +49, Tests +142, Other +8. Total +199 across 17 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the consistent prepared-owner/null propagation after exact-head CI is green; separate presentation consumers need the explicit value because they do not own runtime provider discovery. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible. Current main omits the prepared owner at the formatter and repeated schema/context classification points; the branch adds focused conflicting-owner and no-discovery cases, though this read-only review did not execute them. Is this the best way to solve the issue? Yes. The existing provider-pattern contract makes explicit null the correct presentation-only no-discovery state, and forwarding the already-prepared owner is narrower than creating a second resolver or policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f81afb28435b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
The first exact-head CI run failed primarily before code execution: 102 jobs failed, with the inspected build/type/test jobs exhausting checkout attempts because Git could not authenticate to github.com. The build job partially fetched the correct PR merge on one attempt, then failed fetching the separate CI harness with the same error. This does not indicate a missing PR ref or a test assertion failure. The underlying HTTP response was not logged, so no outage or credential-expiry cause is claimed. Failed jobs have been rerun on unchanged head |
|
The current head's formatter, prepared model-handle fixture, and source/compiled owner handoff all passed in hosted CI. The remaining failed jobs encountered GitHub checkout errors, npm tarball timeouts, or the same GitHub fetch error while retrieving a pinned historical reader before its compatibility assertion. No new code failure was identified in those jobs. Windows also hit the existing 120-second timeout in the separate fresh-process Anthropic preparation case; the changed four-flow payload proof passed there. That timeout has occurred in another lane and then passed unchanged, so this retry keeps the test and its limit intact. I am retrying only failed jobs on the unchanged head. The latest ClawSweeper review covers this exact commit and reports no correctness or security findings. The prepared-owner/null contract and its production growth remain justified by the separate diagnostic consumers; final merge still waits for the required CI result. |
|
Final maintainer review: the prepared-provider/null boundary is accepted as the canonical owner contract. The +19 production lines carry that existing fact through diagnostics; runtime callers retain their existing loaded-provider behavior, while presentation without an owner cannot borrow another provider's policy. No actionable correctness or security findings remain in the current-head ClawSweeper review. Its owner-review Rank-up is addressed by this maintainer review. Final commit: Both final-head Windows jobs passed. The real Anthropic compiled-child case took 15.556 seconds, including 10.012 seconds of artifact preparation and 726 ms native plugin loading, with one native hit and zero source transforms. All four source/compiled payload flows passed. Linux lint and both unused-code checks passed. Current-main owner regressions, existing runtime siblings, source/compiled owner identity, and real Linux error-rendering evidence are recorded in the PR body; historical timing is explicitly distinguished from the ownership defect remaining after the complementary main fix. Source-checkout Anthropic/Jiti cold loading remains a named follow-up. This patch does not claim faster product startup or an external provider API round trip. Final verification: the exact-head run completed successfully with193passing jobs, including the required aggregate gate, and17intentionally skipped jobs. The latest13:24UTC ClawSweeper review was read in full and has no actionable findings. |
|
Merged via squash.
|
Reuse the prepared-provider error handling fixes from openclaw#133970 and openclaw#134029 while preserving the original plugin drift repair ancestry.
…aw#134029) * fix(agents): preserve provider ownership in error diagnostics * test(agents): complete the prepared provider handle fixture * test(agents): prepare scoped owners in compiled payload proofs * test: prepare native Anthropic artifacts for failover proof * test: declare compiled Anthropic probe as an executable root
What Problem This Solves
Fixes an issue where assistant error messages could use another loaded provider's policy after losing the active provider's prepared owner. Schema and context errors could consequently receive incorrect copy. Diagnostic rendering without an owner could also consult provider hooks that did not own that error.
Closes #134012.
Why This Change Was Made
Carry the existing prepared-owner/explicit-absence contract through assistant formatting, embedded lifecycle diagnostics, TUI auth hints, and Gateway error-history projection. This complements the loaded-only resolver repair already on main in #133970: the resolver limits runtime loading, while this patch keeps diagnostic policy attached to the correct owner and avoids consulting loaded hooks when presentation has no owner.
The raw-message schema check remains separate because generic HTTP 400 classification is insufficient evidence of a schema failure. Both classification passes now carry the same owner. Runtime callers retain their existing undefined-owner behavior and can consult loaded provider hooks.
User Impact
Prepared provider schema/context policy remains authoritative for assistant error copy. Diagnostic consumers without a provider owner use shared classifications. Existing auth redaction, billing copy, context recovery hints, and terminal lifecycle behavior remain covered.
Evidence
4feff037baaf786d967fbbb6335ad6b97835cbd6: all five assistant ownership cases and the Gateway case fail, while the runtime-lookup control passes. The same seven cases all pass on rebased commit324e97bcb5d0c562871e8a4803f2aa68ee2c71de. Candidate source bytes were restored and verified after the baseline run.324e97bcb5d0c562871e8a4803f2aa68ee2c71de: affected runtime suites passed 117/117. Main's broad resolver mock was replaced with the already-reviewed prepared-generation fixture; real registered hooks return no override, core decisions and assertions remain unchanged.Production LOC: +19 net across seven existing modules, carrying the existing owner/absence contract through two helpers and five diagnostic consumers. The distinct raw-message schema check preserves the existing HTTP 400 contract. Tests/support: +180 net against the rebased main, including removal of its newer broad resolver mock. No configuration, storage schema, or protocol change.
CI follow-up: after the initial checkout failures, the unchanged-head retry completed most tests but a lint runner was shut down and an unchanged system-prompt fixture exceeded120seconds. The fixture supplied a prepared provider handle without its model ID. Direct before/after tracing of the real helper observed four redundant preparations and two provider discoveries before, zero of each after supplying the existing matching model ID. The original12cases pass uninstrumented; focused typecheck, lint, formatting, and fresh isolated review pass. This one-line test-only correction changes no assertions or timeouts. The local trace proves unnecessary discovery, not that it accounts for the full hosted timeout. All temporary trace code was removed.
The source/compiled subprocess integration fixture also required its existing owner handoff to be completed. Stable2026.8.1 and current production already pass the prepared owner into terminal payload rendering; the newer integration fixture left its scoped case ownerless. The corrected fixture prepares through the matching source or compiled resolver inside the original registry scope and asserts exact hook identity before rendering. The original failure reproduced locally, then all four source/compiled × scoped/prepared flows passed with every existing hook, visible-error, no-discovery, and no-global-activation assertion intact. The compiled resolver is a test-only build entry, preserving the cross-runtime registry identity proof. Scripts/root-test types, type-aware lint, formatting, and fresh isolated review pass. This follow-up changes only tests/support (+23/-3).
CI exposed a second fixture ownership problem: the real Anthropic preparation child interpreted the full source plugin graph through Jiti on every fresh process. Windows hit the unchanged 120-second test deadline twice. A local phase probe reproduced 127.48 seconds, including 114.83 seconds in plugin module loading and 1.2 milliseconds in registration. The fixture now compiles both the child and real Anthropic public entry through the existing invocation-owned artifact builder, then runs plain Node. It retains every original failover and no-global-registry assertion and additionally verifies native artifact loading without source transforms.
The repaired case passed locally in 6.46 seconds, including 4.11 seconds of artifact preparation; the real plugin load took 279 milliseconds. Four shared artifact-owner cases also passed, including native writes, source/compiled provider hooks, cross-project lazy build, and generation retention until borrowers finish. Targeted checks and isolated review passed. On final commit
cf1733620381f04f03783871fec6f51b4a831b75, both Windows jobs passed. The real Anthropic case completed in 15.556 seconds, including 10.012 seconds of artifact preparation and 726 ms of native plugin loading, with one native hit and zero source transforms. All four source/compiled payload flows passed in 37.139 seconds. The containing Windows job completed successfully in 27m58s. Lint and dependency checks also passed. Final exact-head CI run 33390661313 completed successfully: 193 passing jobs, including the aggregate gate, and 17 intentionally skipped jobs.Follow-up: investigate source-checkout Anthropic/Jiti cold-load latency. This test fixture repair does not fix the observed source transformation cost or claim faster product startup.
Updated whole-PR LOC: production 42 added / 23 deleted (+19); tests/support 237 added / 57 deleted (+180), including an extracted 32-line native child probe.
Knip integration: the compiled child is launched by path, so its existing executable test entry must be declared in the unused-code configuration. The two-line declaration uses the canonical root-test entry mechanism, without an ignore or weakened gate. Production and full-tree unused-file scans report zero findings; targeted types, lint, formatting, and P3 review pass.