Skip to content

feat(gastown): tRPC + HTTP for babysit PR (chunk 1)#3580

Merged
jrf0110 merged 5 commits into
gastown-stagingfrom
convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/toast/551c4b50
May 28, 2026
Merged

feat(gastown): tRPC + HTTP for babysit PR (chunk 1)#3580
jrf0110 merged 5 commits into
gastown-stagingfrom
convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/toast/551c4b50

Conversation

@jrf0110

@jrf0110 jrf0110 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Chunk 1 of 6 for the "Babysit existing PR" feature. Builds on chunk 0 (already merged) which added slingExistingPr and submitExternalPrToReviewQueue.

  • gastown.babysitPr tRPC mutation — validates input, verifies rig ownership, calls townStub.slingExistingPr with sourceAgentId: 'system'
  • gastown.previewPr tRPC query — returns PR metadata (state, branches, SHA, title) without side effects. Returns repo_matches: false on repo mismatch instead of throwing, so the UI can render a clear error
  • POST /api/mayor/:townId/tools/babysit-pr — mayor-tools HTTP route, mirrors existing MayorSlingBody pattern, calls slingExistingPr with sourceAgentId: 'mayor'
  • Refinery bypassdispatch_agent in actions.ts returns null for merge_request beads with metadata.babysit === true, preventing refinery dispatch
  • Reconciler fast-track — new block in reconcileMergeRequests fast-tracks open MR beads with metadata.babysit=true to in_progress regardless of the rig's code_review config. Also excludes babysat beads from refinery dispatch queries.

Verification

  • All 60 unit tests pass (36 new in babysit-pr.test.ts, 24 existing in sling-existing-pr.test.ts)
  • Pre-existing client.test.ts JWT token failures are unrelated to this change

Visual Changes

N/A

Reviewer Notes

  • The previewPr method on TownDO reuses the same repo-validation and SCM-fetch logic as slingExistingPr (both call checkPRStatus). No duplicate code paths.
  • The reconciler babysit fast-track runs independently of the code_review: false fast-track, so babysat beads on rigs with code_review: true are handled correctly.
  • The dispatch_agent null return for babysat beads means the reconciler's transition_bead action is the sole path that moves them to in_progress, which then triggers poll_pr on the next alarm tick.

Comment thread services/gastown/test/unit/sling-existing-pr.test.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The merge conflict markers in process-manager.test.ts (the sole CRITICAL issue from the previous review) have been resolved; no new issues were introduced.

Resolved Issues
  • services/gastown/container/src/process-manager.test.ts — merge conflict markers removed ✓
  • services/gastown/test/unit/sling-existing-pr.test.ts — duplicate file was removed in a prior commit ✓
Files Reviewed (14 files)
  • services/gastown/container/src/process-manager.test.ts — resolved ✓
  • services/gastown/src/db/tables/bead-events.table.ts
  • services/gastown/src/dos/Town.do.ts
  • services/gastown/src/dos/town/actions.ts
  • services/gastown/src/dos/town/reconciler.ts
  • services/gastown/src/dos/town/review-queue.ts
  • services/gastown/src/dos/town/town-scm.ts
  • services/gastown/src/gastown.worker.ts
  • services/gastown/src/handlers/mayor-tools.handler.ts
  • services/gastown/src/trpc/router.ts
  • services/gastown/src/trpc/schemas.ts
  • services/gastown/src/util/platform-pr.util.ts
  • services/gastown/test/unit/babysit-pr.test.ts
  • services/gastown/test/unit/sling-existing-pr.test.ts — removed ✓

Reviewed by claude-sonnet-4.6 · 192,151 tokens

Review guidance: REVIEW.md from base branch gastown-staging

jrf0110 and others added 4 commits May 28, 2026 20:22
…rm (#3372)

Bug 1: @kilocode/cli@7.2.14 doesn't read KILO_AUTH_CONTENT, causing all
kilo serve session-ingest to silently no-op. Bumped to 7.3.1 which has the
feature. Verified KILO_AUTH_CONTENT present in binary strings.

Bug 2: buildPrewarmEnv didn't set KILO_AUTH_CONTENT, KILO_PLATFORM, or
KILO_ORG_ID, so mayor sessions (which go through prewarm) were invisible.
Extracted buildKiloAuthEnv helper from buildAgentEnv and used it in both
buildAgentEnv and buildPrewarmEnv.

Refs #3307

Co-authored-by: John Fawcett <john@kilcoode.ai>
…unk 0) (#3576)

* feat(gastown): Town DO slingExistingPr method (babysit PR feature, chunk 0)

* fix(gastown): address PR review feedback on slingExistingPr

- Remove async from submitExternalPrToReviewQueue (no awaits inside)
- Add GitLab host validation in slingExistingPr URL parsing to prevent
  non-GitLab URLs (e.g. Bitbucket) from matching the GitLab regex
- Replace vacuous state validation tests with meaningful checkPRStatus
  integration tests that exercise the actual status resolution path

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>
Add gastown.babysitPr tRPC mutation, gastown.previewPr tRPC query,
mayor-tools babysit-pr HTTP route, refinery bypass for babysat beads,
and reconciler fast-track extension for babysat MR beads.
The file was a verbatim copy of the first 442 lines of
babysit-pr.test.ts, causing 24 tests to run twice with
zero added coverage.
@jrf0110
jrf0110 force-pushed the convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/toast/551c4b50 branch from 384863d to c3f1705 Compare May 28, 2026 20:23
Comment thread services/gastown/container/src/process-manager.test.ts Outdated
@jrf0110
jrf0110 merged commit e324572 into gastown-staging May 28, 2026
2 checks passed
@jrf0110
jrf0110 deleted the convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/toast/551c4b50 branch May 28, 2026 20:37
jrf0110 added a commit that referenced this pull request Jul 22, 2026
* fix(gastown): bump @kilocode/cli to 7.3.1 + plumb auth env into prewarm (#3372)

Bug 1: @kilocode/cli@7.2.14 doesn't read KILO_AUTH_CONTENT, causing all
kilo serve session-ingest to silently no-op. Bumped to 7.3.1 which has the
feature. Verified KILO_AUTH_CONTENT present in binary strings.

Bug 2: buildPrewarmEnv didn't set KILO_AUTH_CONTENT, KILO_PLATFORM, or
KILO_ORG_ID, so mayor sessions (which go through prewarm) were invisible.
Extracted buildKiloAuthEnv helper from buildAgentEnv and used it in both
buildAgentEnv and buildPrewarmEnv.

Refs #3307

Co-authored-by: John Fawcett <john@kilcoode.ai>

* feat(gastown): Town DO slingExistingPr method (babysit PR feature, chunk 0) (#3576)

* feat(gastown): Town DO slingExistingPr method (babysit PR feature, chunk 0)

* fix(gastown): address PR review feedback on slingExistingPr

- Remove async from submitExternalPrToReviewQueue (no awaits inside)
- Add GitLab host validation in slingExistingPr URL parsing to prevent
  non-GitLab URLs (e.g. Bitbucket) from matching the GitLab regex
- Replace vacuous state validation tests with meaningful checkPRStatus
  integration tests that exercise the actual status resolution path

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>

* feat(gastown): tRPC + HTTP for babysit PR (chunk 1)

Add gastown.babysitPr tRPC mutation, gastown.previewPr tRPC query,
mayor-tools babysit-pr HTTP route, refinery bypass for babysat beads,
and reconciler fast-track extension for babysat MR beads.

* chore: remove duplicate sling-existing-pr.test.ts

The file was a verbatim copy of the first 442 lines of
babysit-pr.test.ts, causing 24 tests to run twice with
zero added coverage.

* fix(gastown): resolve merge conflict markers in process-manager.test.ts

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>
jrf0110 added a commit that referenced this pull request Jul 22, 2026
* fix(gastown): bump @kilocode/cli to 7.3.1 + plumb auth env into prewarm (#3372)

Bug 1: @kilocode/cli@7.2.14 doesn't read KILO_AUTH_CONTENT, causing all
kilo serve session-ingest to silently no-op. Bumped to 7.3.1 which has the
feature. Verified KILO_AUTH_CONTENT present in binary strings.

Bug 2: buildPrewarmEnv didn't set KILO_AUTH_CONTENT, KILO_PLATFORM, or
KILO_ORG_ID, so mayor sessions (which go through prewarm) were invisible.
Extracted buildKiloAuthEnv helper from buildAgentEnv and used it in both
buildAgentEnv and buildPrewarmEnv.

Refs #3307

Co-authored-by: John Fawcett <john@kilcoode.ai>

* feat(gastown): Town DO slingExistingPr method (babysit PR feature, chunk 0) (#3576)

* feat(gastown): Town DO slingExistingPr method (babysit PR feature, chunk 0)

* fix(gastown): address PR review feedback on slingExistingPr

- Remove async from submitExternalPrToReviewQueue (no awaits inside)
- Add GitLab host validation in slingExistingPr URL parsing to prevent
  non-GitLab URLs (e.g. Bitbucket) from matching the GitLab regex
- Replace vacuous state validation tests with meaningful checkPRStatus
  integration tests that exercise the actual status resolution path

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>

* feat(gastown): tRPC + HTTP for babysit PR (chunk 1)

Add gastown.babysitPr tRPC mutation, gastown.previewPr tRPC query,
mayor-tools babysit-pr HTTP route, refinery bypass for babysat beads,
and reconciler fast-track extension for babysat MR beads.

* chore: remove duplicate sling-existing-pr.test.ts

The file was a verbatim copy of the first 442 lines of
babysit-pr.test.ts, causing 24 tests to run twice with
zero added coverage.

* fix(gastown): resolve merge conflict markers in process-manager.test.ts

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>
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