Skip to content

fix(bay): measure review journeys to final receipt - #1238

Merged
brokemac79 merged 1 commit into
mainfrom
codex/csw-139-bay-e2e-telemetry
Aug 25, 2026
Merged

brokemac79 merged 1 commit into
mainfrom
codex/csw-139-bay-e2e-telemetry

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1237

Summary

Make OpenClaw Bay's review timing an end-to-end measure: the verified GitHub
triggered_at request boundary through the correlated, explicit final review
receipt. Add a compact five-minute median/mean chart to the last-hour Bay
header.

Contract

  • Do not use lane age, queue admission, job/action start, or router-terminal
    time as a duration boundary.
  • Publish a duration only for a correlated triggered_at to final-receipt
    pair, capped at 24 hours.
  • Requeues, retries, supersessions, malformed/capped values,
    stale/uncorrelated receipts, private data, and incomplete snapshots fail
    closed.
  • Preserve a durable pending marker when a newly observed final receipt cannot
    materialize immediately; reconciliation retries it.
  • Preserve the public v1 bay.timings.source enum
    durable_exact_review_lifecycles; expose
    completion_source=verified_final_review_receipts additively.
  • Start a fresh v2 aggregate rather than reinterpreting v1 routing timings. It
    intentionally warms for one hour.

Implementation

  • Adds v2 durable Bay timing tables and exact final-receipt provenance.
  • Keeps public cards free of raw timestamps; active cards say timing is still
    being verified rather than inventing lane ages.
  • Rejects malformed v2 aggregates/history and public terminal rows outside the
    cap.
  • Adds the bounded timing-history SVG chart and updates the deployment-smoke
    provenance assertion.

Validation

node --test test/dashboard-worker-bay-records-routes.test.ts test/dashboard-worker-observability.test.ts test/dashboard-smoke.test.ts
# 130 pass, 0 fail
pnpm run check:docs
pnpm exec oxfmt --check dashboard/worker.ts docs/proof/bay-authoritative-lifecycle/run-proof.mjs docs/proof/bay-public-reference-blade/run-proof.mjs scripts/dashboard-smoke.mjs test/dashboard-smoke.test.ts test/dashboard-worker-bay-records-routes.test.ts test/dashboard-worker-observability.test.ts
git diff --check

The range was rebased onto origin/main at ed20a56037; range-diff shows
the product commit unchanged across that documentation-only base advance.

Real Behavior Proof

Claim: A real Worker and Durable Object publish a Bay duration only when a
public review has a correlated final receipt; the aggregate remains fail-closed
while its one-hour coverage is incomplete, while a verified terminal card and
tide progress remain visible.

Scenario: On head ff2afbe55d6c7e959e521c2b4d14e42f3dd3004c, the maintained
authoritative lifecycle fixture starts Wrangler locally, signs lifecycle
requests, exercises durable public review and re-review completions, obtains
the explicit final command receipt, and drives the public status route and a
real Chromium Bay render. It also materializes one private-scope completion and
proves it is excluded from the public aggregate.

Command/environment:

BAY_LIFECYCLE_PROOF_OUTPUT=.artifacts/csw139-local-browser-6 \
PLAYWRIGHT_CHROMIUM_EXECUTABLE=<local Chromium> \
bash docs/proof/bay-authoritative-lifecycle/run-proof.sh

Observed result: proof-summary.json reports 143 assertions passed,
metrics_state=warming, 21 public timing samples, one completed 20-review tide,
one retained terminal card, and last_tide_at. The status contract retained
source=durable_exact_review_lifecycles and emitted additive
completion_source=verified_final_review_receipts. The UI withheld the
partial last-hour average during warming but rendered the verified terminal
journey duration. The private-scope fixture did not enter the public aggregate
or terminal buffer. Local artifacts are ignored by Git and contain only the
synthetic fixture state and screenshot.

Crabbox proof: the same head and maintained fixture also passed on the resolved
AWS Crabbox provider: run run_a9abe65f5ab9, lease cbx_cb0367778877, Linux
c7a.8xlarge, promoted image ami-0461d919be7deb53c. The provider recorded
exit code 0 and the 143-assertion result above. It downloaded the remote
proof-summary.json and rendered bay-lifecycle-metrics.png into the local
ignored proof artifact directory. The first AWS attempt (run_dc7239526d42)
failed before execution because the Windows-synced shell launcher had CRLF;
the successful retry used an ephemeral LF-normalized copy only, with no source
change.

Limits: Docker Desktop's Linux daemon is unavailable on this host. The AWS
proof provides the policy-required isolated-provider run. The short controlled
scenario intentionally does not advance a full hour, so it proves warming and
terminal-card behavior rather than a coverage-rollover average. It makes no
GitHub or production mutation.

Review

  • Codex dirty-patch review after the compatibility repair: clean.
  • Codex committed-range review against the pre-rebase base: clean.
  • Codex committed-range review against current origin/main after rebase:
    clean; no actionable findings.
  • Local ClawSweeper review at the identical product commit found no
    line-level correctness or security defect. Its only requested rank-up item
    was current-head real behavior proof; that proof is recorded above and was
    rerun after the rebase.

Risk and rollout

The v2 aggregate starts empty and reports warming for its first hour. That
avoids treating legacy router-terminal data as final-review timing. No
protected/internal timestamps are added to the public projection. No CHANGELOG
change is included.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@brokemac79
brokemac79 force-pushed the codex/csw-139-bay-e2e-telemetry branch from 755e31f to 7d0f561 Compare August 24, 2026 23:28
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 10:41 PM ET / August 25, 2026, 02:41 UTC.

ClawSweeper review

What this changes

The PR replaces Bay’s routing-terminal timing with trigger-to-verified-final-receipt journeys, adds a five-minute median history chart, and starts a fresh v2 durable aggregate.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. The branch supplies a coherent, tested v2 Bay timing design and current-head isolated runtime proof; the remaining merge question is whether maintainers want verified final receipts, with an intentional one-hour warming period, to be the permanent public timing definition.

Priority: P3
Reviewed head: ff2afbe55d6c7e959e521c2b4d14e42f3dd3004c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A well-scoped, proof-backed telemetry change with no discrete correctness finding, pending maintainer confirmation of the public metric and rollout contract.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix isolated Crabbox evidence for the current head: a real local Worker and Durable Object, public status route, and Chromium Bay render passed 143 assertions; private lifecycle data was also shown excluded from the public aggregate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix isolated Crabbox evidence for the current head: a real local Worker and Durable Object, public status route, and Chromium Bay render passed 143 assertions; private lifecycle data was also shown excluded from the public aggregate.
Evidence reviewed 6 items Final-receipt timing boundary: The timing event is emitted only when a recorded trigger has a valid journey end: command reviews use the verified acknowledgement and automatic reviews use the durable GitHub effect.
Durable acknowledgement materialization: A correlated command acknowledgement is persisted and immediately sent through Bay synchronization, with the source outbox marker retained for replay safety.
Ingress and receipt coverage: Focused coverage exercises all five ingress sources, distinguishes command acknowledgements from automatic GitHub effects, and asserts five final journey samples.
Findings None None.
Security None None.

Live Verification

Command: bash docs/proof/bay-authoritative-lifecycle/run-proof.sh

Result: FAIL (partial) — step 2 expect_output "ok":true: expected terminal output was not visible within 30 seconds: "\"ok\":true"

bash docs/proof/bay-authoritative-lifecycle/run-proof.sh
runner@runnervm76f27:/tmp/clawsweeper-live-proof-1238-xF4UoJ/target$ bash docs/proof/bay-authoritative-lifecycle/run-proof.sh
Already up to date
Done in 401ms using pnpm v11.10.0
bash docs/proof/bay-authoritative-lifecycle/run-proof.sh
node:internal/modules/run_main:107
    triggerUncaughtException(
    ^

browserType.launch: Failed to launch chromium because executable doesn't exist at /ms-playwright/chromium-1223/chrome-linux64/chrome
    at /tmp/clawsweeper-live-proof-1238-xF4UoJ/target/docs/proof/bay-authoritative-lifecycle/run-proof.mjs:225:32 {
  log: [],
  name: 'Error'
}

Node.js v24.19.0
runner@runnervm76f27:/tmp/clawsweeper-live-proof-1238-xF4UoJ/target$ bash docs/proof/bay-authoritative-lifecycle/run-proof.sh
Refusing to overwrite existing proof output: .artifacts/bay-lifecycle-metrics
runner@runnervm76f27:/tmp/clawsweeper-live-proof-1238-xF4UoJ/target$
































Assertions:

  • FAIL expect_output: "ok":true
  • FAIL expect_output: "assertions":143

How this fits together

Bay receives exact-review lifecycle events from the queue and Durable Object, projects a redacted public status snapshot, and renders it in the dashboard. This PR changes the completion boundary used by that projection and the timing information shown to Bay users.

flowchart LR
A[Review trigger] --> B[Durable lifecycle record]
B --> C[Final GitHub receipt]
C --> D[Journey timing aggregate]
D --> E[Public status snapshot]
E --> F[Bay dashboard]
C --> G[Terminal journey card]
Loading

Decision needed

Question Recommendation
Should Bay permanently define review duration as verified trigger-to-final-review-receipt time, accepting an empty one-hour v2 warming window on rollout? Approve the final-receipt metric: Land the v2 aggregate and let Bay withhold the overall timing statistic until its first hour of complete coverage.

Why: The patch is mechanically coherent, but selecting the public operational metric and rollout semantics is a product and observability-policy choice rather than a correctness inference.

Before merge

  • Resolve merge risk (P1) - Merging starts an intentionally empty v2 aggregate, so the public overall timing remains in warming for its first hour.
  • Resolve merge risk (P1) - This changes the meaning of Bay timing from routing completion to final-review receipt completion; downstream consumers must accept the additive provenance field and the v2 source snapshot.
  • Complete next step (P2) - No mechanical repair is identified; maintainer approval of the public timing definition and its intentional warming rollout is the remaining action.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Runtime and regression coverage runtime +189 net lines, tests +342 net lines The durable timing contract adds bounded v2 storage and receipt handling with substantially larger focused coverage.
Review surface 14 files affected The change crosses lifecycle storage, queue receipt handling, public projection, Bay UI, proof, and regression tests.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1237
Summary: This PR is the explicitly linked candidate implementation for the Bay timing investigation.

Members:

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

Merge-risk options

Maintainer options:

  1. Confirm the v2 rollout contract (recommended)
    Approve the final-receipt definition and its one-hour warming behavior before merge, with the existing source enum retained for consumers.
  2. Pause for a different metric policy
    Keep the existing routing metric if maintainers do not want the public timing meaning or rollout behavior to change.

Technical review

Best possible solution:

Adopt the v2 metric only with explicit maintainer agreement that final-review receipt latency is Bay’s canonical timing definition, while preserving the existing public source enum and the fail-closed warming behavior.

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

Not applicable: this is a proposed implementation rather than an issue report; its controlled Worker, Durable Object, status-route, and Chromium scenario is documented as passing on the current head.

Is this the best way to solve the issue?

Yes, conditionally: final receipt correlation is the narrowest source-backed way to avoid presenting routing-terminal time as completed-review time, but maintainers must choose that public metric definition.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix isolated Crabbox evidence for the current head: a real local Worker and Durable Object, public status route, and Chromium Bay render passed 143 assertions; private lifecycle data was also shown excluded from the public aggregate.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix isolated Crabbox evidence for the current head: a real local Worker and Durable Object, public status route, and Chromium Bay render passed 143 assertions; private lifecycle data was also shown excluded from the public aggregate.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is a bounded Bay observability and dashboard-contract improvement rather than a user-blocking runtime failure.
  • merge-risk: 🚨 compatibility: The PR intentionally changes the public timing definition and begins a fresh v2 aggregate that warms for one hour after deployment.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix isolated Crabbox evidence for the current head: a real local Worker and Durable Object, public status route, and Chromium Bay render passed 143 assertions; private lifecycle data was also shown excluded from the public aggregate.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix isolated Crabbox evidence for the current head: a real local Worker and Durable Object, public status route, and Chromium Bay render passed 143 assertions; private lifecycle data was also shown excluded from the public aggregate.

Evidence

What I checked:

Likely related people:

  • brokemac79: Introduced the proposed final-receipt boundary, v2 aggregate, and proof fixture in the current commit; deeper local feature history was unavailable for stronger routing. (role: current Bay lifecycle implementation author; confidence: low; commits: ff2afbe55d6c; files: dashboard/exact-review-lifecycle-telemetry.ts, dashboard/exact-review-queue.ts, docs/proof/bay-authoritative-lifecycle/run-proof.mjs)

Rank-up moves

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

  • Record the maintainer decision on using final-review receipts as Bay’s canonical timing boundary.

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 (3 earlier review cycles)
  • reviewed 2026-08-24T23:33:07.239Z sha 7d0f561 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-25T00:16:21.318Z sha 7d0f561 :: needs real behavior proof before merge. :: [P2] Update the maintained Bay proof fixtures
  • reviewed 2026-08-25T02:18:54.131Z sha ff2afbe :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. label Aug 25, 2026
@brokemac79
brokemac79 force-pushed the codex/csw-139-bay-e2e-telemetry branch from 7d0f561 to 390863f Compare August 25, 2026 02:08
@brokemac79
brokemac79 force-pushed the codex/csw-139-bay-e2e-telemetry branch from 390863f to ff2afbe Compare August 25, 2026 02:14
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. 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. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 25, 2026
@brokemac79
brokemac79 merged commit 91a2bf6 into main Aug 25, 2026
23 checks passed
@brokemac79
brokemac79 deleted the codex/csw-139-bay-e2e-telemetry branch August 25, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSW-139: investigate Bay lane-duration conversation bubbles

1 participant