Skip to content

fix(diagnostics): stop labeling stale phases as recent - #119625

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/fix-diagnostic-phase-recency-20260805
Aug 5, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/fix-diagnostic-phase-recency-20260805

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Related: #119607

Prior active-phase eviction attempt: #83669

What Problem This Solves

Fixes an issue where operators investigating a Gateway liveness warning could
see an old completed phase labeled as recentPhases merely because fewer than
40 newer phases had completed. During the August 5, 2026 Gateway stall
investigation, that made a historical post-ready.context-window-cache timing
look causally related even though the retained ring had no age filter.

Why This Change Was Made

Liveness warnings now attribute only phases completed during that liveness
sample's actual interval. The bounded phase ring remains available as retained
history, and long-running active phases remain visible; this deliberately avoids
the arbitrary global active-phase timeout proposed in #83669.

User Impact

Gateway liveness diagnostics no longer imply that capacity-retained historical
work was recent. Operators still receive complete timing, CPU, and detail fields
for phases that completed during the measured interval.

AI-assisted change; I reviewed the owner boundary, tests, and runtime evidence.

Evidence

  • Red on unmodified bf7840f5391a: ten minutes after completion,
    post-ready.context-window-cache was still returned as recent; a separate
    one-hour active phase remained active.
  • Head opaque probe on Blacksmith Testbox
    31010388554:
    the rendered warning and structured liveness event contained only
    recent.phase, omitted stale.phase, preserved timestamps, duration, CPU,
    ratio, and details, and kept the one-hour active phase visible.
  • Focused exact-base Testbox proof: 84/84 logging tests passed.
  • Exact-base pnpm check:changed: passed.
  • Autoreview: clean, no accepted/actionable findings.
  • Source-blind behavior validation: clauses for stale exclusion, retained
    history, structured/log attribution, field preservation, and active-phase
    visibility passed; implementation-only cost and unrelated Gateway surfaces
    remained outside black-box observability.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 5, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 12:04 PM ET / 16:04 UTC.

ClawSweeper review

What this changes

The PR limits completed diagnostic phases shown in Gateway liveness warnings to the warning’s sampled interval while preserving retained phase history and active-phase reporting.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. The exact-head patch is a narrow, correct diagnostic-attribution repair that current main does not contain; it needs the failed exact-head check resolved and lint completed before normal maintainer handling.

Priority: P2
Reviewed head: 1aa0f6d2a251b3412fbf0bca5e112a666d94fcff

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrowly scoped and well-covered with no code finding; exact-head CI must still finish cleanly before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is outside the external-contributor proof gate; its linked after-fix Testbox trace is nevertheless useful supporting evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is outside the external-contributor proof gate; its linked after-fix Testbox trace is nevertheless useful supporting evidence.
Evidence reviewed 7 items Liveness owner boundary: The heartbeat derives the completed-phase cutoff from its captured time and the liveness sample interval, then uses that same filtered list for warning attribution.
History semantics preserved: The optional completed-after selector filters only callers that request attribution; the default still returns the capacity-bounded retained history and active phases remain separately reported.
Sampler contract: Both the built-in and Gateway lifecycle liveness paths provide an interval measured and rebased by their monitor on the same synchronous heartbeat path.
Findings None None.
Security None None.

How this fits together

Gateway heartbeats sample liveness and emit warning logs plus structured events. Diagnostic phases provide timing context, so the warning should show completed work from the sampled interval rather than capacity-retained historical work.

flowchart LR
  A[Gateway heartbeat] --> B[Liveness sample]
  B --> C[Measured interval]
  D[Completed phase history] --> E[Interval attribution]
  C --> E
  F[Active phase] --> G[Liveness warning]
  E --> G
  G --> H[Log and structured event]
Loading

Before merge

  • Resolve merge risk (P1) - One exact-head compact check is failing and lint was still running in the supplied status, so the merge gate is not yet demonstrated; no evidence ties the failure to this patch.
Agent review details

Security

None.

PR surface

Source +15, Tests +85. Total +100 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 19 4 +15
Tests 2 86 1 +85
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 105 5 +100

Review metrics

Metric Value Why it matters
Production vs test LOC production +19/-4 (net +15); tests +86/-1 (net +85) The production growth is justified by the new attribution boundary, with direct regressions covering retained history, active phases, logs, and structured events.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land this owner-boundary filter after the exact-head check failure is resolved or shown unrelated and all required checks complete green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land this owner-boundary filter after the exact-head check failure is resolved or shown unrelated and all required checks complete green.

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

Yes—source shows retained completed snapshots were passed to liveness warnings without an interval filter, and the PR body records a focused before/after Testbox scenario; no local execution was needed for this read-only review.

Is this the best way to solve the issue?

Yes—the filter belongs at the liveness attribution projection, leaving the reusable retained-history API and legitimate active-phase reporting unchanged.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 113af2fcbd02.

Labels

Label justifications:

  • P2: The fix improves the accuracy of Gateway liveness diagnostics with limited runtime blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is outside the external-contributor proof gate; its linked after-fix Testbox trace is nevertheless useful supporting evidence.

Evidence

What I checked:

  • Liveness owner boundary: The heartbeat derives the completed-phase cutoff from its captured time and the liveness sample interval, then uses that same filtered list for warning attribution. (src/logging/diagnostic.ts:426, 1aa0f6d2a251)
  • History semantics preserved: The optional completed-after selector filters only callers that request attribution; the default still returns the capacity-bounded retained history and active phases remain separately reported. (src/logging/diagnostic-phase.ts:50, 1aa0f6d2a251)
  • Sampler contract: Both the built-in and Gateway lifecycle liveness paths provide an interval measured and rebased by their monitor on the same synchronous heartbeat path. (src/gateway/server/event-loop-health.ts:122, 39bbd8afd338)
  • Regression coverage: Tests cover stale completed-phase exclusion from both the rendered warning and structured event, while retaining historical lookup and active-phase visibility. (src/logging/diagnostic.test.ts:2411, 1aa0f6d2a251)
  • Feature provenance: Blame ties the pre-existing liveness and phase-ring behavior to the recent diagnostics work in commit 39bbd8a; the proposed attribution change is isolated to the PR head. (src/logging/diagnostic.ts:421, 39bbd8afd338)
  • Current-main and release status: The PR base is contained by current main but the PR head is not, so the four-file attribution change is neither on current main nor in the latest release v2026.7.1-2. (113af2fcbd02)

Likely related people:

  • steipete: Blame attributes the existing liveness/phase-ring implementation and monitor contract to the recent diagnostics work. (role: recent diagnostics and liveness owner; confidence: high; commits: 39bbd8afd338; files: src/logging/diagnostic.ts, src/logging/diagnostic-phase.ts, src/gateway/server/event-loop-health.ts)
  • fuller-stack-dev: Authored this repair and the related merged Gateway liveness investigation work. (role: related Gateway diagnostics contributor; confidence: high; commits: bf7840f5391a, 1aa0f6d2a251; files: src/logging/diagnostic.ts, src/logging/diagnostic-phase.ts)

Rank-up moves

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

  • Resolve or rerun the failed exact-head compact check and wait for lint to complete.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-05T14:21:26.797Z sha 294a2eb9bb5fbc0012518fc25b355db75b778bcf :: needs maintainer review before merge. :: none

@fuller-stack-dev
fuller-stack-dev force-pushed the codex/fix-diagnostic-phase-recency-20260805 branch from 294a2eb to 1aa0f6d Compare August 5, 2026 15:45
@fuller-stack-dev
fuller-stack-dev merged commit 40b0b3d into openclaw:main Aug 5, 2026
187 of 189 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant