fix: daemon idle reaper checks work bead assignee before killing polecats#3294
Merged
steveyegge merged 2 commits intogastownhall:mainfrom Mar 28, 2026
Merged
Conversation
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
6a933c5 to
99bb517
Compare
… 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>
…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>
99bb517 to
1bc834b
Compare
steveyegge
added a commit
that referenced
this pull request
Mar 27, 2026
…lling polecats Resolve conflicts and merge dannomayernotabot's fix (PR #3294): - Adds hasAssignedOpenWork() to query authoritative work bead assignee before reaper kills polecats with stale hook_bead fields - Keeps existing IsAgentRunning process-level guard from GH#3342 - Test fixes: dummy binaries on PATH for agent resolution fallback - patrol_helpers_test: add judgment_enabled/review_depth expected vars Co-authored-by: Danno <dannomayernotabot@users.noreply.github.com> (gt-2fr)
steveyegge
added a commit
that referenced
this pull request
Mar 27, 2026
Three test infrastructure issues in polecat_health_test.go: - writeFakeTestBD: return [] for 'list' commands so hasAssignedOpenWork doesn't false-positive on agent bead JSON - writeFakeTmuxWithAgent: use $* glob matching instead of $1, since tmux.run() prepends -u flag before the subcommand - TestReapIdlePolecat_ReapsIdleNoHook: write heartbeat to .runtime/heartbeats/ (not heartbeats/) and use NewTmuxWithSocket to avoid socket mismatch Also register 'myr' test prefix in both reap tests so session name resolves correctly (PrefixFor fallback returns 'gt', not 'myr'). (gt-2fr)
htristan
pushed a commit
to htristan/gastown
that referenced
this pull request
Mar 27, 2026
…e before killing polecats Resolve conflicts and merge dannomayernotabot's fix (PR gastownhall#3294): - Adds hasAssignedOpenWork() to query authoritative work bead assignee before reaper kills polecats with stale hook_bead fields - Keeps existing IsAgentRunning process-level guard from GH#3342 - Test fixes: dummy binaries on PATH for agent resolution fallback - patrol_helpers_test: add judgment_enabled/review_depth expected vars Co-authored-by: Danno <dannomayernotabot@users.noreply.github.com> (gt-2fr)
htristan
pushed a commit
to htristan/gastown
that referenced
this pull request
Mar 27, 2026
…merge Three test infrastructure issues in polecat_health_test.go: - writeFakeTestBD: return [] for 'list' commands so hasAssignedOpenWork doesn't false-positive on agent bead JSON - writeFakeTmuxWithAgent: use $* glob matching instead of $1, since tmux.run() prepends -u flag before the subcommand - TestReapIdlePolecat_ReapsIdleNoHook: write heartbeat to .runtime/heartbeats/ (not heartbeats/) and use NewTmuxWithSocket to avoid socket mismatch Also register 'myr' test prefix in both reap tests so session name resolves correctly (PrefixFor fallback returns 'gt', not 'myr'). (gt-2fr)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hook_beadfield to determine if a polecat had active work, butupdateAgentHookBead()was made a no-op (declaring work bead assignee as authoritative). This caused the reaper to kill working polecats whose agent beadhook_beadpointed to stale/closed beads from previous swarms.hasAssignedOpenWork()fallback: before killing a polecat as "working-no-hook", queriesbd list --rig=<rig> --assignee=<polecat> --status=hooked(and in_progress, open) to check the authoritative source. If any assigned open work bead exists, the polecat is protected.Context
The sling code and daemon reaper disagree about source of truth:
sling_helpers.go:559:updateAgentHookBeadis a no-op, declares "work bead assignee is authoritative"daemon.go:2299: idle reaper reads agent beadhook_beadto decide whether to killWhen polecats are reused (same name, new work), the stale
hook_beadon the agent bead points to a closed bead from a previous dispatch, causing the reaper to kill the polecat after 15 minutes.Test plan
Reaping idle polecat ... (state=working-no-hook)at 15 mingo build ./...)🤖 Generated with Claude Code