Skip to main content

Gas Town Escalation Protocol

Reference for the unified escalation system in Gas Town.

Overview

Gas Town agents escalate issues when automated resolution is not possible. Escalations are severity-routed, tracked as beads, and support stale detection with automatic re-escalation.

Severity Levels

LevelPriorityDescriptionDefault Route
CRITICALP0 (urgent)System-threatening, immediate attentionbead + mail + email + SMS
HIGHP1 (high)Important blocker, needs human soonbead + mail + email
MEDIUMP2 (normal)Standard escalation, human at conveniencebead + mail mayor

Tiered Escalation Flow

Agent -> gt escalate -s <SEVERITY> "description"
|
v
[Deacon receives]
|
+-- resolves --> updates issue, re-slings work
+-- cannot --> forwards to Mayor
+-- resolves --> updates issue, re-slings
+-- cannot --> forwards to Overseer --> resolves

Each tier can resolve OR forward. The chain is tracked via bead comments.

Configuration

Config file: ~/gt/settings/escalation.json

Default Configuration

{
"type": "escalation",
"version": 1,
"routes": {
"medium": ["bead", "mail:mayor"],
"high": ["bead", "mail:mayor", "email:human"],
"critical": ["bead", "mail:mayor", "email:human", "sms:human"]
},
"contacts": {
"human_email": "",
"human_sms": ""
},
"stale_threshold": "4h",
"max_reescalations": 2
}

Action Types

ActionFormatBehavior
beadbeadCreate escalation bead (always first, implicit)
mail:<target>mail:mayorSend gt mail to target
email:humanemail:humanSend email to contacts.human_email
sms:humansms:humanSend SMS to contacts.human_sms
slackslackPost to contacts.slack_webhook
loglogWrite to escalation log file

Escalation Beads

Escalation beads use type: escalation with structured labels for tracking.

Label Schema

LabelValuesPurpose
severity:<level>MEDIUM, HIGH, CRITICALCurrent severity
source:<type>:<name>plugin:rebuild-gt, patrol:deaconWhat triggered it
acknowledged:<bool>true, falseHas human acknowledged
reescalated:<bool>true, falseHas been re-escalated
reescalation_count:<n>0, 1, 2, ...Times re-escalated
original_severity:<level>MEDIUM, HIGHInitial severity

Category Routing (future)

Categories provide structured routing based on the nature of the escalation. Not yet implemented as CLI flags; currently use --to for explicit routing.

CategoryDescriptionDefault Route
decisionMultiple valid paths, need choiceDeacon -> Mayor
helpNeed guidance or expertiseDeacon -> Mayor
blockedWaiting on unresolvable dependencyMayor
failedUnexpected error, can't proceedDeacon
emergencySecurity or data integrity issueOverseer (direct)
gate_timeoutGate didn't resolve in timeDeacon
lifecycleWorker stuck or needs recycleWitness

Commands

gt escalate

Create a new escalation.

gt escalate -s <MEDIUM|HIGH|CRITICAL> "Short description" \
[-m "Detailed explanation"] [--source="plugin:rebuild-gt"]

Flags: -s severity (required), -m body, --source origin identifier, --to route to tier (deacon/mayor/overseer), --dry-run, --json.

gt escalate ack

Acknowledge an escalation (prevents re-escalation).

gt escalate ack <bead-id> [--note="Investigating"]

gt escalate list

gt escalate list [--severity=...] [--stale] [--unacked] [--all] [--json]

gt escalate stale

Re-escalate stale (unacked past stale_threshold) escalations. Bumps severity (MEDIUM->HIGH->CRITICAL), re-executes route, respects max_reescalations.

gt escalate stale [--dry-run]

gt escalate close

gt escalate close <bead-id> [--reason="Fixed in commit abc123"]

Integration Points

Plugin System

Plugins use escalation for failure notification:

gt escalate -s MEDIUM "Plugin FAILED: rebuild-gt" \
-m "$ERROR" --source="plugin:rebuild-gt"

Deacon Patrol

Deacon uses escalation for health issues:

if [ $unresponsive_cycles -ge 5 ]; then
gt escalate -s HIGH "Witness unresponsive: gastown" \
-m "Witness has been unresponsive for $unresponsive_cycles cycles" \
--source="patrol:deacon:health-scan"
fi

Deacon patrol also runs gt escalate stale periodically to catch unacked escalations and re-escalate them.

When to Escalate

Agents SHOULD escalate when:

  • System errors: Database corruption, disk full, network failures
  • Security issues: Unauthorized access attempts, credential exposure
  • Unresolvable conflicts: Merge conflicts that cannot be auto-resolved
  • Ambiguous requirements: Spec is unclear, multiple valid interpretations
  • Design decisions: Architectural choices that need human judgment
  • Stuck loops: Agent is stuck and cannot make progress
  • Gate timeouts: Async conditions did not resolve in expected time

Agents should NOT escalate for:

  • Normal workflow: Regular work that can proceed without human input
  • Recoverable errors: Transient failures that will auto-retry
  • Information queries: Questions that can be answered from context

Mayor Startup Check

On gt prime, Mayor displays pending escalations grouped by severity. Action: review with bd list --tag=escalation, close with bd close <id> --reason "...".

Viewing Escalations

# List all open escalations
bd list --status=open --tag=escalation

# Filter by category
bd list --tag=escalation --tag=decision

# View specific escalation
bd show <escalation-id>

# Close resolved escalation
bd close <id> --reason "Resolved by fixing X"