carlos / platform Public

fix: preserve session lifetime refusal before pool admission

Check an existing session entry before waking so an old incarnation keeps ErrCmdIncarnation. Pool admission and the later session checks still apply.
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
claude agent, operated by paul@keymail.dev 3e3928aae7569ff9edcf594a5b9e2e6752219f7b parent 717a8af
1 file changed, +7 −0
  • internal/activator/cmd.go +7 −0

Intent

Human

<task-notification> <task-id>a2d7e4c6b74f32148</task-id> <tool-use-id>toolu_01T7qgNNvLxDanshq1xC2fR9</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/5555438b-7fa2-408d-b2c4-9fa87ea89332/tasks/a2d7e4c6b74f32148.output</output-file> <status>completed</status> <summary>Agent "F-B grouped review R1 (Opus)" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**NOT READY.** Counts: 1 P1, 2 P2, 3 P3. - P1-1 (`internal/edge/haingress.go:47,86`, `internal/host/haingress.go:75-85`, `internal/provision/haingress.go:27,53,73`): when the ingress projection is in a failed or zero state, every HA host returns 503 on every box in the region. That includes the box that holds the lease and has the host awake. Any one of these is enough to trigger it: - a failed record-view refresh; - one app's manifest or tombstone read error; - any unread record in the scan when the change index is off; - a stale record body sitting beside a valid one; - an incomplete alias pass (this one hits regional names). So one tenant's bad object, or a single failed S3 read, takes down every HA tenant in the region. Findings: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-g2-fixes/.superpowers/sdd/2026-11-06-region-ha-g2-fixes/fb-review-r1.md</result> <usage><subagent_tokens>196679</subagent_tokens><tool_uses>57</tool_uses><duration_ms>672438</duration_ms></usage> </task-notification>

diff --git a/internal/activator/cmd.go b/internal/activator/cmd.go
index 662fb4c27..0ee66d2f8 100644
--- a/internal/activator/cmd.go
+++ b/internal/activator/cmd.go
@@ -741,6 +741,13 @@ func (a *Service) RunCmd(ctx context.Context, rt registry.Route, spec CmdSpec) (
defer cancel()
var release func()
for {
+ a.mu.Lock()
+ e := a.entries[rt.Host]
+ wrongLifetime := e != nil && sessionIncarnationLocked(e, spec)
+ a.mu.Unlock()
+ if wrongLifetime {
+ return refuse(ErrCmdIncarnation)
+ }
r, err := a.begin(wctx, rt, true, nil)
if err == nil {
release = r