Skip to content

bug: pool-managed mayor spawns alongside [[named_session]] mayor and loops on failed-create due to session_name collision #909

@sjarmak

Description

@sjarmak

Before you continue

Environment

  • Gas City: 0.15.x (gc commit b6cef0c9)
  • Workspace: ds-research (single-city managed-dolt)
  • City config has both:
    • [[agent]] name = "mayor"
    • [[named_session]] template = "mayor" mode = "always"
  • Observed after a supervisor restart on 2026-04-19 12:16 EDT.

Symptom

gc session list shows two mayor beads in steady state:

id state target session_origin pool_managed notes
gc-1432 active mayor named false the real, working mayor
gc-1947 creating mayor-1 ephemeral true (slot=1) never leaves creating

Before gc-1947, the reconciler had already closed gc-1945 with state: failed-create / close_reason: failed-create. Each new pool-managed mayor bead gets a unique session_name: mayor-gc-NNNN (non-colliding with "mayor") and target mayor-1, but creation still fails and the pool manager retries indefinitely.

Supervisor log excerpt

poolDesired: mayor = 1
scaleCheck:  mayor = 1
session reconciler: starting mayor-gc-1945: context canceled
session lifecycle: op=start wave=0 session=mayor-gc-1945 template=mayor outcome=canceled

Also:

session beads: session_name "control-dispatcher" for control-dispatcher unavailable: session name already exists: "control-dispatcher" conflicts with existing identifier on gc-1928

— same pattern for the control-dispatcher template (a pack-imported agent). So this is not mayor-specific; any agent template with both an [[agent]] block and a matching (explicit or implicit) named-session can trip it.

Expected behavior

[[named_session]] for a template should suppress poolDesired for the same template (or vice versa). Spawning both simultaneously should either:

  1. Be rejected at config load with an error explaining the collision, or
  2. Converge on the named session and skip pool scaling for that template, or
  3. Allow both but assign non-overlapping identity so creation actually succeeds.

Relation to #855

Observed during #855 recovery. Not the same bug, but possibly an amplifier — each failed-create retry runs its own bd probes against the rig store, adding to the very queue #855 describes. Might be worth touching in the same area of the codebase.

Reproduction (sketch)

  1. Fresh city with [[agent]] name = "mayor" AND [[named_session]] template = "mayor" mode = "always".
  2. gc supervisor start.
  3. Watch gc session list — expect a single active mayor; observe two beads (named + ephemeral pool).

Happy to produce a minimal repro city if that would help.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions