Skip to content

fix: keep a crashed Inspector run from looking like a clean scan - #4351

Merged
Patrick-Erichsen merged 8 commits into
openclaw:mainfrom
SebTardif:fix/inspector-crash-is-not-clean
Nov 6, 2026
Merged

Patrick-Erichsen merged 8 commits into
openclaw:mainfrom
SebTardif:fix/inspector-crash-is-not-clean

Conversation

@SebTardif

@SebTardif SebTardif commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A crashed Plugin Inspector run still stored completedAt. The moderator validation report treats the newest scan row as finished, so a crash with no matching nightly warnings was reported as clean and older nightly findings dropped out.

A crash with no earlier findings scan should stay not-scanned, and that release should stay in the next inventory claim. A later crash of a tuple that already stored findings should keep those findings.

Rows written by the current stable release have completedAt and do not have findingsCompletedAt or inspectionFailed. This pull adds those fields as optional and does not rewrite old rows. An old findings scan still loads. An old crash that was stored only as completedAt still looks like a finished scan, because the stable release never recorded that the attempt crashed. That historical choice needs a maintainer decision.

This does not reopen closed pull #3973. That pull was closed unmerged.

Ref #4221

Evidence

Local anonymous Convex at 127.0.0.1:3252. Stable tag v0.25.1, commit 1f3ab43, wrote two packages and their scan rows. Candidate commit 9200630 was then deployed onto that same database.

v0.25.1 packages:ingestPackageInspectorScanResultsInternal stored a findings scan for f036-plugin 1.0.0, inspector 0.4.3, target 2026.10.16, code missing-api. The same stable mutation stored a crash-only attempt for f036-crash-plugin. convex data packageInspectorScanStates showed neither row had findingsCompletedAt or inspectionFailed:

{ "_id": "pd73mqcmtzf692fnh89srqpa9d8hhp4v", "completedAt": 1793737914592, "inspectorVersion": "0.4.3", "packageId": "r973an94q7mfts39nvr79qc9398hg907", "releaseId": "qd7czaa1ba0r8syhz4q75z2h9d8hhwz3", "targetOpenClawVersion": "2026.10.16" }
{ "_id": "pd7613n1m56tpe5d7mznrpa18x8hgc34", "completedAt": 1793737944366, "inspectorVersion": "0.4.3", "packageId": "r9778gqrbmp1zjphqe8nd8rfcx8hg988", "releaseId": "qd7e4vqckyy0x2jtab0q71cvcd8hg12a", "targetOpenClawVersion": "2026.10.16" }

packages:listPluginValidationReportPageInternal on that stable deployment:

f036-crash-plugin scan.status clean scannedAt 1793737914592 findings []
f036-plugin scan.status error scannedAt 1793737944366 findings missing-api severity error

The candidate deploy added one index and reported Convex functions ready. The same report query, before any new write, returned the same two scan results. convex data still showed the original rows, including the f036-plugin completedAt 1793737944366 and the applied sdk inventory.

The candidate packages:ingestPackageInspectorScanResultsInternal then posted inspectionFailed for the f036-plugin tuple. convex data after that write:

{ "_id": "pd7613n1m56tpe5d7mznrpa18x8hgc34", "completedAt": 1793737961353, "findingsCompletedAt": 1793737944366, "inspectionFailed": true, "inspectorVersion": "0.4.3", "packageId": "r9778gqrbmp1zjphqe8nd8rfcx8hg988", "releaseId": "qd7e4vqckyy0x2jtab0q71cvcd8hg12a", "targetOpenClawVersion": "2026.10.16" }

The report for f036-plugin stayed status error, finding missing-api, scannedAt 1793737944366. packages:previewPackageInspectorScanBatchInternal for inspector 0.4.3 and target 2026.10.16 returned item packageName f036-plugin and skipped f036-crash-plugin with reason unchanged-findings-scan.

Real behavior proof

  • Behavior or issue addressed: A crashed Plugin Inspector retry made the moderator validation report look clean, or hid findings already stored for that inspector and target. Existing scan rows from the stable release must still load after this schema change.
  • Real environment tested: macOS, Node v24.15.0, local anonymous Convex at 127.0.0.1:3252. Stable functions came from tag v0.25.1 commit 1f3ab43. The candidate deploy was commit 9200630 on that same database.
  • Exact steps or command run after this patch: Deployed v0.25.1, inserted f036-plugin and f036-crash-plugin, stored a findings scan and a crash-only attempt with packages:ingestPackageInspectorScanResultsInternal, and read packages:listPluginValidationReportPageInternal plus packageInspectorScanStates. Deployed this pull onto that database, read the same report and rows again, posted inspectionFailed for the f036-plugin tuple, then read the report, the rows, and packages:previewPackageInspectorScanBatchInternal.
  • Evidence after fix: terminal output from the local Convex deployment:
[+] packageInspectorScanStates.by_release_and_findings_completed_at   releaseId, findingsCompletedAt, _creationTime
{ "completedAt": 1793737944366, "inspectorVersion": "0.4.3", "packageId": "r9778gqrbmp1zjphqe8nd8rfcx8hg988", "targetOpenClawVersion": "2026.10.16" }
{ "completedAt": 1793737961353, "findingsCompletedAt": 1793737944366, "inspectionFailed": true, "inspectorVersion": "0.4.3", "packageId": "r9778gqrbmp1zjphqe8nd8rfcx8hg988", "targetOpenClawVersion": "2026.10.16" }
report f036-plugin status error scannedAt 1793737944366 finding missing-api
claim item packageName f036-plugin
claim skipped packageName f036-crash-plugin reason unchanged-findings-scan
  • Observed result after fix: After the upgrade, and before any new write, f036-plugin stayed status error for inspector 0.4.3 with finding missing-api, and scannedAt stayed 1793737944366. The crash of that same tuple copied 1793737944366 into findingsCompletedAt, set inspectionFailed, and moved completedAt to 1793737961353. The report scannedAt stayed 1793737944366. The next inventory claim returned f036-plugin. f036-crash-plugin, whose stable row has only completedAt, stayed status clean and was skipped as an unchanged findings scan.
  • What was not tested: The hosted clawhub.ai deployment, and a signed-in browser session of GET /api/v1/packages/validation-report. Historical rows that have only completedAt are not rewritten.

A failed nightly run still wrote completedAt, so the moderator validation
report treated that row as a clean scan and dropped older nightly findings.
findingsCompletedAt stays on the last findings scan, and a crash remains
eligible for the next inventory claim.

Ref openclaw#4221

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif
SebTardif requested review from a team and Patrick-Erichsen as code owners November 3, 2026 20:04
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@SebTardif is attempting to deploy a commit to the OpenClaw Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@clawsweeper

clawsweeper Bot commented Nov 3, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Separate completed Inspector findings from failed attempts so crashes preserve findings and remain eligible for another scan.

Example: Inspector 0.4.3 targeting OpenClaw 2026.10.16 crashes after f036-plugin 1.0.0 recorded missing-api.

  • Before: The report advances scannedAt to the crash time.
  • After: The report preserves missing-api and its original findings timestamp, and the release remains eligible for scanning.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Real behavior and existing-state compatibility are demonstrated, with no blocking code findings; unresolved product direction and duplicate test coverage limit overall readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The current macOS local Convex transcript demonstrates a v0.25.1-to-head upgrade on the same database, preserved findings and timestamps, and retry eligibility after failure; linked production-results transcripts exercise crash-only and mixed-format cases against verified identical owner functions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: Moderators can see a crashed Inspector run as clean or see its attempt time presented as the findings scan time.
Reason: The repair has clear value for new attempts, but adds persisted fields and deliberately leaves ambiguous historical crashes treated as completed scans.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR addresses a current-main defect and has no blocking code findings; acceptance of its historical-row policy remains unresolved.

Priority: P2
Reviewed head: 9200630677881f02106a926ce97e337acf726492
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the additive scan-state contract continue treating unmarked historical rows as completed findings, or require a successful rescan before they establish a clean result?
  • Recommendation: Require verified success for ambiguous rows: Preserve existing findings while making ambiguous historical rows eligible for rescanning and requiring successful inspection before reporting verified clean.
  • Why: The upgrade proof demonstrates compatibility and the retained false-clean historical case, but no recorded owner decision accepts that tradeoff.

Before merge

  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Tests

  • Low-value test convex/packages.public.test.ts: Remove the added same-tuple, mixed-format and older-findings mock selection cases duplicated by runtime coverage; their hand-built ordering mock adds maintenance without distinct failure coverage.
  • Low-value test convex/packageSdkUsage.runtime.test.ts: Remove the redundant 21-crash legacy-selection case; the 26-crash case covers that behavior and crosses the actual 25-row page boundary.
  • Missing end-to-end proof: A base-fail/head-pass execution of the added regression tests is not shown.
Agent review details

How this fits together

The nightly worker submits Inspector results to Convex, which stores findings and scan metadata consumed by moderator validation reports and inventory claims.

flowchart LR
  Worker[Inspector worker] --> Endpoint[Results endpoint]
  Endpoint --> Recorder[Scan recorder]
  Recorder --> Storage[Findings and scan states]
  Storage --> Report[Moderator validation report]
  Storage --> Claims[Inventory scan claims]
Loading

Technical review

Best possible solution:

Separate findings completion from attempts in the existing recorder, preserve stored findings, and explicitly settle the treatment of ambiguous historical rows.

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

Current-main source establishes the failed-attempt-to-false-clean path; contributor terminal output demonstrates the symptom and recovery, but this read-only review executed no target code.

Is this the best way to solve the issue?

Best-fix verdict: best at the existing persistence owner; filtering failed rows loses same-tuple successes, and a fixed lookback hides older findings, while separate timestamps handle both.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Patrick Erichsen: Raw commit 43b61dc adds convex/lib/packageSdkUsage.ts:96 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 43b61dcfb40a; files: convex/lib/packageSdkUsage.ts)
  • Peter Steinberger: Raw commit 7428920 adds specs/plugin-inspector-reliability.md:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 742892066ac0; files: specs/plugin-inspector-reliability.md)

Review metrics

Metric Value Why it matters
Change distribution Production +100/-11; tests +700/-14; specification +17/-0 The persistence repair is focused, but duplicate mock selection cases and redundant runtime coverage inflate the test changes.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #4221
Summary: This PR repairs the scan-state defect tracked by the open issue and carries forward the earlier unmerged candidate.

Members:

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: Incorrect moderator validation results, findings timestamps and retry eligibility have a limited operational blast radius.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Optionally remove duplicate mock selection coverage and the redundant 21-crash runtime case while retaining distinct runtime regressions.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-03T20:20:16.569Z sha 9200630 :: needs real behavior proof before merge. :: none

Reviewed November 3, 2026, 3:43 PM ET / 20:43 UTC (Revision 2).

@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The pull body now records the v0.25.1 upgrade on the same local database. The stored scan rows are shown before the deploy and after the crash posted by this head.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient Contributor real behavior proof is sufficient. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Collaborator

Failed Plugin Inspector attempts no longer establish a clean result. Ambiguous historical attempts remain unknown until a verified successful scan; actual prior findings and verified completion time/source survive crashes, and failed attempts stay eligible for retry. Inspector remains advisory; ClawScan trust and publication behavior are unchanged.

LOC: +933/−72 (7 files against integrated main). No blocking findings remain.

Head: e878d7e801e65c13f66795f3bd5135c4378167f1 · integrated main: c385b365ba57d4050a4461641ff9094589dcff34 · reviewed Inspector runtime: 8649513bb8a8fd32f73279e497137f495bb38d66.

Real disposable Convex proof used the same persisted database before and after upgrade, through the moderator report and worker claim/results HTTP routes:

State Baseline → candidate
Legacy empty attempt without success evidence clean → not-scanned/unknown, claimable
Failed retry skipped report, still claimable
Verified rescan, then another crash prior clean/time retained, claimable again
Historical actual finding, then crash error retained
Verified success behind 30 newer failed targets skipped → clean
Publish verdict plus older nightly error, then failed retry publish provenance and nightly error retained

A main-era outcome-only verified row retains completion time 100 when its exact tuple crashes. Missing/malformed failure payloads clear stale timeout diagnostics. Negative controls preserve private-package exclusion and report authorization (anonymous 401, ordinary account 403, moderator 200). Temporary fixtures were removed and the final schema push/codegen typechecked.

The query-page regression uses the real paginator over a fixture index: 61 publish-only rows read 63 rows before and at most 26 afterward, with identical latest verdict. Failure-only/ambiguous history can still require every distinct Inspector/target tuple; retries overwrite a tuple. No cap hides older evidence and no production backfill is included. Legacy publish findings remain visible while scan metadata stays unknown without verified completion.

Integration gate repair removes only an obsolete 17-line detailed setup-prompt test and unused parser import. Main #4467 retired that interface after #4132 added the test. Current compact prompt/CLI and scalar parser/scanner/API regressions remain. The Inspector patch is unchanged against the integrated main; five files are byte-identical to 8649513 and schema adds only #4468’s two unrelated optional fields. Actual persisted Inspector report and claim payloads are identical before/after integration.

Local validation: 580 focused tests (including 452 Inspector tests), static checks, full TypeScript/schema/CLI/admin types, production build, package checks, secretless HTTP, and real local Convex schema push/codegen passed. Full unchanged local coverage passed 8,987 tests with 5 existing skips at 8649513; that result remains attributed to 8649513. Exact final-head hosted full coverage is required before merge. Complete branch review, the final diagnostic repair review, and the integration/cleanup review cover P0–P3; accepted findings are addressed.

Crashes were simulated through supported worker payloads; no actual Inspector/provider execution, external dispatch, production writes/backfill, or manual deployment occurred. This is persisted-state/API proof, not a production observation.

@Patrick-Erichsen
Patrick-Erichsen merged commit b033747 into openclaw:main Nov 6, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants