Skip to content

perf(gastown): shorten mayor cold start path#3369

Merged
jrf0110 merged 4 commits into
gastown-stagingfrom
3368-improve-latency
May 20, 2026
Merged

perf(gastown): shorten mayor cold start path#3369
jrf0110 merged 4 commits into
gastown-stagingfrom
3368-improve-latency

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented May 20, 2026

Summary

  • Shortens the cold path to mayor readiness by minting the container JWT for /agents/start without first issuing a live /refresh-token request.
  • Moves best-effort ensureMayor git credential refresh off the user-visible request path.
  • Prioritizes mayor boot hydration/prewarm, backgrounds non-mayor registry resume, defers mayor browse worktree setup, and adds phase timing telemetry for the new critical-path segments.

Verification

Not manually tested; this targets cold container startup behavior that needs a deployed Gastown environment to measure accurately.

Visual Changes

N/A

Reviewer Notes

Review the deferred/background work carefully: non-mayor registry hydration now runs after the boot hydration gate releases, and mayor browse worktrees are refreshed after the mayor can start with the currently discovered worktrees.

Comment thread services/gastown/container/src/agent-runner.ts Outdated
Comment thread services/gastown/container/src/process-manager.ts Outdated
Comment thread services/gastown/src/dos/town/container-dispatch.ts
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 20, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The latest commit (1f3502cd) removes the stale "AGENTS.md is rewritten when setup completes" phrase from the background worktree setup comment, resolving the final WARNING flagged in previous rounds. All previously identified issues are now addressed.

Previously Flagged — All Resolved
File Issue Resolution
services/gastown/container/src/agent-runner.ts writeMayorSystemPromptToAgentsMd called twice (AGENTS.md race) Fixed in ef556ab: second write removed from setupMayorBrowseWorktrees
services/gastown/container/src/process-manager.ts as-cast at IO boundary for registry entries Fixed in e6fed6e: ContainerRegistryEntry Zod schema and parseRegistryEntries added
services/gastown/src/dos/town/container-dispatch.ts /refresh-token push silently dropped for warm containers Addressed in e6fed6e: intentional tradeoff documented at token mint and env propagation sites
services/gastown/container/src/agent-runner.ts Stale comment: "AGENTS.md is rewritten when setup completes" Fixed in 1f3502cd: stale sentence removed
Files Reviewed (4 files)
  • services/gastown/container/src/agent-runner.ts — no issues
  • services/gastown/container/src/process-manager.ts — no issues
  • services/gastown/src/dos/town/container-dispatch.ts — no issues
  • services/gastown/src/trpc/router.ts — no issues

Reviewed by claude-sonnet-4.6 · 185,336 tokens

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

Copy link
Copy Markdown
Contributor Author

@jrf0110 jrf0110 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed all review feedback and resolved the threads.

Comment thread services/gastown/src/dos/town/container-dispatch.ts
Comment thread services/gastown/container/src/agent-runner.ts Outdated
@jrf0110 jrf0110 merged commit 3691b12 into gastown-staging May 20, 2026
2 checks passed
@jrf0110 jrf0110 deleted the 3368-improve-latency branch May 20, 2026 18:32
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