Skip to content

feat: opt-in polecat self-terminate after gt done (with cleanup fix)#3302

Merged
steveyegge merged 2 commits intogastownhall:mainfrom
dannomayernotabot:polecat/disposable-polecats-v2
Mar 27, 2026
Merged

feat: opt-in polecat self-terminate after gt done (with cleanup fix)#3302
steveyegge merged 2 commits intogastownhall:mainfrom
dannomayernotabot:polecat/disposable-polecats-v2

Conversation

@dannomayernotabot
Copy link
Copy Markdown
Contributor

@dannomayernotabot dannomayernotabot commented Mar 26, 2026

I KNOW YOU ALREADY CHAGNED THIS BUT HEAR ME OUT

i saw
https://discord.com/channels/1462817445562814505/1462953549838291045/1475601173812740129

we have been discussing in troubleshooting, starting around here https://discord.com/channels/1462817445562814505/1462951684551737509/1486363653489037552

this is the latest summary of the issues and why i am wanting these changes:
polecat-session-deaths (1).md

its entirely possible im just using gastown wrong, i probably am, but i cannot figure out how to make all of these polecat deaths reliably cease without making them ephemeral. this is half pr half cry for help

Summary

  • Add polecat_self_terminate config option (default: false) under operational.daemon
  • When enabled, polecats kill their session after gt done completes instead of transitioning to IDLE
  • Fix: Self-terminate now fires AFTER all cleanup (branch push, MR submit, worktree sync) — original placement fired mid-cleanup, leaving orphaned worktree directories

Supersedes #3295 (same feature, adds the cleanup timing fix).

Test plan

  • go build ./... passes
  • Tested with 26 concurrent polecats — zero deaths, all beads completed
  • Verify worktree directories are cleaned up after self-terminate

Generated with Claude Code

dannomayernotabot and others added 2 commits March 26, 2026 04:02
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>
The self-terminate goroutine was firing inside the idle-transition block,
3 seconds before gt done finished. This killed the tmux session before
the worktree nuke and other cleanup could complete, leaving 25 orphaned
worktree directories on disk.

Move self-terminate to be the LAST action in gt done, after all cleanup
(branch push, MR submit, worktree sync, branch delete) has completed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
9319 5 9314 48
View the top 3 failed test(s) by shortest run time
github.com/steveyegge/gastown/internal/cmd::TestBuildRefineryPatrolVars_FullConfig
Stack Traces | 0s run time
=== RUN   TestBuildRefineryPatrolVars_FullConfig
    patrol_helpers_test.go:166: expected 5 vars, got 7: [target_branch=main integration_branch_refinery_enabled=true integration_branch_auto_land=false run_tests=true delete_merged_branches=true judgment_enabled=false review_depth=standard]
--- FAIL: TestBuildRefineryPatrolVars_FullConfig (0.00s)
github.com/steveyegge/gastown/internal/cmd::TestRunHooksSyncNonClaudeAgent
Stack Traces | 0.01s run time
=== RUN   TestRunHooksSyncNonClaudeAgent
Syncing hooks...
  ✓ mayor/.claude/settings.json (created)
  ✓ deacon/.claude/settings.json (created)
  ✓ myrig/crew/.claude/settings.json (created)
warning: role_agents[crew]=opencode - agent "opencode" binary "opencode" not found in PATH, falling back to default

Synced 3 targets (3 created, 0 updated, 0 unchanged)
    hooks_sync_test.go:366: opencode plugin not created in worktree alice
--- FAIL: TestRunHooksSyncNonClaudeAgent (0.01s)
github.com/steveyegge/gastown/internal/doctor::TestHooksSyncCheck_Fix_TemplateAgent
Stack Traces | 0.01s run time
=== RUN   TestHooksSyncCheck_Fix_TemplateAgent
warning: role_agents[crew]=opencode - agent "opencode" binary "opencode" not found in PATH, falling back to default
    hooks_sync_check_test.go:219: expected StatusWarning before fix, got OK
--- FAIL: TestHooksSyncCheck_Fix_TemplateAgent (0.01s)
github.com/steveyegge/gastown/internal/doctor::TestHooksSyncCheck_TemplateAgent_Missing
Stack Traces | 0.01s run time
=== RUN   TestHooksSyncCheck_TemplateAgent_Missing
warning: role_agents[crew]=opencode - agent "opencode" binary "opencode" not found in PATH, falling back to default
    hooks_sync_check_test.go:193: expected StatusWarning for missing template agent file, got OK: All 3 hook targets in sync
--- FAIL: TestHooksSyncCheck_TemplateAgent_Missing (0.01s)
github.com/steveyegge/gastown/internal/doctor::TestHooksSyncCheck_TemplateAgent_OutOfSync
Stack Traces | 0.01s run time
=== RUN   TestHooksSyncCheck_TemplateAgent_OutOfSync
warning: role_agents[crew]=opencode - agent "opencode" binary "opencode" not found in PATH, falling back to default
    hooks_sync_check_test.go:172: expected StatusWarning for out-of-sync template agent, got OK: All 3 hook targets in sync
--- FAIL: TestHooksSyncCheck_TemplateAgent_OutOfSync (0.01s)

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

@steveyegge steveyegge merged commit a9405ae into gastownhall:main Mar 27, 2026
4 of 8 checks passed
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