Skip to content

feat(gastown): add staged convoys for plan-review-iterate workflow#1077

Merged
jrf0110 merged 9 commits intomainfrom
1006-staged-convoys
Mar 15, 2026
Merged

feat(gastown): add staged convoys for plan-review-iterate workflow#1077
jrf0110 merged 9 commits intomainfrom
1006-staged-convoys

Conversation

@jrf0110
Copy link
Contributor

@jrf0110 jrf0110 commented Mar 12, 2026

Summary

  • Adds staged status to convoy metadata — staged convoys have beads defined but no agents hooked or dispatched
  • Updates gt_sling_batch with a staged: boolean parameter (default false); when true, creates convoy + beads without triggering agent dispatch
  • Adds new gt_convoy_start tool that transitions a staged convoy to open, hooks agents to all tracked beads, and triggers dispatch on the next alarm tick
  • Dashboard displays staged convoys with draft visual state (muted styling, "STAGED" badge) and a prominent "Start Convoy" button
  • Updates mayor system prompt with staged convoy instructions: when users ask to "plan" or "prepare" work, the Mayor creates staged convoys for review

Closes #1006

Verification

  • Code review of diff against fork branch — all patches applied cleanly to origin/main
  • Mayor tools test file updated with new tool registrations

Visual Changes

N/A (dashboard staged convoy display added but not visually verified)

Reviewer Notes

  • The staged → open transition in gt_convoy_start hooks agents and dispatches atomically; if a rig has no available agents, the bead will wait in the dispatch queue
  • convoy_metadata.table.ts gains the staged column — ensure migration runs cleanly in production
  • The mayor prompt change means the Mayor will default to staged convoys when users say "plan" or "prepare" — this is intentional per the issue spec

jrf0110 added 2 commits March 14, 2026 14:41
Adds staged mode to convoys so users can plan work before executing.
gt_sling_batch gains a staged param that creates convoy + beads without
hooking agents. New gt_convoy_start tool transitions staged convoys to
open, triggering agent dispatch. Dashboard shows staged convoys with
draft visual state and a Start button. Mayor prompt updated with staged
convoy instructions.

Closes #1006
@jrf0110 jrf0110 force-pushed the 1006-staged-convoys branch from d7ae2d0 to c57b9a2 Compare March 14, 2026 19:57
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 14, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (24 files)
  • cloudflare-gastown/container/plugin/client.ts
  • cloudflare-gastown/container/plugin/mayor-tools.test.ts
  • cloudflare-gastown/container/plugin/mayor-tools.ts
  • cloudflare-gastown/container/plugin/types.ts
  • cloudflare-gastown/src/db/tables/convoy-metadata.table.ts
  • cloudflare-gastown/src/dos/Town.do.ts
  • cloudflare-gastown/src/dos/town/patrol.ts
  • cloudflare-gastown/src/gastown.worker.ts
  • cloudflare-gastown/src/handlers/mayor-tools.handler.ts
  • cloudflare-gastown/src/prompts/mayor-system.prompt.ts
  • cloudflare-gastown/src/trpc/router.ts
  • cloudflare-gastown/src/trpc/schemas.ts
  • cloudflare-gastown/src/types.ts
  • cloudflare-gastown/src/ui/dashboard.ui.ts
  • src/app/(app)/gastown/[townId]/TownOverviewPageClient.tsx
  • src/app/(app)/gastown/[townId]/rigs/[rigId]/RigDetailPageClient.tsx
  • src/app/(app)/gastown/[townId]/settings/TownSettingsPageClient.tsx
  • src/components/gastown/ConvoyTimeline.tsx
  • src/components/gastown/DrawerStack.tsx
  • src/components/gastown/DrawerStackContent.tsx
  • src/components/gastown/drawer-panels/ConvoyPanel.tsx
  • src/lib/gastown/types/router.d.ts
  • src/lib/gastown/types/schemas.d.ts
  • src/routers/admin/gastown-router.ts

Reviewed by gpt-5.4-20260305 · 1,669,552 tokens

… convoys from deacon patrol

SlingBatchResult.agent is null for staged convoys since agents aren't
assigned until gt_convoy_start. The gt_sling_batch tool now handles this
gracefully instead of crashing on b.agent.name.

feedStrandedConvoys now joins convoy_metadata and filters on staged=0 so
the deacon patrol doesn't auto-assign agents to staged convoy beads.
jrf0110 added 2 commits March 14, 2026 18:08
…utton

- Add staged field to ConvoyOutput tRPC schema
- Add startConvoy tRPC mutation
- Add convoy ResourceRef type to DrawerStack
- Create ConvoyPanel drawer with DAG wave layout, metadata, and start button
- Update ConvoyTimeline with staged badge, clickable title to open drawer,
  and inline start button for staged convoys
- Wire startConvoy mutation in TownOverviewPageClient and RigDetailPageClient
- Fix convoy_id -> id field in dashboard.ui.ts (PR review comment)
- Regenerate gastown tRPC type declarations
Adds a town-level config toggle that forces all convoys to be created
in staged mode by default. When enabled, the mayor must explicitly
start each convoy before agents are dispatched.

- Add staged_convoys_default to TownConfigSchema (default: false)
- slingConvoy resolves staged as input.staged ?? config.staged_convoys_default
- Add Switch toggle in town settings UI under new Convoys section
- Add field to admin router TownConfigRecord
- Fix duplicate mayorToken DOM id in dashboard convoy panel (use convoyMayorToken)
- Remove 'staged' from Convoy status enum in container plugin types
  (staging is tracked by the boolean field, not status)
- Re-read bead after hookBead in startConvoy so assignee is up to date
- Change convoy.created to convoy.started event in startConvoy
- Use result.convoy.staged instead of args.staged in gt_sling_batch
  so tool output reflects actual server state (respects town config default)
- Add getConvoy tRPC query so ConvoyPanel uses a by-id query instead of
  filtering listConvoys (drawer no longer breaks when convoy lands)
- Emit convoy.created event in slingConvoy so batch-created convoys
  appear in the activity feed/analytics
- Fix prettier formatting on generated .d.ts files
startConvoy now clears the staged flag only after all agents are
successfully hooked. If getOrCreateAgent or hookBead throws partway
through, the convoy remains staged so the caller can safely retry.
…beads

If startConvoy throws after hooking some beads, the convoy stays staged
for retry. On retry, skip beads that already have an assignee to avoid
duplicate hooks and orphaned agents.
@jrf0110 jrf0110 merged commit 60bc2bb into main Mar 15, 2026
18 checks passed
@jrf0110 jrf0110 deleted the 1006-staged-convoys branch March 15, 2026 01:38
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.

Staged convoys â plan, review, and iterate before executing

2 participants