Skip to content

feat: opt-in polecat self-terminate after gt done (polecat_self_terminate config)#3295

Closed
dannomayernotabot wants to merge 4 commits intogastownhall:mainfrom
dannomayernotabot:polecat/disposable-polecats
Closed

feat: opt-in polecat self-terminate after gt done (polecat_self_terminate config)#3295
dannomayernotabot wants to merge 4 commits intogastownhall:mainfrom
dannomayernotabot:polecat/disposable-polecats

Conversation

@dannomayernotabot
Copy link
Copy Markdown
Contributor

@dannomayernotabot dannomayernotabot commented Mar 26, 2026

Summary

Opt-in config option. Adds polecat_self_terminate (default: false) under operational.daemon in settings/config.json. When enabled, polecats kill their tmux session 3 seconds after gt done instead of transitioning to IDLE. Default behavior is unchanged.

{"operational": {"daemon": {"polecat_self_terminate": true}}}

Understanding the Current Design

The persistent polecat model (gt-hdf8) is well-designed:

  • "Done means idle, not dead" — sessions preserved for reuse
  • Worktree reuse saves ~5s of git worktree add
  • Identity persistence via CV chain across assignments
  • Clean three-layer architecture (Identity/Sandbox/Session)

Why Opt-In Self-Termination Helps at Scale

At 10-30 concurrent polecats, the persistent model creates compounding issues:

  1. Stale agent bead state — reused polecats retain old hook_bead, causing reaper to kill working polecats (fix: daemon idle reaper checks work bead assignee before killing polecats #3294)
  2. Idle polecats never pick up new work — sit at prompt indefinitely after gt done
  3. Token waste — reused sessions carry previous task context
  4. Convoy dispatch confusion — idle polecats with stale state look like unassigned targets

What's Preserved

  • Worktree reuseFindIdlePolecat finds dead-session polecats, ReuseIdlePolecat creates fresh branch on existing worktree
  • Identity persistence — agent beads and work history survive session death
  • Default behavior unchanged — existing deployments are unaffected

Evidence

I have a long markdown file tracking all my findings throughout this process and documentation of what occurred, how i fixed, etc etc. happy to share if helpful/wanted

@github-actions github-actions bot added the status/needs-triage Inbox — we haven't looked at it yet label Mar 26, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 26, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
9320 2 9318 48
View the top 2 failed test(s) by shortest run time
github.com/steveyegge/gastown/internal/cmd::TestStampLoop_InvalidValence
Stack Traces | 0s run time
=== RUN   TestStampLoop_InvalidValence
=== PAUSE TestStampLoop_InvalidValence
=== CONT  TestStampLoop_InvalidValence
    testing.go:1712: race detected during execution of test
--- FAIL: TestStampLoop_InvalidValence (0.00s)
=== RUN   TestStampLoop_InvalidValence/quality_too_high
--- PASS: TestStampLoop_InvalidValence/quality_too_high (0.00s)
=== RUN   TestStampLoop_InvalidValence/quality_negative
--- PASS: TestStampLoop_InvalidValence/quality_negative (0.00s)
github.com/steveyegge/gastown/internal/cmd::TestStampLoop_SelfStampFails
Stack Traces | 0s run time
=== RUN   TestStampLoop_SelfStampFails
=== PAUSE TestStampLoop_SelfStampFails
=== CONT  TestStampLoop_SelfStampFails
    testing.go:1712: race detected during execution of test
--- FAIL: TestStampLoop_SelfStampFails (0.00s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@dannomayernotabot dannomayernotabot force-pushed the polecat/disposable-polecats branch from 6032e79 to 55ebfdd Compare March 26, 2026 01:17
@dannomayernotabot dannomayernotabot changed the title feat: polecats self-terminate after gt done (disposable model) feat: opt-in polecat self-terminate after gt done (polecat_self_terminate config) Mar 26, 2026
dannomayernotabot and others added 4 commits March 26, 2026 01:24
… binaries

- Add nolint:unparam to writeTemplate for unused hooksDir parameter
- Update TestBuildRefineryPatrolVars_FullConfig to expect judgment_enabled
  and review_depth vars added to buildRefineryPatrolVars
- Add dummy opencode binary to PATH in TestRunHooksSyncNonClaudeAgent so
  agent resolution doesn't fall back to claude
- Add dummy agent binaries to scaffoldWorkspace in doctor tests so
  template agent sync checks can actually detect non-Claude agents

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lip-flop

When both an orphan database (e.g., "gastown") and its canonical counterpart
("gt") exist in Dolt, EnsureAllMetadata would process both, writing different
dolt_database values to the same metadata.json. This caused confusing
"identity mismatch repair" warnings that flip-flopped on every startup.

Build a reverse rig→canonical-DB map and skip databases that share a rig's
directory name but aren't the rig's canonical database.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cats

The idle reaper checked agent bead hook_bead to determine if a polecat
had active work, but updateAgentHookBead was made a no-op (declaring
work bead assignee as authoritative). This caused the reaper to kill
working polecats whose agent bead hook_bead pointed to stale/closed
beads from previous swarms.

Add hasAssignedOpenWork() fallback: before killing a polecat as
"working-no-hook", query bd list for beads assigned to this polecat
with hooked/in_progress/open status. If any exist, the polecat has
active work and should not be reaped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add `polecat_self_terminate` config option (default: false) under
operational.daemon. When enabled, polecats kill their session 3s after
gt done instead of transitioning to IDLE.

Config: settings/config.json → operational.daemon.polecat_self_terminate: true

This is opt-in to preserve the existing persistent polecat model while
allowing operators who run at scale (10-30 concurrent polecats) to use
disposable polecats with fresh context windows per task.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@steveyegge
Copy link
Copy Markdown
Collaborator

Superseded by #3302 (same feature — opt-in polecat self-terminate) which was merged.

@steveyegge steveyegge closed this Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-triage Inbox — we haven't looked at it yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants