Skip to content

Configuration Page #290

@jrf0110

Description

@jrf0110

Part of #271 — Gastown Cloud Proposal A (Sandbox-per-Town)

Goal

Build a settings page for gastown towns where users can configure models, agent limits, rigs, and idle behavior.

Requirements

Configuration Page

Route: /gastown/[townId]/settings

Sections:

a) Model Selection

  • Default model dropdown (populated from gateway-available models)
  • Per-role model overrides:
    • Polecat model
    • Witness model
    • Mayor model
    • Refinery model
  • Each dropdown shows model name, provider, and pricing tier
  • Changes call sandbox internal API PATCH /config → writes to gt config files
  • New agent sessions pick up the model on next spawn (existing sessions unaffected)

b) Agent Limits

  • Max concurrent polecats slider (range: 1–30, default: 8)
  • Warning at >8 about resource usage on standard tier
  • Persisted in gastown_towns.config JSONB

c) Rig Management

  • List of current rigs with name, repo URL, branch
  • "Add rig" form: repo URL, name (auto-derived from URL), default branch
  • "Remove rig" button with confirmation
  • Calls gastown.addRig / gastown.removeRig tRPC mutations

d) Idle Settings

  • Auto-stop idle timeout input (minutes, default: 30, min: 5, max: 480)
  • Toggle to disable auto-stop entirely
  • Persisted in gastown_towns.config JSONB

e) Danger Zone

  • "Destroy Town" button with double-confirmation (type town name to confirm)
  • Explains: Fly machine + volume destroyed, R2 backup retained 30 days

tRPC Additions

Route Type Description
gastown.updateTownConfig mutation Update config JSONB (models, max_polecats, idle_timeout)
gastown.getTownConfig query Read current config
gastown.getAvailableModels query List gateway-available models for dropdowns

Config Flow

  1. User changes a setting in the UI
  2. Frontend calls gastown.updateTownConfig tRPC mutation
  3. Cloud app updates gastown_towns.config in Postgres
  4. Cloud app calls sandbox internal API PATCH /config with the new settings
  5. Sandbox writes to gt config files:
    • ~/gt/settings/config.jsondefault_agent, role_agents map
    • Per-rig configs if rig-specific overrides

Files

  • cloud/src/app/gastown/[townId]/settings/page.tsx (new)
  • cloud/src/components/gastown/ModelSelector.tsx (new)
  • cloud/src/components/gastown/RigManager.tsx (new)
  • cloud/src/components/gastown/IdleSettings.tsx (new)
  • Updates to cloud/src/server/api/routers/gastown.ts

Acceptance Criteria

  • Settings page loads current config from DB + sandbox
  • Model dropdowns show available gateway models
  • Changing a model updates both Postgres config and sandbox gt config files
  • Max polecats slider updates config with warning at >8
  • Add rig form validates repo URL and creates rig in both DB and sandbox
  • Remove rig confirms and removes from both DB and sandbox
  • Idle timeout setting persists and is respected by the health monitor (PR 6)
  • Destroy town requires typing town name for confirmation
  • All settings changes provide success/error feedback
  • Page follows existing settings page patterns in the dashboard

Dependencies

  • PR 2 (Provisioning API) — addRig, removeRig, destroyTown
  • PR 3 (Sandbox Internal API) — PATCH /config endpoint
  • PR 6 (Lifecycle Management) — idle timeout enforcement
  • PR 9 (Dashboard Pages) — navigation from town detail to settings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions