Skip to content

feat(web): SlingDialog babysit-PR mode (chunk 3)#3583

Merged
jrf0110 merged 7 commits into
gastown-stagingfrom
convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/maple/834e0088
May 29, 2026
Merged

feat(web): SlingDialog babysit-PR mode (chunk 3)#3583
jrf0110 merged 7 commits into
gastown-stagingfrom
convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/maple/834e0088

Conversation

@jrf0110

@jrf0110 jrf0110 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add tabbed SlingDialog with "Sling work" (existing) and "Babysit existing PR" (new) tabs
  • New BabysitPrPanel component with PR URL input, debounced (500ms) previewPr query, repo mismatch / closed PR validation, title/body overrides, forcePushAllowed checkbox, and babysitPr mutation on submit
  • Wire SlingDialog into RigDetailPageClient via new "Sling" button next to "New Bead"
  • Persist user's last-used tab in localStorage
  • Update generated tRPC type declarations (router.d.ts, schemas.d.ts) for previewPr and babysitPr procedures
  • Unit tests for URL validation, preview status logic, mutation args, and default values

Verification

  • pnpm --filter web typecheck passes
  • Manual: open a rig detail page, click "Sling" button, switch to "Babysit existing PR" tab, paste a PR URL, observe preview card

Visual Changes

New "Sling" button in rig detail page header, tabbed dialog with babysit PR form

Reviewer Notes

  • The previewPr and babysitPr tRPC procedures were added in chunk 1 (already merged to gastown-staging); the generated type declarations were manually updated since pnpm build:types timed out in this environment
  • BabysitPrPanel is extracted as a separate component to keep SlingDialog manageable
  • Tests are pure-function unit tests matching the existing gastown component test pattern (no React Testing Library available)

Comment thread apps/web/src/components/gastown/BabysitPrPanel.tsx
@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

All previously flagged issues have been resolved; the TDZ bug in BabysitPrPanel.tsx was fixed by moving defaultTitle/defaultBody and their useEffect hooks to after the preview declaration.

Resolved Since Previous Review
File Issue Status
apps/web/src/components/gastown/BabysitPrPanel.tsx defaultTitle/defaultBody TDZ — referenced preview before its const declaration ✅ Fixed in 58ac163c4
apps/web/src/components/gastown/drawer-panels/BeadPanel.tsx isBabysit TDZ — moved before first use ✅ Fixed
apps/web/src/components/gastown/BabysitPrPanel.tsx userEditedTitle/userEditedBody dead state — now consumed in useEffect guards ✅ Fixed
services/gastown/src/dos/town/review-queue.ts babysit_started_at never written — now set to new Date().toISOString() ✅ Fixed
Other Observations (not blocking)

Duplicate test files: services/gastown/test/unit/babysit-pr.test.ts and services/gastown/test/unit/sling-existing-pr.test.ts share 442 identical lines — sling-existing-pr.test.ts appears to be a leftover that could be deleted or consolidated.

No duplicate-PR-URL guard in slingExistingPr: Nothing prevents calling babysitPr twice with the same PR URL on the same rig, creating two gt:babysit beads both fast-tracked to in_progress. Consider adding a unique check on review_metadata.pr_url + rig_id before inserting.

Files Reviewed (1 file changed in this increment)
  • apps/web/src/components/gastown/BabysitPrPanel.tsx — CRITICAL TDZ resolved

Reviewed by claude-4.6-sonnet-20260217 · 227,762 tokens

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

jrf0110 and others added 5 commits May 29, 2026 15:23
…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.
feat(web): BeadPanel babysit badge + metadata surfacing (chunk 4)

- Add 'Babysat external PR' badge (cyan) when gt:babysit label present
- Hide source bead link for babysit beads (no source_bead_id)
- Add babysit metadata panel: head_sha (7-char, linked), force_push_allowed (Lock/Unlock icons), babysit_started_at (relative time)
- Add event formatters for babysit_started, pr_feedback_detected, pr_conflict_detected, pr_auto_merge, pr_status_changed
- Mirror babysit badge + metadata in BeadInspectorDashboard
- Extract buildRelatedBeads and eventDescription into separate files for testability
- Add unit tests for eventDescription and buildRelatedBeads babysit logic

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

* feat(gastown): gt_babysit_pr mayor tool + force-push gate (chunk 2)

Add gt_babysit_pr mayor tool registration and client method, update
mayor and polecat system prompts with babysit PR guidance and force-push
policy, surface force_push_allowed in polecat prime context, and add
corresponding unit tests.

* fix(gastown): address PR review warnings on babysit PR feature

- Rewrite PR Conflict Resolution Workflow in polecat-system.prompt.ts
  to choose strategy upfront (rebase vs merge) based on force_push_allowed,
  instead of rebase-then-abort which discarded conflict resolution work.
- Extract resolveForcePushAllowed() from agents.ts prime() so tests
  exercise the actual function instead of inlining the logic.

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>
Add tabbed SlingDialog with 'Sling work' and 'Babysit existing PR' tabs.
The Babysit tab includes PR URL input with debounced preview, repo mismatch
and closed PR validation, title/body overrides, force-push checkbox, and
calls babysitPr mutation on submit. Also updates generated tRPC type
declarations for the new previewPr and babysitPr procedures.
@jrf0110
jrf0110 force-pushed the convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/maple/834e0088 branch from 6246da3 to c631997 Compare May 29, 2026 15:23
Comment thread apps/web/src/components/gastown/drawer-panels/BeadPanel.tsx
- Fix CRITICAL: move isBabysit declaration above relatedBeads in BeadPanel.tsx
  (temporal dead zone caused ReferenceError on babysit bead renders)
- Fix WARNING: wire up userEditedTitle/userEditedBody in BabysitPrPanel.tsx
  (auto-populate title/body from preview unless user has manually edited)
- Fix WARNING: add babysit_started_at to bead metadata in
  submitExternalPrToReviewQueue so UI timestamps render correctly
Comment thread apps/web/src/components/gastown/BabysitPrPanel.tsx Outdated
…fix TDZ bug

The defaultTitle and defaultBody const declarations referenced preview
before it was declared (temporal dead zone), causing ReferenceError on
every render. Moved them after the preview declaration.
@jrf0110
jrf0110 merged commit f4f812a into gastown-staging May 29, 2026
2 checks passed
@jrf0110
jrf0110 deleted the convoy/babysit-existing-pr-feature-re-staged/254a4b7e/gt/maple/834e0088 branch May 29, 2026 15:48
jrf0110 added a commit that referenced this pull request Jul 22, 2026
* 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.

* feat(web): BeadPanel babysit badge + metadata (chunk 4) (#3581)

feat(web): BeadPanel babysit badge + metadata surfacing (chunk 4)

- Add 'Babysat external PR' badge (cyan) when gt:babysit label present
- Hide source bead link for babysit beads (no source_bead_id)
- Add babysit metadata panel: head_sha (7-char, linked), force_push_allowed (Lock/Unlock icons), babysit_started_at (relative time)
- Add event formatters for babysit_started, pr_feedback_detected, pr_conflict_detected, pr_auto_merge, pr_status_changed
- Mirror babysit badge + metadata in BeadInspectorDashboard
- Extract buildRelatedBeads and eventDescription into separate files for testability
- Add unit tests for eventDescription and buildRelatedBeads babysit logic

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

* feat(gastown): gt_babysit_pr mayor tool + force-push gate (chunk 2) (#3582)

* feat(gastown): gt_babysit_pr mayor tool + force-push gate (chunk 2)

Add gt_babysit_pr mayor tool registration and client method, update
mayor and polecat system prompts with babysit PR guidance and force-push
policy, surface force_push_allowed in polecat prime context, and add
corresponding unit tests.

* fix(gastown): address PR review warnings on babysit PR feature

- Rewrite PR Conflict Resolution Workflow in polecat-system.prompt.ts
  to choose strategy upfront (rebase vs merge) based on force_push_allowed,
  instead of rebase-then-abort which discarded conflict resolution work.
- Extract resolveForcePushAllowed() from agents.ts prime() so tests
  exercise the actual function instead of inlining the logic.

---------

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

* feat(web): SlingDialog babysit-PR mode (chunk 3)

Add tabbed SlingDialog with 'Sling work' and 'Babysit existing PR' tabs.
The Babysit tab includes PR URL input with debounced preview, repo mismatch
and closed PR validation, title/body overrides, force-push checkbox, and
calls babysitPr mutation on submit. Also updates generated tRPC type
declarations for the new previewPr and babysitPr procedures.

* fix: address review feedback on PR #3583

- Fix CRITICAL: move isBabysit declaration above relatedBeads in BeadPanel.tsx
  (temporal dead zone caused ReferenceError on babysit bead renders)
- Fix WARNING: wire up userEditedTitle/userEditedBody in BabysitPrPanel.tsx
  (auto-populate title/body from preview unless user has manually edited)
- Fix WARNING: add babysit_started_at to bead metadata in
  submitExternalPrToReviewQueue so UI timestamps render correctly

* fix(web): move defaultTitle/defaultBody after preview declaration to fix TDZ bug

The defaultTitle and defaultBody const declarations referenced preview
before it was declared (temporal dead zone), causing ReferenceError on
every render. Moved them after the preview declaration.

---------

Co-authored-by: John Fawcett <john@kilcoode.ai>
jrf0110 added a commit that referenced this pull request Jul 22, 2026
* 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.

* feat(web): BeadPanel babysit badge + metadata (chunk 4) (#3581)

feat(web): BeadPanel babysit badge + metadata surfacing (chunk 4)

- Add 'Babysat external PR' badge (cyan) when gt:babysit label present
- Hide source bead link for babysit beads (no source_bead_id)
- Add babysit metadata panel: head_sha (7-char, linked), force_push_allowed (Lock/Unlock icons), babysit_started_at (relative time)
- Add event formatters for babysit_started, pr_feedback_detected, pr_conflict_detected, pr_auto_merge, pr_status_changed
- Mirror babysit badge + metadata in BeadInspectorDashboard
- Extract buildRelatedBeads and eventDescription into separate files for testability
- Add unit tests for eventDescription and buildRelatedBeads babysit logic

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

* feat(gastown): gt_babysit_pr mayor tool + force-push gate (chunk 2) (#3582)

* feat(gastown): gt_babysit_pr mayor tool + force-push gate (chunk 2)

Add gt_babysit_pr mayor tool registration and client method, update
mayor and polecat system prompts with babysit PR guidance and force-push
policy, surface force_push_allowed in polecat prime context, and add
corresponding unit tests.

* fix(gastown): address PR review warnings on babysit PR feature

- Rewrite PR Conflict Resolution Workflow in polecat-system.prompt.ts
  to choose strategy upfront (rebase vs merge) based on force_push_allowed,
  instead of rebase-then-abort which discarded conflict resolution work.
- Extract resolveForcePushAllowed() from agents.ts prime() so tests
  exercise the actual function instead of inlining the logic.

---------

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

* feat(web): SlingDialog babysit-PR mode (chunk 3)

Add tabbed SlingDialog with 'Sling work' and 'Babysit existing PR' tabs.
The Babysit tab includes PR URL input with debounced preview, repo mismatch
and closed PR validation, title/body overrides, force-push checkbox, and
calls babysitPr mutation on submit. Also updates generated tRPC type
declarations for the new previewPr and babysitPr procedures.

* fix: address review feedback on PR #3583

- Fix CRITICAL: move isBabysit declaration above relatedBeads in BeadPanel.tsx
  (temporal dead zone caused ReferenceError on babysit bead renders)
- Fix WARNING: wire up userEditedTitle/userEditedBody in BabysitPrPanel.tsx
  (auto-populate title/body from preview unless user has manually edited)
- Fix WARNING: add babysit_started_at to bead metadata in
  submitExternalPrToReviewQueue so UI timestamps render correctly

* fix(web): move defaultTitle/defaultBody after preview declaration to fix TDZ bug

The defaultTitle and defaultBody const declarations referenced preview
before it was declared (temporal dead zone), causing ReferenceError on
every render. Moved them after the preview declaration.

---------

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