Skip to content

fix(bay): correlate direct re-review completions - #1172

Merged
brokemac79 merged 1 commit into
mainfrom
codex/csw130-bay-journey-correlation
Aug 15, 2026
Merged

brokemac79 merged 1 commit into
mainfrom
codex/csw130-bay-journey-correlation

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Restores OpenClaw Bay completed-journey correlation for hosted direct @clawsweeper re-review commands without undoing PR #1143's command-version fencing.

Problem

PR #1143 deliberately changed direct re-review sourceDeliveryId from the GitHub webhook delivery (G) to a deterministic command-version identity (C). Bay records the trigger under G, but lifecycle acknowledgement emitted the completion under C; Bay therefore created separate partial records and the tide summary had zero completed samples.

Implementation

  • Preserve the original signed GitHub delivery ID as the additive bayJourneyDeliveryId alongside feat(review): make re-review command intake durable #1143's command-version sourceDeliveryId.
  • Persist and validate it through direct command intake and the durable lifecycle projection.
  • Retain that identity in a small command-version keyed durable table, so a redelivery can retry Bay telemetry with the original G if the first Bay write was unavailable.
  • Return it from fenced lifecycle acknowledgement receipts.
  • Prefer it for both the GitHub-terminal-webhook and signed workflow-acknowledgement Bay completion paths, falling back to the existing identity for older projections.

This is additive durable state. Existing projections without the field remain valid and use legacy behaviour; no migration or cache invalidation is required. Historical partial journeys cannot be deterministically repaired by this code alone, but new completions after deployment join their live triggers.

Validation

  • pnpm run build:all
  • pnpm run lint:dashboard
  • node --test --test-concurrency=1 test/dashboard-worker-command-intake.test.ts test/dashboard-worker-bay-records-routes.test.ts — 46 passed, 0 failed.
  • git diff --check
  • Codex dirty-patch review: clean, no actionable findings.
  • Codex committed-range review against origin/main (9fb6d6bfe562611ba5c40e60521ba4a726bac926): clean, no actionable findings.
  • Read-only local ClawSweeper committed-range review: completed with no actionable code finding (decision=keep_open, action=kept_open).
  • Hosted ClawSweeper re-review on exact head c272176e9bdc85ff1d36648c218c31c6afd54773: no actionable findings; proof: sufficient and status: 👀 ready for maintainer look applied.
  • Hosted CI pnpm check, both CodeQL analyses, and the hermetic automerge-flow test: successful.

pnpm run check is blocked by the existing repository formatting baseline: oxfmt --check reports 719 unrelated files. The touched files were formatted and the focused build/tests pass.

Real Behavior Proof

Claim: A signed hosted direct re-review retains its raw GitHub delivery identity through durable intake and lifecycle acknowledgement, allowing Bay to produce one completed in-window journey even when only the normal workflow acknowledgement arrives.

Exercised surface: Worker GitHub webhook, direct intake, actual in-memory Durable Object queue admission/alarm, lifecycle projection, signed internal lifecycle acknowledgement endpoint, and Bay journey state.

Scenario: The regression test sends a real HMAC-signed command webhook with delivery G while Bay storage is unavailable. Its GitHub redelivery is command-deduplicated but returns the durable original G, allowing Bay telemetry to recover exactly one journey. It then drives the queue alarm, records terminal lifecycle facts, and sends the signed workflow acknowledgement without relying on a terminal GitHub webhook. The endpoint returns bay_journey_delivery_id=G; Bay contains exactly one joined journey and one timing sample. A subsequent terminal webhook remains idempotent.

Command/environment: the focused Node test command above on this checkout at c272176e9b.

Direct-Docker runtime proof: coordinator-authorized fallback after CRA-001 Crabbox transport failure. At exact head c272176e9bdc85ff1d36648c218c31c6afd54773 / tree 94b50bdd94a30c5d88222cc6230c83006ea56259, a clean read-only source mount was copied into disposable container clawsweeper-proof:node24-jq@sha256:b9ddc0c04722a87ff36948964d93942a316689de01063798032328772a36aeee. The container ran [email protected] dev --local against the current Worker with fresh persisted local SQLite Durable Objects. A redacted loopback GitHub server supplied only fixture data; the proof exercised actual HTTP Worker routes and the DO alarm rather than the in-memory test harness. The redelivery was command-deduplicated and explicitly required to return the original Bay delivery identity. Observed result:

{"proof":"csw130-direct-docker-wrangler-do","command_status":202,"command_accepted":true,"redelivery_status":202,"redelivery_deduped":true,"github_delivery_id":"csw130-direct-docker-delivery","durable_source_comment_reads":1,"durable_status_comments":1,"lifecycle_acknowledgement_accepted":true,"lifecycle_bay_journey_delivery_id":"csw130-direct-docker-delivery","bay_completed_journey_samples":1,"status_marker_present":true}

This proves a real local Worker/DO admission, a deduplicated redelivery retaining G, and one joined, in-window Bay timing sample on the current head. Docker Engine was 29.5.2. Crabbox itself remains unavailable for this tree because two local-container attempts (cbx_ba0806abf103, cbx_1307edd2fb1b) and configured AWS run run_2dbd1a63208b / lease cbx_2794c92c5e43 each failed before execution during rsync handshake with code 12; no Crabbox result is claimed.

Risks / rollout / rollback

The change only adds optional durable identity and preserves legacy fallback. Roll out normally with the Worker/dashboard deployment, then verify Bay reports a completed sample after the next hosted re-review completes. Existing records are not rewritten; a redelivery can recover a missed trigger during receipt retention. If needed, revert this one commit; no state rollback is needed.

Related: CSW-130; regression introduced by #1143.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 15, 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.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. P2 Normal priority bug or improvement with limited blast radius. 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 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 8:07 AM ET / 12:07 UTC.

ClawSweeper review

What this changes

This PR preserves the original GitHub webhook delivery ID alongside the durable re-review command identity so OpenClaw Bay can join direct re-review triggers with their completions.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open: its central repair is not on current main, the current-head diff has no actionable correctness finding, and the supplied real Worker/Durable Object proof supports review for landing.

Priority: P2
Reviewed head: c272176e9bdc85ff1d36648c218c31c6afd54773

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused durable-state repair with strong runtime evidence and no actionable finding in the current-head review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix live output from a local Wrangler Worker and fresh Durable Object run showing deduplicated redelivery retention and exactly one completed Bay sample.
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 live output from a local Wrangler Worker and fresh Durable Object run showing deduplicated redelivery retention and exactly one completed Bay sample.
Evidence reviewed 6 items Current main lacks the repair: The candidate commit is not an ancestor of current main, and the Worker/intake behavior differs from main on the delivery-identity path.
Durable identity retention: The intake store records the optional Bay delivery identity by command version and returns it on accepted redelivery, preventing telemetry from switching to the command-version identity.
Completion uses the retained identity: Both GitHub-terminal and signed lifecycle-acknowledgement completion paths prefer the retained Bay identity while preserving the existing source-identity fallback.
Findings None None.
Security None None.

How this fits together

Hosted re-review webhooks enter the Worker and Durable Object queue, which later records lifecycle completion. OpenClaw Bay consumes those events to build completed-journey timing summaries.

flowchart LR
  A[GitHub re-review webhook] --> B[Worker command intake]
  B --> C[Durable command receipt]
  C --> D[Lifecycle acknowledgement]
  D --> E[Bay telemetry]
  E --> F[Completed journey summary]
Loading

Before merge

  • Resolve merge risk (P2) - This adds Durable Object identity state; rollout should confirm the next hosted direct re-review yields one Bay sample while older projections continue using the legacy fallback.
  • Complete next step (P2) - No mechanical repair is indicated; this PR is ready for ordinary maintainer landing review on its current head.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus regression coverage production +111/-9; tests +238/-1 The new durable identity path is accompanied by focused end-to-end-style Worker, Durable Object, lifecycle, and Bay regression coverage.

Merge-risk options

Maintainer options:

  1. Land with rollout observation (recommended)
    Accept the contained durable-state change and verify that a hosted direct re-review creates one completed Bay sample after deployment.

Technical review

Best possible solution:

Land the additive identity mapping, retain the command-version fence for queue authority, and observe the first hosted direct re-review after deployment for one joined Bay journey.

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

Yes—current-main source routes direct re-review completion through the command-version identity, while the candidate retains the webhook identity separately; I did not execute a failing current-main runtime reproduction.

Is this the best way to solve the issue?

Yes—the additive Bay-only identity preserves the existing command-version fence and legacy fallback instead of changing command authority or rewriting historical state.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs completed-journey telemetry correlation without evidence of a user-facing runtime outage.
  • merge-risk: 🚨 session-state: The PR adds command-version keyed Durable Object state and changes the identity carried through lifecycle receipts.
  • 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 live output from a local Wrangler Worker and fresh Durable Object run showing deduplicated redelivery retention and exactly one completed Bay sample.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix live output from a local Wrangler Worker and fresh Durable Object run showing deduplicated redelivery retention and exactly one completed Bay sample.

Evidence

What I checked:

  • Current main lacks the repair: The candidate commit is not an ancestor of current main, and the Worker/intake behavior differs from main on the delivery-identity path. (dashboard/worker.ts:1845, c272176e9bdc)
  • Durable identity retention: The intake store records the optional Bay delivery identity by command version and returns it on accepted redelivery, preventing telemetry from switching to the command-version identity. (dashboard/exact-review-command-intake.ts:112, c272176e9bdc)
  • Completion uses the retained identity: Both GitHub-terminal and signed lifecycle-acknowledgement completion paths prefer the retained Bay identity while preserving the existing source-identity fallback. (dashboard/worker.ts:1697, c272176e9bdc)
  • Focused regression coverage: The new regression covers a signed webhook, command deduplication, Durable Object alarm, lifecycle acknowledgement, one Bay journey sample, and idempotent terminal webhook handling. (test/dashboard-worker-command-intake.test.ts:236, c272176e9bdc)
  • Feature provenance: The durable command-intake behavior dates to the merged re-review intake change; current blame attributes its baseline receipt logic to that commit, while this branch adds the Bay mapping. (dashboard/exact-review-command-intake.ts:104, e0dc54438e5e)
  • Real behavior proof: The PR body reports an after-fix local Wrangler Worker with fresh Durable Object storage: a deduplicated redelivery retained the original identity and the lifecycle acknowledgement produced exactly one completed Bay sample. (c272176e9bdc)

Likely related people:

  • Peter Steinberger: Introduced the merged durable re-review intake behavior and has recent history on the Worker and lifecycle paths. (role: durable command-intake introducer and recent dashboard contributor; confidence: high; commits: e0dc54438e5e, bf762f3f6f9e; files: dashboard/exact-review-command-intake.ts, dashboard/exact-review-lifecycle.ts, dashboard/worker.ts)
  • Martin Cleary: Authored the commit that made Bay canonical and clarified handoff telemetry, adjacent to this correlation repair. (role: Bay telemetry contributor; confidence: medium; commits: 51ac499c741b; files: dashboard/worker.ts, dashboard/exact-review-lifecycle.ts)

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 (4 earlier review cycles)
  • reviewed 2026-08-15T11:07:32.693Z sha c0339b5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-15T11:11:15.827Z sha c0339b5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-15T11:33:05.894Z sha c0339b5 :: needs changes before merge. :: [P2] Deduplicate Bay triggers before retaining the delivery identity
  • reviewed 2026-08-15T12:03:54.579Z sha c272176 :: needs maintainer review before merge. :: none

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 15, 2026
@brokemac79
brokemac79 force-pushed the codex/csw130-bay-journey-correlation branch from c0339b5 to c272176 Compare August 15, 2026 12:00
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 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 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(bay): correlate direct re-review completions This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@brokemac79
brokemac79 merged commit d389e6a into main Aug 15, 2026
20 of 21 checks passed
@brokemac79
brokemac79 deleted the codex/csw130-bay-journey-correlation branch August 15, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. P2 Normal priority bug or improvement with limited blast radius. 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.

1 participant