Skip to content

fix(update): update summary drops warnings and understates total time on long runs - #194242

Merged
steipete merged 9 commits into
mainfrom
codex/update-summary-accuracy
Nov 7, 2026
Merged

steipete merged 9 commits into
mainfrom
codex/update-summary-accuracy

Conversation

@steipete

@steipete steipete commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: the update summary undercounts warnings, and understates how long the update took, when a run is long or noisy.

User Impact

"N warnings need attention" stays accurate when an update produces many steps, and the report states the total time when capture or cleanup ran outside the listed phases.

Why This Change Was Made

Problem

The run ledger keeps 16 KiB and 128 steps. At either bound it evicted the oldest unnamed step, including warning:* rows such as warning:finalize:plugins:*, while later plain diagnostics survived. The summary counts warning rows, so warnings vanished from both the count and the list. #192942 fixed this only for the post-plugin Doctor warning.

The Phases: line lists recorded phases only. Pre-phase capture and terminal cleanup are not phases; on a 3 GB state database they took about 250 s and 230 s, so the line understated the update by several minutes.

Fix

  • Both ledger bounds share one eviction order: plain steps first, then warnings, then failed steps. Repair history shares the byte bound and stays chronological.
  • The report adds Total: ... only when total time exceeds the listed phases by a second or more. The CLI report adapter now carries the run timestamps that this needs.

Accepted edge case

A flood of warning rows larger than the budget still evicts the oldest warnings. Named receipts remain retained, as before.

Evidence

  • src/infra/update-run-ledger.compaction.test.ts: warning rows survive both the byte and the step bound; red on base, because the count drops.
  • src/infra/update-run-report.test.ts: the Total line and the adapter timestamps; red on base.
  • 62 tests pass across the two suites on Crabbox Linux. Native proof is not needed: this changes retained report rows, not update behavior.
  • $autoreview is scoped-clean. The independent Codex review found that repair history shared the bound; fixed in this head.

Refs #164800

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review November 6, 2026 17:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T15:22:13.164719Z 6939135 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR preserves warnings ahead of ordinary diagnostics and adds elapsed time when recorded phases omit part of an update run.

Example: A run lasts 300 seconds while its recorded activating phase lasts 60 seconds.

  • Before: The report lists activating (60s) without the overall duration.
  • After: The report also states: Total: 300s, including work outside these phases.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) A focused, useful production repair with relevant owner-boundary tests, but the allocation deterministically violates a required CI contract.
Proof confidence 🦐 gold shrimp (3/6) Ordinary proof admission is exempt for this maintainer-authored PR; supplied evidence exercises the ledger and renderer in tests rather than a shipped CLI run.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Long or noisy updates can report fewer warnings than occurred and omit elapsed time outside recorded phases.
Reason: Accurate update outcomes have clear operator value, the direction is maintainer-owned, and the change stays within existing reporting responsibilities.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this PR addresses a remaining update-reporting defect, but its test-line allocation introduces a concrete CI blocker.

Priority: P2
Reviewed head: 2e7ab18631167f35b6cf986e1a793971752409fb

Before merge

  • Reduce the allocation to the actual added test lines (P2) - The introduced tests add 40 lines, but this file grants 50. scripts/check-test-lines-ratchet.mts rejects allocation credit greater than the added test-line delta, so this value makes the required baseline check fail. Set it to 40, or the actual delta after any test revisions; the exact-head check already reports test-lines failure.

Findings

  • [P2] Reduce the allocation to the actual added test lines — config/test-lines-allocations/update-run-summary-accuracy.txt:2

Tests

  • Low-value test src/infra/update-run-report.test.ts: Replace the added timestamp field-copy assertion with rendering the adapter's result and asserting the observable Total line.
  • Missing end-to-end proof: No shipped CLI run demonstrates both retained warnings and the new Total line; the body reports red-on-base and green-on-head tests only.
Agent review details

How this fits together

Update drivers record bounded history in the shared-state ledger; the common renderer turns that history into CLI, status, and chat reports.

flowchart LR
  A[Update drivers] --> B[Step upsert]
  B --> C[Bounded ledger codec]
  C --> D[Shared state database]
  D --> E[Shared report renderer]
  E --> F[CLI status and chat]
Loading

Technical review

Best possible solution:

Keep the shared eviction policy and report changes, and reduce the allocation to the actual 40 added test lines.

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

Current main's eviction code explains warning loss at both bounds, and its renderer lacks total elapsed time; this read-only review ran no reproduction.

Is this the best way to solve the issue?

The patch repairs the existing owners with one shared eviction selector, preserves named receipts and chronological repair history, and reuses stored timestamps without new state or configuration.

Full review comments:

  • [P2] Reduce the allocation to the actual added test lines — config/test-lines-allocations/update-run-summary-accuracy.txt:2
    The introduced tests add 40 lines, but this file grants 50. scripts/check-test-lines-ratchet.mts rejects allocation credit greater than the added test-line delta, so this value makes the required baseline check fail. Set it to 40, or the actual delta after any test revisions; the exact-head check already reports test-lines failure.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Bounded diagnostic eviction changes intended behavior with a stated reason (7f9bf1d: Retain lifecycle and recovery receipts while bounding diagnostic storage; this PR explains why ordinary diagnostics should yield before warnings and failures.)
  • Step-count compaction keeps the original intent (29503e1: Keep the codec-dependent retention decision outside the UI-safe step module; the replacement selector preserves that placement and named receipts.)
  • Shared report and result adapter keeps the original intent (2bf30ba: Use one renderer for durable update outcomes across CLI, chat, and status; elapsed-time reporting extends that same owner.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:test-lines-ratchet --base 2a2cd29 --no-merge-base
  • git diff --check
  • Verify checks-fast-baseline-ratchets passes on the repaired head.

What I checked:

PR surface

Source +32, Tests +40, Other +2. Total +74 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 46 14 +32
Tests 2 40 0 +40
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 6 88 14 +74

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Missing update warnings and incomplete elapsed-time reporting are bounded user-facing diagnostic defects.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Missing update warnings and incomplete elapsed-time reporting are bounded user-facing diagnostic defects.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

Reviewed November 6, 2026, 12:42 PM ET / 17:42 UTC.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6939135b5b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +411 to +415
const totalMs =
run.createdAtMs == null || run.finishedAtMs == null ? 0 : run.finishedAtMs - run.createdAtMs;
// Capture and terminal cleanup run outside these phases; large state makes them long.
if (totalMs - phaseMs >= 1_000) {
lines.push(`Total: ${formatDurationPrecise(totalMs)}, including work outside these phases.`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Measure total time through terminal cleanup

For CLI updates with slow recovery cleanup, finishedAtMs excludes precisely the work this new total is intended to expose. prepareUpdateCommandTerminalResult in src/cli/update-cli/update-command-terminal.ts completes the run and prepares the report before awaiting automaticallyCleanUpdateRecovery; the subsequent report projection adds cleanup diagnostics without changing the timestamps. Moreover, ordinary phase transitions close one phase when opening the next, and terminalization closes the final phase at finishedAtMs, so their durations normally sum to this same totalMs and suppress the new line entirely. A cleanup taking several minutes therefore still goes unreported. Capture elapsed command/report timing through cleanup separately from the deliberately settled ledger outcome.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 19446cf into main Nov 7, 2026
132 checks passed
@steipete
steipete deleted the codex/update-summary-accuracy branch November 7, 2026 16:46
@steipete

steipete commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
… on long runs (openclaw#194242)

* fix(update): keep warnings in the run summary and state total time

* test(update): fix report duration expectation

* style: format

* test(update): fix total duration expectation

* fix(update): carry run timestamps into the CLI report

* fix(update): keep repair history chronological at the ledger bound

* test(update): type the report step fixture

* chore: match the test-line allocation to added lines
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
… on long runs (openclaw#194242)

(cherry picked from commit 19446cf)

Release adaptation: Adapt warning/failure-aware bounded eviction to target existing upsertStep in update-run-write.ts (source split update-run-step-upsert.ts absent); no owner relocation. Include recorded elapsed report and focused long-run regressions. Preserve retained receipts and chronological repair history; no SQLite schema change.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 681267df3a9ae6f061ee9680be8ae5c0b7a1e03d)
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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant