fix: reject named_session entries referencing pool agents (#574)#654
Open
rileywhite wants to merge 1 commit intogastownhall:mainfrom
Open
fix: reject named_session entries referencing pool agents (#574)#654rileywhite wants to merge 1 commit intogastownhall:mainfrom
rileywhite wants to merge 1 commit intogastownhall:mainfrom
Conversation
0f20e7d to
c162187
Compare
This was referenced Apr 12, 2026
c162187 to
72ca60f
Compare
This was referenced Apr 13, 2026
Contributor
Author
72ca60f to
9cf65ac
Compare
…l#574) Add pool-agent check in ValidateNamedSessions (internal/config/config.go) that rejects named_session entries where the referenced template has namepool/namepool_names set or max_active_sessions != 1. Enforces the invariant from engdocs/design/named-configured-sessions.md Section 8 at boot time. - max_active_sessions = 1 explicitly allowed (singleton cap) - nil max (basic template, no pool fields) accepted - Namepool, max > 1, max = 0, max = -1 (unlimited) all rejected - Includes per-agent drain policy (lifecycle block) Closes gastownhall#574 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9cf65ac to
2df2190
Compare
2 tasks
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
Adds a pool-agent check in
ValidateNamedSessions(internal/config/config.go) thatrejects
[[named_session]]entries where the referenced template hasnamepool/namepool_namesset or
max_active_sessions != 1. This enforces the invariant documented inengdocs/design/named-configured-sessions.mdSection 8 at boot time.max_active_sessions = 1is explicitly allowed (singleton cap, used by gastown pack)nilmax (basic template, no pool fields) is acceptedCloses #574
Closes #504
What was tested
make fmt-check— pass (0 issues)make lint— pass (0 issues)make vet— passgo test -v -run TestValidateNamedSessions ./internal/config/— all 8 subtests passReview outcome
Design council (5 perspectives) identified the correct approach. Adversarial review caught a
critical bug in the first cut:
max_active_sessions = 1was incorrectly rejected as "pool",which would have broken gastown pack configs (mayor, deacon, boot, witness, refinery all use
max=1 + named_session). What-about review confirmed the same issue from a second angle
(control-dispatcher implicit agent). Fix: changed check to allow max=1, aligning with the
runtime's
isMultiSessionCfgAgentdefinition and the API layer'sisMultiSessionAgent.Neutral judge verdict: CLEARED.
Residual note: the codebase has three separate "is pool" definitions that don't fully agree
(config validation, runtime
isMultiSessionCfgAgent, APIisMultiSessionAgent). This isintentional — config-time treats nil max as "basic template" while runtime treats it as
"unlimited = multi-session". A future cleanup could extract named predicates.
Changes
internal/config/config.goValidateNamedSessionsinternal/config/session_sleep_test.goNo documentation changes needed — the invariant was already documented.
No breaking changes for in-tree configs.
🤖 Generated with Claude Code