Repository navigation
refactor(runtime): deslop error handling and normalization - #165601
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. |
l387 production coverage, part 1/3 — all entries READl387 error/normalization coverageCandidate:
|
|
l387 production coverage, part 2/3 — all entries READ
|
l387 production coverage, part 3/3 — all entries READ
|
|
Codex review: blocked before merge. Reviewed October 5, 2026, 1:02 PM ET / 17:02 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch consolidates runtime error handling and normalization, fixes cron ancestry classification through cycles, and removes a historical Doctor repair. Merge readiness⛔ Blocked before merge - 5 items remain The prior supported-upgrade finding remains unresolved. This maintainer-authored PR contains useful work that current main and the related merged cleanups do not supersede. Priority: P2 Review scores
Verification
How this fits togetherRuntime helpers prepare provider requests, session metadata, diagnostics, and stored state for OpenClaw consumers. Doctor separately converts supported historical database rows into the canonical shapes those consumers expect. flowchart LR
A[Configuration and requests] --> B[Validation and normalization owners]
B --> C[Runtime consumers]
C --> D[Provider and Gateway results]
E[Historical database rows] --> F[Doctor repairs]
F --> G[Canonical session state]
G --> C
Before merge
Findings
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep supported historical canonicalization in Doctor until its actual shipped writers leave the retention window, while runtime continues consuming canonical state. Do we have a high-confidence way to reproduce the issue? Yes, from source: seed a subagent row with delivery.suspendedReason set to retry-limit and run Doctor repair; the branch no longer converts it. The deleted regression defines this check, but this read-only review did not execute it. Is this the best way to solve the issue? No: consolidating normalization at existing owners is appropriate, but retiring this transform contradicts the verified released writer and publication-date retention contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f751aa513364. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
2be902a to
6cdc95a
Compare
Claws lifecycle CI blockerExact-head CI at The failing test starts a serving Gateway before removal (test:348). The CLI starts the deletion journal before the monitor-quiesce RPC (lifecycle-config-removal.ts:180); that local transaction enters An existing repair is already owned by #164265, verified OPEN at This is source attribution, not a clean-base runtime reproduction. The related PR body and comments contain no matching clean-base lock-timeout run; its body explicitly says final-head serving-Gateway Claw lifecycle proof remains in progress. Remote replay capacity is unavailable in this lane. The affected-path CI failure remains blocking until the existing owner repair lands/is validated and this lane is retested; no admin exception is claimed from source comparison alone. |
Shrink assertion baselines to match removed casts.
6cdc95a to
2a7e1fb
Compare
Round 1: same-host attribution and pre-push gatesMain: The comparison ran on one Linux x86_64 Hetzner machine with 8 CPUs, Node 24.21.0 and pnpm 12.5.1. Both revisions used separate detached Git worktrees, separate dependency links and separate canonical private-QA runtime/AI builds. Every invocation verified its exact SHA and clean tracked source. The order was main-1, candidate-1, candidate-2, main-2, main-3, candidate-3; each visit ran both files. Times below are full test-command wall times, excluding the upfront builds.
Claws: all six runs fail only the same removal case, with Restored requester: all four cases pass in all six runs. The prior deadline failures do not reproduce on either side after the base refresh. This does not identify the cause of the historical failure; any recurrence in exact-head CI still requires attribution. Canonical setup in each detached checkout: pnpm install --frozen-lockfile
OPENCLAW_BUILD_PRIVATE_QA=1 OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=0 node scripts/prepare-vitest-runtime.mjs --require-current-head
node --import tsx scripts/tsdown-build.mts --config tsdown.ai.config.tsEach repeated invocation used the completed-artifact contract: OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs <exact-test-file>No test was weakened, skipped, retried to hide a failure, or given a longer timeout. Runtime import cycles and Madge cycles are both zero on both revisions. Candidate focused proof passes 7 files / 145 tests in 245.9 seconds, including greeting, memory-corpus, schema-cache, state-execution and both previously failing Doctor files. The 17 test/check logs were downloaded and matched their remote SHA-256 hashes. Fresh independent review reported one alleged P1 at Auto-merge was disabled before the leased push. Exact-head CI is pending; no CI failure is waived by this comment alone. |
Landing attribution for the rebased headCandidate: The paginated exact-head check census is terminal: 164 success, 42 skipped, 1 neutral, and 7 failure. Six test jobs failed; the seventh is their aggregate CI gate. Lint, types, baseline ratchets, build artifacts, UI, and security checks passed. Same-host A/BBoth revisions used separate clean detached checkouts, dependency links and canonical runtime/AI builds on one Linux Hetzner lease. Commands retained every original assertion and timeout.
Claws fails only the same removal case in all six runs: Under the restored-requester CI resource profile, all six runs fail the same three Each repeated command was Every failed jobCurrent independent main evidence is hourly run 37349110851, head
Runtime import cycles and Madge cycles remain zero on both detached revisions. Candidate focused proof passes 7 files / 145 tests. Review adjudication is recorded in the earlier evidence: the alleged upload-bound finding was unreachable under the retained buffering predicate and early return; no accepted P0/P1 finding remains. SSH replay and remaining blocker: BLOCKEDThe original SSH CI job used eight effective CPUs and a two-fork, non-isolated project. The exact five-file project cohort was replayed on both detached revisions with Node 24.19, eight effective CPUs, and the same 33,229,729,792-byte cgroup limit (physical RAM on the replay host was 32,852,045,824 bytes). Main passed all 5 files / 63 tests in 308.090s; candidate passed all 5 / 63 in 309.144s. Argument order preserved the CI selection; Vitest retained its native parallel scheduling. OPENCLAW_E2E_USE_PREBUILT_DIST=1 OPENCLAW_VITEST_MAX_WORKERS=2 OPENCLAW_TEST_PROJECTS_PARALLEL=1 NODE_OPTIONS=--max-old-space-size=8192 \
node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-database-workers.config.ts \
src/gateway/gateway-ssh-upload-signal.test.ts \
src/gateway/github-publication-requester-aliases.test.ts \
src/gateway/github-publication-requester.test.ts \
src/gateway/server-methods/models-list.remote-catalog.integration.test.ts \
src/gateway/server-methods/models-list.worker-recovery.integration.test.tsA fixed three-run comparison of the entire SSH test file also passed on both sides: main 61.770 / 62.421 / 63.224s; candidate 62.873 / 62.622 / 62.171s. All six runs executed the test. Separate ACP-file controls passed all 12 cases on each revision (135.960s main, 138.321s candidate); the ACP main-red classification instead rests on its actual matching failure in current main CI. A final reduced-resource main probe (Node 24.19, two effective CPUs, 8,218,361,856-byte memory limit) also passed the complete SSH file in 67.371s. Its predeclared protocol would run the corresponding candidate control only after a matching main failure; that condition was not met. Passing SSH replays do not explain or clear the hosted failure. No exact independent SSH failure appeared in the failed jobs of the 14:38, 15:34, 16:37, or 17:31 main runs checked, or the bounded unrelated-PR lookup. This does not claim the successful jobs ran that file. Source tracing identifies live session-fact invalidation, but not which row change or awaited read caused this instance. The comparative runs do not establish a candidate-only failure predicate for a meaningful bisect. Additional coordinator-owned main failure observed in the 17:31 run: checks-node-compact-small-43 / 111895596787, BLOCKED: SSH remains unattributed. Auto-merge remains disabled, and no merge was attempted. The next required evidence is a matching independent main failure or a reproducible candidate-only failure that can be bisected and fixed. The branch remains clean at the reviewed head; the measured diff remains -595 production LOC across 109 files, with the existing 883-file coverage log attached to the PR. |
|
Coordinator admin-merge evidence for head Remaining item:
The other failures (Claws cron-authority lock, restored-requester admission, incognito authorization, git status, ACP session-facts, membership-authority timeout) were reproduced on main by same-host A/B and/or main run 37349110851. |
…165601) * refactor(runtime): deslop error handling and normalization * refactor(runtime): keep sanitizer within existing lint rules * refactor(ai): share normalized schema cache returns Shrink assertion baselines to match removed casts. * fix(runtime): preserve lint-safe error and greeting handling
What Problem This Solves
Runtime consumers repeat error conversion, normalization, and validation already owned by their producers, and several private forwarding layers obscure the actual operation.
User Impact
The cleanup preserves public config, SDK and protocol shapes, diagnostics, error codes, cleanup, and authority checks. A memory-corpus fix correctly identifies cron-generated lineage through cycles. The expired June 2026 suspension-reason repair is retired under the July-and-later migration policy; July+ schema migrations remain intact.
Why This Change Was Made
This is one accumulated runtime cleanup batch. It removes 595 net production lines (109 production files), plus 38 net test lines. It is below the campaign's 1,000-line target after a complete largest-first sweep; the attached coverage records every one of the lane's 883 production files over 200 lines, including peer-owned paths left unchanged. No code moved to another tree.
Simplifications and ownership rationale
Fixes found along the way
Cron lineage traversal cached a false answer for a cycle member before another parent established the cycle's cron ancestry. Positive lineage now propagates through the edges actually traversed, preserving existing duplicate-row selection. The existing session corpus boundary test now covers a cycle with a pruned cron parent.
Evidence
2a7e1fb53a5aae27a844c03bf73b5e30d6915424, rebased without conflicts onto3117493fe6ab64de6e04c7418bcb13e55f947b56.cycle-bis absent. Previous single-workersession-files.test.tsproof: 708.85 s wall time including cold preparation, 456.75 s Vitest duration. Its 35 cases also pass in the current focused run.37343803462completed with 164 successful, 42 skipped, 1 neutral, and 7 failed checks (six test jobs plus their aggregate gate). Claws and restored-requester have comparable main A/B failures; current-main run37349110851independently matches Incognito, ACP, Git-status and membership failures. The hosted SSH uploadGatewaySessionFactsChangedDuringReadErrorremains unattributed despite passing replays. Auto-merge stays disabled; no merge was attempted. Fullcheck-changedis not claimed complete.Coverage log
Complete size-sorted READ inventory (883 files): part 1, part 2, part 3. The inventory preserves original sweep sizes and identifies the one additional file that crossed 200 lines during the earlier rebase. Protected recovery and staging files remain untouched.