Skip to content

fix(gastown): bug fixes — org billing (#1756), reconciler spam (#1364), stuck MR beads (#1632), session leak (#1341)#1862

Open
jrf0110 wants to merge 11 commits intomainfrom
convoy/bug-fixes-1756-1364-1632-1341/f3939d64/head
Open

fix(gastown): bug fixes — org billing (#1756), reconciler spam (#1364), stuck MR beads (#1632), session leak (#1341)#1862
jrf0110 wants to merge 11 commits intomainfrom
convoy/bug-fixes-1756-1364-1632-1341/f3939d64/head

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented Apr 1, 2026

Summary

Consolidates 4 independent bug fixes from the Gastown convoy into a single landing PR:

Also includes 5 independently-reviewed PRs merged into this integration branch: #1842, #1848, #1851, #1856, #1858.

Verification

  • All 4 fix branches merged cleanly with git merge --no-ff (no conflicts)
  • Code review of all commits: correctness, style consistency, security
  • No leaked secrets or build artifacts in the diff
  • Branch pushed successfully

Visual Changes

N/A

Reviewer Notes

Closes #1756, closes #1364, closes #1632, closes #1341.

jrf0110 added 9 commits April 1, 2026 03:49
…every 5s

Invariant 7: Exclude mayors from the 'working agent must have a hook'
check — mayors are always working and intentionally hookless.

Invariant 5: Widen valid convoy bead states to include in_progress and
in_review, which are legitimate transient states while child beads are
being worked on. Only flag truly unexpected states.

Fixes #1364
Store organizationId as a standalone env var (GASTOWN_ORGANIZATION_ID)
that survives KILO_CONFIG_CONTENT rebuilds. Three defense layers:

1. Set GASTOWN_ORGANIZATION_ID on /agents/start and read it first in
   extractOrganizationId() before falling back to config extraction.
2. Pass organizationId in the PATCH /model request body so the
   container receives it even if X-Town-Config parsing fails.
3. Include organization_id in buildContainerConfig and sync it to
   process.env in the PATCH handler's X-Town-Config processing.
…ng agent

Thread an AbortController through the startAgent() startup sequence so
that when a restart is requested for an agent still in 'starting' status,
the in-flight startup is cancelled before session.create() can produce an
orphaned session.

- Add startupAbortController field to ManagedAgent type
- In startAgent: abort existing startup controller when agent is 'starting'
- Check signal.aborted after each async step (ensureSDKServer,
  session.create, before session.prompt)
- On abort: decrement sessionCount, remove agent entry, clean up SDK
  instance if no sessions remain
- In stopAgent: also abort startupAbortController for 'starting' agents
- Introduce StartupAbortedError to distinguish abort from real failures

Fixes #1341
…ssing (#1632)

- Fall back to github_cli_pat then platform integration token in checkPRStatus
- Track consecutive null poll results; fail MR bead after 10 nulls
- Rate-limit PR polling to once per minute per MR bead via last_poll_at metadata
- Store failureReason and failureMessage in bead metadata on permanent failure
- Add explicit 'unknown' type annotation to lastPollAt to fix
  no-unsafe-assignment lint error
- Auto-format ternary expression per oxfmt rules
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 1, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • cloudflare-gastown/container/src/process-manager.ts
  • cloudflare-gastown/src/dos/town/actions.ts

Reviewed by gpt-5.4-20260305 · 152,526 tokens

…non-null polls, abort orphaned session on startup abort, guard agents.delete with identity check
… session leak

After session.create() resolves, parse and store the session ID on the
agent object BEFORE checking signal.aborted. This ensures the catch
block has agent.sessionId available to call session.abort(), closing
the race window where an abort during session.create() could leak an
orphaned session.

Also fixes format-check CI by running oxfmt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant