Skip to content

fix(reconciler): P0+P1 bug fixes from audit #1986 (v3)#2031

Open
jrf0110 wants to merge 1 commit intogastown-stagingfrom
convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/head
Open

fix(reconciler): P0+P1 bug fixes from audit #1986 (v3)#2031
jrf0110 wants to merge 1 commit intogastown-stagingfrom
convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/head

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented Apr 5, 2026

Summary

  • Circuit breaker SQL parameterization: Compute the cutoff timestamp in JS and pass it as a bound SQL parameter instead of interpolating CIRCUIT_BREAKER_WINDOW_MINUTES into the query string via a template literal. Same 30-minute window, no behavioral change.
  • Remove duplicate metadata column: Cleaned up duplicate b.metadata in MR beads SQL SELECT query (line ~1054).
  • Rebased onto gastown-staging: Branch now builds on top of gastown-staging instead of main, preserving the NULL rig_id COALESCE handling (P0) and source bead state guard in review-queue.ts (P1) from commit d36364d.

Verification

  • pnpm typecheck passes (ran via pre-push hook and manually)
  • pnpm format:check passes (ran via pre-push hook)
  • Verified NULL rig_id COALESCE sentinel + isNullRig branching preserved in reconciler.ts Rule 5
  • Verified source bead in_review status check preserved in review-queue.ts completeReviewWithResult
  • Verified duplicate b.metadata column removed from MR beads query

Visual Changes

N/A

Reviewer Notes

  • Previous version of this PR was cut from main, which would have reverted two gastown-staging bug fixes (NULL rig_id handling and source bead state guard from d36364d). This version is rebased onto gastown-staging so those fixes are preserved.
  • The diff is now minimal: only the circuit breaker parameterization and duplicate metadata column removal.

if (
request.processStatus === 'success' ||
request.processStatus === 'failed' ||
request.processStatus === 'inprogress'
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.

WARNING: inprogress now suppresses all retries for KiloClaw chat deliveries

This request is marked inprogress before the outbound send-chat-message fetch, and processWebhookMessage() later acks any non-captured request that does not have a cloudAgentSessionId. If the worker crashes or the fetch throws after the status update but before success/failure is persisted, the queue retry will skip this request forever and the scheduled/webhook run is lost.

'Content-Type': 'application/json',
'User-Agent': 'Gastown-Refinery/1.0',
},
body: JSON.stringify({ merge_method: 'merge' }),
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.

WARNING: Auto-merge is not pinned to the reviewed head SHA

This merge request only sends merge_method, so GitHub will merge whatever commit is at the PR head when this call arrives. A push that lands after checkPRFeedback() runs but before this request can therefore merge unreviewed code. Please include the expected sha in the merge payload and treat a mismatch as a retry/reset condition.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 5, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

N/A

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
cloudflare-gastown/src/dos/Town.do.ts 4331 Auto-merge calls GitHub without an expected head SHA, so a newer unreviewed commit can be merged if the branch changes between check and merge.
Files Reviewed (1 file)
  • cloudflare-gastown/src/dos/town/reconciler.ts - 0 issues

Reviewed by gpt-5.4-20260305 · 480,049 tokens

… metadata column

Rebase onto gastown-staging to preserve NULL rig_id COALESCE handling
(P0) and source bead state guard in review-queue.ts (P1).

Changes on top of gastown-staging:
- Parameterize circuit breaker SQL: compute cutoff in JS and bind as
  parameter instead of interpolating into query string
- Remove duplicate b.metadata column in MR beads SELECT query
@jrf0110 jrf0110 force-pushed the convoy/fix-reconciler-p0-p1-bug-fixes-from-audi/892c7c4a/head branch from dbf82c3 to 4bd4fea Compare April 5, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant