carlos / platform Public

design: group roll verb rev 3, claim cut after round 2

Stopping rule 2: the cross-machine claim is cut (script parity, one
operator account per deployment); unstable profile identity refused
up front; session token handed to the plugin by environment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d9347bffa2f6dde315946dfdf88e575246e652a2 parent ab88683
4 files changed, +319 −145
  • docs/superpowers/plans/2026-11-09-group-roll-verb.md +26 −38
  • docs/superpowers/reviews/ASTRA-R2-group-roll-verb.md +122 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-group-roll-verb-R3.md +83 −0
  • docs/superpowers/specs/2026-11-09-group-roll-verb-design.md +88 −107

CI cancelled — superseded by a newer push — run details

Intent

Human

<task-notification> <task-id>bp3cf1ywd</task-id> <tool-use-id>toolu_01PRoZ49sqQsRijrQkYkWvTk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/669506ff-23ec-45f1-9035-1d29593f2c37/tasks/bp3cf1ywd.output</output-file> <status>completed</status> <summary>Background command "Wait on Astra round 2 by pid" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 41.0 g CO₂e (4,717,715 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-group-roll-verb, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/plans/2026-11-09-group-roll-verb.md b/docs/superpowers/plans/2026-11-09-group-roll-verb.md
index 6058103bc..47e889cac 100644
--- a/docs/superpowers/plans/2026-11-09-group-roll-verb.md
+++ b/docs/superpowers/plans/2026-11-09-group-roll-verb.md
@@ -4,16 +4,16 @@
**Goal:** Port `scripts/region-group-roll.py` and `scripts/region-group-probe.py` into `carlos system group <verb>` with exact behaviour parity, a provider-neutral engine and an AWS adapter, then retire the scripts.
-**Architecture:** `internal/grouproll` is the core (journal, lock, claim, deciders, engine, box protocol, floor) and imports no AWS SDK. `internal/grouprollaws` implements the core's `Group` and `Box` interfaces with the AWS SDK and the Session Manager plugin. The CLI leaves live in `system_group.go` under the existing `systemGroupCommand()`.
+**Architecture:** `internal/grouproll` is the core (journal, lock, deciders, engine, box protocol, floor) and imports no AWS SDK. `internal/grouprollaws` implements the core's `Group` and `Box` interfaces with the AWS SDK and the Session Manager plugin. The CLI leaves live in `system_group.go` under the existing `systemGroupCommand()`.
**Tech Stack:** Go, aws-sdk-go-v2 (autoscaling, ec2, ssm, new: elasticloadbalancingv2), `internal/release` (`Store`, `GetSystemPointer`), `golang.org/x/sys/unix` for the pseudo-terminal, MinIO for integration tests.
-**Spec:** `docs/superpowers/specs/2026-11-09-group-roll-verb-design.md` (rev 2). Plan rev 2 applies Astra round 1 (`~/.cache/group-roll-go/ASTRA-R1.md`). Read it and the script before any task; the script at the merge of `held-floor-sha-map` is the parity target.
+**Spec:** `docs/superpowers/specs/2026-11-09-group-roll-verb-design.md` (rev 3). Plan rev 3 applies Astra rounds 1 and 2 (`~/.cache/group-roll-go/ASTRA-R1.md`, `ASTRA-R2.md`); round 2's repeated families were cut or refused up front, not fixed again (spec rev 3 note). Read it and the script before any task; the script at the merge of `held-floor-sha-map` is the parity target.
## Global Constraints
- Parity: every behaviour not in spec §7's table (V1-V7) matches the script decision for decision. When the spec and the script disagree on something outside §7, the script wins and the spec gets a fix.
-- Bounds copied verbatim: `WAIT=900s`, `DRAIN_TRIES=3`, `DRAIN_BOUND=3600s`, `EDGE_STOP_BOUND=120s`, `CANCEL_BOUND=300s`, session local bounds `prepare 360, apply 990, rollback 990, drain 3690, edge-stop 210, fence-clear 60, drain-cancel 390`, default 15 s; `TERMINATE_RETRIES=2`, `TERMINATE_SETTLE=120s`, `TERMINATE_PENDING=600s`; exit freshness `0 <= age <= 5s`; readiness age `<= 60s`; publication margin 2 s; `EDGES_MAX_AGE=900s`, `EDGES_SKEW=60s`; output cap 4 MiB; status body cap 8192 bytes; drain body cap 1 MiB; journal cap 64 MiB; record cap 65536 bytes.
+- Bounds copied verbatim: `WAIT=900s`, `DRAIN_TRIES=3`, `DRAIN_BOUND=3600s`, `EDGE_STOP_BOUND=120s`, `CANCEL_BOUND=300s`, session local bounds `prepare 360, apply 990, rollback 990, drain 3690, edge-stop 210, fence-clear 60, drain-cancel 390`, default 15 s; `TERMINATE_RETRIES=2`, `TERMINATE_SETTLE=120s`, `TERMINATE_PENDING=600s`; exit freshness `0 <= age <= 5s`; readiness age `<= 60s`; publication margin 2 s; `EDGES_MAX_AGE=900s`, `EDGES_SKEW=60s`; output cap 4 MiB; status body cap 8192 bytes; drain body cap 1 MiB; journal cap 64 MiB; the 65,536-byte cap applies only to the small state files (`active-v2.json`, `provider-observation.json`, `provider-divergence.json`; script `State.read`, `:656-661`), never to journal rows, which hold drain bodies up to 1 MiB.
- Regexes verbatim from the script: `SHA`, `IID`, `TX`, `EDGES_KEY`, `BUCKET`, `HOST_NAME`, and every pattern in `validate_config`.
- The core never imports `github.com/aws/...`; each new core file is added to `regionHACoreFiles` in `region_ha_boundary_test.go` in the commit that creates it.
- Linux/Darwin-only files carry `//go:build linux || darwin` with a `_other.go` sibling returning `errUnsupportedSystem`. Before every push: `GOOS=darwin GOARCH=arm64 go build ./... && GOOS=windows GOARCH=amd64 go build ./...`.
@@ -27,7 +27,7 @@
1. A machine whose clock is off by minutes: freshness and readiness ages use the local clock against box-published times; a skewed clock must refuse (as the script does), never pass. Test in Task 5.
2. Ctrl-C or a killed process mid-call: the journal has an `intent` with no `response`; the next verb must treat it as dispatched-uncertain, never as not-sent. Test in Task 7's simulation (deaths at every boundary, including inside a provider write).
-3. Two machines starting a transaction on the same group within a second: exactly one wins the claim; the other refuses before writing a journal row that a later `abandon` would need. Test in Task 11.
+3. A second operator account (or machine) with a config for the same group starts `roll` while another account's transaction has the member parked: preflight must refuse on shape (`min != max`) before any write. Test in Task 5 (`TestPreflightRefusesForeignTransactionShape`).
4. An AWS profile that resolves through SSO with an expired token: the first describe fails as `api` and nothing is written to the group. Test in Task 3.
5. A Session Manager plugin missing from `PATH` or of a version that prints a different session banner: `plan` reports it as a refusal, and no writing verb gets past preflight. Test in Task 4.
@@ -40,11 +40,11 @@
- Test: `internal/grouproll/config_test.go`, `journal_test.go`, `state_test.go`
**Interfaces:**
-- Produces: `type Config struct{...}` with the script's keys (JSON tags identical; `state_dir` is parsed and validated but not used, spec V4) and `func LoadConfig(path string) (Config, error)`; `type Journal`, `func (j *Journal) Add(kind string, fields map[string]any) (Row, error)`, `func (j *Journal) Last(kind string, match map[string]any) (Row, bool)`; `type State`, `func OpenState(c Config, readonly bool) (*State, error)`, `func (s *State) Lock() (unlock func(), err error)`, `func (s *State) Create(header Header) (*Journal, error)`, `func (s *State) Load(tx string, readonly bool) (*Journal, error)`, `func (s *State) ActiveID() (string, error)`, `func (s *State) Finish() error`, `func (s *State) OwnerToken(tx string) (string, error)` (creates `<tx>.owner`, 0600, 128 random bits, on `Create`), `func MachineID() (string, error)`; `func DefaultStateDir() string` (`$XDG_STATE_HOME/carlos/group`, else `~/.local/state/carlos/group`); `type Refusal struct{Key string; Args map[string]string}` and `func Text(key string, args ...string) string`.
+- Produces: `type Config struct{...}` with the script's keys (JSON tags identical; `state_dir` is parsed and validated but not used, spec V4) and `func LoadConfig(path string) (Config, error)`; `type Journal`, `func (j *Journal) Add(kind string, fields map[string]any) (Row, error)`, `func (j *Journal) Last(kind string, match map[string]any) (Row, bool)`; `type State`, `func OpenState(c Config, readonly bool) (*State, error)`, `func (s *State) Lock() (unlock func(), err error)`, `func (s *State) Create(header Header) (*Journal, error)`, `func (s *State) Load(tx string, readonly bool) (*Journal, error)`, `func (s *State) ActiveID() (string, error)`, `func (s *State) Finish() error`, `func ResolveStateDir(env func(string) string) (string, error)` (`$XDG_STATE_HOME/carlos/group`, else `$HOME/.local/state/carlos/group`; called once by the CLI leaf before the environment is isolated, Task 3, and passed down; no override flag); `type Refusal struct{Key string; Args map[string]string}` and `func Text(key string, args ...string) string`.
-- [ ] **Step 1: Write failing tests.** `TestConfigMatchesScriptValidation`: a table of every accept/refuse case in `scripts/region_group_roll_test.py` and `region_group_held_test.py` config tests plus the `held-floor-sha-map` keys; each refusal is `config_invalid`. `TestJournalFormat2Golden`: two fixed rows encode to the bytes in `testdata/journal-format2.golden` (header has `"format":2`, times are integer milliseconds). `TestJournalRefusesDamage`: truncated last line, duplicate key, `NaN`, a bad `previous`, a bad `hash`, `seq` gap, over 64 MiB → `record`. `TestStateRefusesUnsafe`: state dir 0755, owned by another uid, a symlinked ancestor, a group-writable ancestor → `unsafe_state`. `TestStateIgnoresScriptFiles`: a directory holding a script `active.json` and `<tx>.jsonl` is invisible to `ActiveID`, and `Load` of a `.v2.jsonl` whose header lacks `"format":2` → `record` (V4). `TestMachineID`: Linux reads `/etc/machine-id` (injected path); empty or unreadable → refusal. `TestLockRefusesSecondWriter`: a second `Lock()` in another process → `busy`.
+- [ ] **Step 1: Write failing tests.** `TestConfigMatchesScriptValidation`: a table of every accept/refuse case in `scripts/region_group_roll_test.py` and `region_group_held_test.py` config tests plus the `held-floor-sha-map` keys; each refusal is `config_invalid`. `TestJournalFormat2Golden`: two fixed rows encode to the bytes in `testdata/journal-format2.golden` (header has `"format":2`, times are integer milliseconds). `TestJournalRefusesDamage`: truncated last line, duplicate key, `NaN`, a bad `previous`, a bad `hash`, `seq` gap, over 64 MiB → `record`. `TestStateRefusesUnsafe`: state dir 0755, owned by another uid, a symlinked ancestor, a group-writable ancestor → `unsafe_state`. `TestStateIgnoresScriptFiles`: a directory holding a script `active.json` and `<tx>.jsonl` is invisible to `ActiveID`, and `Load` of a `.v2.jsonl` whose header lacks `"format":2` → `record` (V4). `TestResolveStateDir`: `XDG_STATE_HOME` set → under it; unset → under `HOME`; relative or empty `HOME` → refusal. `TestJournalLargeRow`: a 74,000-byte drain response row round-trips. `TestLockRefusesSecondWriter`: a second `Lock()` in another process → `busy`.
- [ ] **Step 2: Run** `go test ./internal/grouproll -run 'TestConfig|TestJournal|TestState|TestLock'` — FAIL (undefined).
-- [ ] **Step 3: Implement.** Canonical encoding in one function `encodeRow(map[string]any) []byte`: keys sorted, no spaces, integers only (refuse floats), HTML escaping off. Group directory `hex(sha256(group_arn))[:32]` under `DefaultStateDir()` or `--state-dir`, files `<tx>.v2.jsonl`, `active-v2.json`, `<tx>.owner`, `group.lock` (`flock(LOCK_EX|LOCK_NB)`), `provider-observation.json`, `provider-divergence.json`, plan logs `plan-<hex>.log`. File checks as `private_file` with the owner = euid (V1). Port `TEXT` verbatim.
+- [ ] **Step 3: Implement.** Canonical encoding in one function `encodeRow(map[string]any) []byte`: keys sorted, no spaces, integers only (refuse floats), HTML escaping off. Group directory `hex(sha256(group_arn))[:32]` under the resolved state directory, files `<tx>.v2.jsonl`, `active-v2.json`, `group.lock` (`flock(LOCK_EX|LOCK_NB)`), `provider-observation.json`, `provider-divergence.json`, plan logs `plan-<hex>.log`. File checks as `private_file` with the owner = euid (V1). Port `TEXT` verbatim.
- [ ] **Step 4: Run** the same command — PASS.
- [ ] **Step 5: Commit** `grouproll: config, journal format 2 and the group lock`.
@@ -76,9 +76,9 @@
- Produces in core `internal/grouproll/provider.go`: `type Phase string` (`Serving, Parking, Parked, Returning, ReturnHeld, Leaving, Absent, Unknown`); `type GroupView struct{Name, ARN, Deployment, Region string; Minimum, Desired, Maximum int; Members map[string]Member; Template map[string]any; TargetGroups []string}` with `Member{Phase Phase; Raw string; Healthy bool}`; `type Activity struct{ID, Kind, Status string; Time int64}`; `type Group interface { Describe(ctx) (GroupView, error); Targets(ctx, arn string) (map[string]string, error); Hook(ctx) (Hook, error); Online(ctx, iid string) (bool, error); Activities(ctx, iid string) ([]Activity, error); Membership(ctx, iid string) (row MemberRow, found bool, err error); Instance(ctx, iid string) (InstanceState, error); TemplateRelease(ctx, tpl map[string]any) (string, error); SetMinimum(ctx, n int) (WriteResult, error); RaiseDesired(ctx, n int) (WriteResult, error); Park(ctx, iid string) (WriteResult, error); Unpark(ctx, iid string) (WriteResult, error); Terminate(ctx, iid string) (WriteResult, error) }`. `Membership` is the member's own Auto Scaling row (group name, template, raw state, phase, health), which the probe reconciles against `Describe`; `Instance` is EC2 existence for `close-lost`. `WriteResult{Activity string; Uncertain bool; Response any}`.
- Produces in adapter: `func New(ctx, c grouproll.Config) (*Adapter, error)`; `func MapPhase(state string) grouproll.Phase`.
-- [ ] **Step 1: Failing tests.** `TestMapPhaseTotal`: every state in the spec §5.2 table maps as listed; `"Warmed:Pending"` → `Unknown`. `TestIsolatedEnvironment` (runs the adapter constructor in a subprocess): with `AWS_ACCESS_KEY_ID`, `AWS_PROFILE=other`, `AWS_DEFAULT_PROFILE=other`, `AWS_ENDPOINT_URL=http://127.0.0.1:1`, `AWS_ENDPOINT_URL_AUTO_SCALING=…`, `AWS_CONTAINER_CREDENTIALS_FULL_URI=…` set, and a shared config whose profile has `endpoint_url = http://127.0.0.1:1`, the resolved credentials are the profile's static keys, every client's resolved endpoint is the AWS regional one, and `os.Environ()` afterwards holds only the allow-list plus `AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true`, `AWS_EC2_METADATA_DISABLED=true`, `AWS_PROFILE=<profile>`. `TestRefusedCredentialSources`: profiles with `credential_source = Environment`, `Ec2InstanceMetadata`, `EcsContainer` → refused before any call. `TestExpiredSSOIsAPIRefusal` (Review Focus 4). `TestWriteShapes` (SDK middleware capture, no network): `Park` sends `ShouldDecrementDesiredCapacity=true` for exactly that iid; `Terminate` sends `ShouldDecrementDesiredCapacity=false` and refuses (`h4`) unless a fresh describe shows the member `Standby` and `desired == minimum`; `RaiseDesired` refuses unless `desired <= n <= maximum`; no method can lower desired. `TestActivitiesKinds`: "Moving EC2 instance out of Standby", "to Standby", "into Standby", "Terminating EC2 instance" classified as the script; a description naming another iid is ignored. `TestTemplateRelease`: gzip and plain user data; zero or two `CARLOS_RELEASE=` lines → `api`. `TestTargetsDuplicatePort`: two registrations with different states → `unknown`. `TestInstanceNotFound`: an empty filtered response → `not-found`; a CLI error is never absence.
+- [ ] **Step 1: Failing tests.** `TestMapPhaseTotal`: every state in the spec §5.2 table maps as listed; `"Warmed:Pending"` → `Unknown`. `TestIsolatedEnvironment` (runs the adapter constructor in a subprocess): with `AWS_ACCESS_KEY_ID`, `AWS_PROFILE=other`, `AWS_DEFAULT_PROFILE=other`, `AWS_ENDPOINT_URL=http://127.0.0.1:1`, `AWS_ENDPOINT_URL_AUTO_SCALING=…`, `AWS_CONTAINER_CREDENTIALS_FULL_URI=…` set, and a shared config whose profile has `endpoint_url = http://127.0.0.1:1`, the resolved credentials are the profile's static keys, every client's resolved endpoint is the AWS regional one, and `os.Environ()` afterwards holds only the allow-list plus `AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true`, `AWS_EC2_METADATA_DISABLED=true`, `AWS_PROFILE=<profile>`. `TestProfileIdentityRule` (spec §4): accepted — static keys; `sso_session` profile; assume-role with `role_session_name` over static keys; a two-link chain where both links name `role_session_name`. Refused before any call — any `credential_source`; `credential_process`; `web_identity_token_file`; assume-role without `role_session_name` at any link of the chain. `TestProfileFromAllowedFile`: a profile present only in the file named by `AWS_CONFIG_FILE` validates and loads (validation and loading get the same explicit file lists). `TestCallerJournaled`: the `sts:GetCallerIdentity` `UserId` is journaled in the `begin` row. `TestExpiredSSOIsAPIRefusal` (Review Focus 4). `TestWriteShapes` (SDK middleware capture, no network): `Park` sends `ShouldDecrementDesiredCapacity=true` for exactly that iid; `Terminate` sends `ShouldDecrementDesiredCapacity=false` and refuses (`h4`) unless a fresh describe shows the member `Standby` and `desired == minimum`; `RaiseDesired` refuses unless `desired <= n <= maximum`; no method can lower desired. `TestActivitiesKinds`: "Moving EC2 instance out of Standby", "to Standby", "into Standby", "Terminating EC2 instance" classified as the script; a description naming another iid is ignored. `TestTemplateRelease`: gzip and plain user data; zero or two `CARLOS_RELEASE=` lines → `api`. `TestTargetsDuplicatePort`: two registrations with different states → `unknown`. `TestInstanceNotFound`: an empty filtered response → `not-found`; a CLI error is never absence.
- [ ] **Step 2: Run** `go test ./internal/grouprollaws -run .` — FAIL.
-- [ ] **Step 3: Implement** `func IsolateEnvironment(profile string) error` (called by the CLI leaf before anything else: `os.Clearenv`, then the spec §4 allow-list and the three fixed values), then `awsconfig.LoadDefaultConfig` with `WithSharedConfigProfile(c.Profile)`, `WithRegion(c.Region)`, IMDS disabled, `RetryMaxAttempts=1`, 2 s connect and read timeouts; read the profile's `credential_source` with `awsconfig.LoadSharedConfigProfile` first and refuse the three sources.
+- [ ] **Step 3: Implement** `func IsolateEnvironment(profile string) error` (called by the CLI leaf before anything else: `os.Clearenv`, then the spec §4 allow-list and the three fixed values), then `awsconfig.LoadDefaultConfig` with `WithSharedConfigProfile(c.Profile)`, `WithRegion(c.Region)`, IMDS disabled, `RetryMaxAttempts=1`, 2 s connect and read timeouts; resolve the two shared-file paths once (before `IsolateEnvironment`) and pass them as `WithSharedConfigFiles` and `WithSharedCredentialsFiles` to both `awsconfig.LoadSharedConfigProfile` (for the rule, walking `SourceProfileName` to the end) and `LoadDefaultConfig`.
- [ ] **Step 4: Run** — PASS.
- [ ] **Step 5: Commit** `grouprollaws: Auto Scaling, ELB and EC2 calls behind the Group interface`.
@@ -90,11 +90,11 @@
**Interfaces:**
- Consumes: Task 2 `RemoteCommand`, `ParseFramed`, `Box`.
-- Produces: `func (a *Adapter) Run(ctx, iid, verb string, args grouproll.BoxArgs) (grouproll.BoxResult, error)` implementing `grouproll.Box`; `func (a *Adapter) CancelSession(ctx, id string) error` (`ssm:TerminateSession`).
+- Produces: `func (a *Adapter) Run(ctx context.Context, iid, verb string, args grouproll.BoxArgs, onSession func(id string)) (grouproll.BoxResult, error)` and `CancelSession`, with `var _ grouproll.Box = (*Adapter)(nil)` in `session.go`. `onSession` is called synchronously when the session id is seen; if the engine's journal write inside it fails, the engine records the failure and, once `Run` returns, raises it as `record` and cancels the session by id before anything else; `func (a *Adapter) CancelSession(ctx, id string) error` (`ssm:TerminateSession`).
-- [ ] **Step 1: Failing tests** using a fake plugin binary built in `TestMain` and put first on `PATH`: `TestSessionReadsFrame`; `TestSessionBoundKillsGroup` (the fake ignores SIGTERM and forks a child; at the bound both are gone, error is uncertain-timeout, the session id seen was reported to the observer); `TestSessionOutputCap` (4 MiB + 1 → `remote`); `TestPluginMissing` (Review Focus 5: `PATH` without it → `remote` refusal naming the plugin); `TestSessionStartArgs` (the StartSession request carries the config's `document`, the target iid and `{"command":[<RemoteCommand>]}`). `TestPluginArgs`: the fake plugin records argv and env; argv is `<response json> <region> StartSession <config profile> <request json> <resolved ssm endpoint>` and the endpoint equals the SDK's resolution for the region (an `aws-cn` region gives the `.amazonaws.com.cn` host); env holds no ambient keys.
+- [ ] **Step 1: Failing tests** using a fake plugin binary built in `TestMain` and put first on `PATH`: `TestSessionReadsFrame`; `TestSessionBoundKillsGroup` (the fake ignores SIGTERM and forks a child; at the bound both are gone, error is uncertain-timeout, the session id seen was reported to the observer); `TestSessionOutputCap` (4 MiB + 1 → `remote`); `TestPluginMissing` (Review Focus 5: `PATH` without it → `remote` refusal naming the plugin); `TestSessionStartArgs` (the StartSession request carries the config's `document`, the target iid and `{"command":[<RemoteCommand>]}`). `TestPluginArgs`: the fake plugin records argv and env; argv is `AWS_SSM_START_SESSION_RESPONSE <region> StartSession <config profile> <request json> <resolved ssm endpoint>`; the response JSON with `TokenValue` is only in the child's environment variable `AWS_SSM_START_SESSION_RESPONSE`; no argv element, log line or journal row contains the token; the endpoint equals the SDK's resolution for the region (an `aws-cn` region gives the `.amazonaws.com.cn` host); env holds no ambient keys. `TestPluginVersionFloor`: a fake plugin printing a version below the floor → `remote` refusal at `plan`. The floor is the version `awscli/customizations/sessionmanager.py` checks before using the environment handoff, copied with a comment naming the CLI commit.
- [ ] **Step 2: Run** `go test ./internal/grouprollaws -run 'TestSession|TestPlugin'` — FAIL.
-- [ ] **Step 3: Implement.** Call `ssm.StartSession`, then exec `session-manager-plugin '<response json>' <region> StartSession <c.Profile> '<request json>' <endpoint from the ssm client's resolver>` with the isolated environment, on a fresh pty (`Setsid`), stdin the pty slave left open and silent, read the master until frame or bound; at the bound `kill(-pgid, SIGKILL)` then reap.
+- [ ] **Step 3: Implement.** Call `ssm.StartSession`, then exec `session-manager-plugin AWS_SSM_START_SESSION_RESPONSE <region> StartSession <c.Profile> '<request json>' <endpoint from the ssm client's resolver>` with the isolated environment plus `AWS_SSM_START_SESSION_RESPONSE=<response json>`, on a fresh pty (`Setsid`), stdin the pty slave left open and silent, read the master until frame or bound; at the bound `kill(-pgid, SIGKILL)` then reap.
- [ ] **Step 4: Run** — PASS; also `GOOS=darwin GOARCH=arm64 go build ./... && GOOS=windows GOARCH=amd64 go build ./...`.
- [ ] **Step 5: Commit** `grouprollaws: run framed box verbs through Session Manager`.
@@ -102,19 +102,20 @@
**Files:**
- Create: `internal/grouproll/engine.go` (the `Operator` equivalent: `call`, `snapshot`, `identity`, `readiness`, `preflight`), `plan.go`, `status.go`
-- Create: `system_group.go`; Modify: `system_roles.go:122-130` (add the new leaves to `systemGroupCommand()`), `parity/parity.tsv` (rows for `system group plan` and `system group status`), regenerated `parity/cli.tsv` and `docs/parity.md` (`make parity-doc`)
+- Create: `system_group.go`; Modify: `system_roles.go:122-130` (add the new leaves to `systemGroupCommand()`), `parity/parity.tsv` (rows for `system group plan` and `system group status`), regenerated `parity/cli.tsv` and `docs/parity.md` (`make parity-doc`), `docs/site/cli.md` (the `system group plan` and `status` entries, AGENTS.md:423)
- Test: `internal/grouproll/fake_test.go` (the Go port of the script's `Fake`), `plan_test.go`, `system_group_test.go`
**Interfaces:**
- Consumes: Tasks 1-4.
- Produces: `type Engine struct{...}`; `func NewEngine(c Config, g Group, b Box, s *State, clock func() time.Time, sleep func(time.Duration), out io.Writer, attendedBy string) *Engine`; `func (e *Engine) Plan(ctx, iid, sha string) (ok bool, err error)`; `func SavedStatus(j *Journal) map[string]any`; `func runSystemGroup(verb string, args []string) int`; the fake `newFake(t, n int) *fake` that later tasks extend.
-- [ ] **Step 1: Failing tests.** Port every `test_plan*`, `test_status*`, `test_stale_and_racing_readiness`, `test_publication_lag_and_two_second_margin`, `test_readiness_clock_starts_at_first_response_*`, `test_live_*` parsing test. Add `TestSkewedClockRefuses` (Review Focus 1: box `started_at` 3 minutes ahead of the local clock → `admission`). `TestCLIRefusesRootBoxWindows`: euid 0 → `root` text adapted per Task 13; `/etc/carlos/host.env` present (injected path) → refused; positional args → usage error; missing `--config` → usage error; no console session is ever opened (the console client constructor is a nil func in the test and must not be called).
+- [ ] **Step 1: Failing tests.** Port every `test_plan*`, `test_status*`, `test_stale_and_racing_readiness`, `test_publication_lag_and_two_second_margin`, `test_readiness_clock_starts_at_first_response_*`, `test_live_*` parsing test. Add `TestPreflightRefusesForeignTransactionShape` (Review Focus 3: the fake group has `minimum = N-1` and another member parked, as another account's transaction leaves it; `roll`, `replace` and `remove` refuse `shape` with no write and the journal closes `preflight-refused`). `TestSkewedClockRefuses` (Review Focus 1: box `started_at` 3 minutes ahead of the local clock → `admission`). `TestCLIRefusesRootBoxWindows`: euid 0 → `root` text adapted per Task 13; `/etc/carlos/host.env` present (injected path) → refused; positional args → usage error; missing `--config` → usage error; no console session is ever opened (the console client constructor is a nil func in the test and must not be called).
- [ ] **Step 2: Run** `go test ./internal/grouproll ./ -run 'TestPlan|TestStatus|TestReadiness|TestSkewed|TestCLIRefuses|TestCLIProjection' && go test ./internal/parity` — FAIL.
- [ ] **Step 3: Implement** the script's `snapshot`, `identity`, `readiness`, `preflight`, `plan`, `saved_status` and `main`'s argument rules.
- [ ] **Step 4: Run** — PASS. Cross-compile check.
- [ ] **Step 5: Commit** `carlos system group: plan and status` (with the parity rows and regenerated files).
-- [ ] **Step 6: Merge A.** Whole-change review for Tasks 1-5 (one Astra pass: Task 3 touches termination), census card, CI green, merge under the standing rule for inert operator verbs. Then, read-only and only with Paul's dev go: `carlos system group plan --config <dev ie config> --member <iid> --to-sha256 <current sha>` from an operator machine; it must print the same refusals as the script's `plan` on the same group.
+- [ ] **Step 6: Copy review for this slice** (spec §3): the `TEXT` strings `plan` and `status` print, the new refusals (root, on a box, Windows, profile identity, plugin version) and the two `docs/site/cli.md` entries, through the copy-review skill before Merge A; apply the edits verbatim.
+- [ ] **Step 7: Merge A.** Whole-change review for Tasks 1-5 (one Astra pass: Task 3 touches termination), census card, CI green, merge under the standing rule for inert operator verbs. Then, read-only and only with Paul's dev go: `carlos system group plan --config <dev ie config> --member <iid> --to-sha256 <current sha>` from an operator machine; it must print the same refusals as the script's `plan` on the same group.
### Task 6: The deciders and golden fixtures
@@ -136,7 +137,7 @@
**Files:**
- Create: `internal/grouproll/roll.go` (roll, resume, rollback, return, abandon, close-lost, prepare, mutation, verify, alert, divergence), `sim_test.go`, `mutation_test.go`
-- Modify: `system_group.go`, `parity/parity.tsv` + `make parity-doc` (leaves `roll`, `resume`, `rollback`, `return`, `abandon`, `close-lost`)
+- Modify: `system_group.go`, `parity/parity.tsv` + `make parity-doc`, `docs/site/cli.md` (leaves `roll`, `resume`, `rollback`, `return`, `abandon`, `close-lost`)
- Test: `internal/grouproll/roll_test.go`
**Interfaces:**
@@ -169,7 +170,7 @@ Starts only after `held-floor-sha-map` merges (stopping rule 4).
**Files:**
- Create: `internal/grouproll/depart.go` (start, depart, drain, pre-action, lock sweep, edge stop, stop-and-terminate, watch, summary, cancel-drain, `check_remove`)
-- Modify: `system_group.go`, `parity/parity.tsv` + `make parity-doc` (leaves `replace`, `remove`, `cancel-drain`)
+- Modify: `system_group.go`, `parity/parity.tsv` + `make parity-doc`, `docs/site/cli.md` (leaves `replace`, `remove`, `cancel-drain`)
- Test: `internal/grouproll/depart_test.go`; extend `sim_test.go`, `mutation_test.go`
**Interfaces:**
@@ -185,7 +186,7 @@ Starts only after `held-floor-sha-map` merges (stopping rule 4).
### Task 10: The probe
**Files:**
-- Create: `internal/grouproll/probe.go`; Modify: `system_group.go`, `parity/parity.tsv` + `make parity-doc` (leaf `probe`); Test: `internal/grouproll/probe_test.go`
+- Create: `internal/grouproll/probe.go`; Modify: `system_group.go`, `parity/parity.tsv` + `make parity-doc`, `docs/site/cli.md` (leaf `probe`); Test: `internal/grouproll/probe_test.go`
**Interfaces:**
- Produces: `func (e *Engine) Probe(ctx, iid string) error`, `func (e *Engine) ProbeResume(ctx, tx string) error`; journal kind `probe`.
@@ -193,22 +194,9 @@ Starts only after `held-floor-sha-map` merges (stopping rule 4).
- [ ] **Step 1: Failing tests:** port all `region_group_probe_test.py` tests (status-only sessions, `read_only` refusal for any other verb, the member's own instance row overriding membership, `unchanged`).
- [ ] **Step 2: Run** `go test ./internal/grouproll -run TestProbe` — FAIL. **Step 3: Implement** as a wrapper over `Group` and `Box` that refuses writes outside the probe's set. **Step 4: Run** — PASS. **Step 5: Commit** `grouproll: the Standby observation probe`.
-### Task 11: The claim, its policy statement and the script's interlock
+### Task 11: (cut in rev 3)
-**Files:**
-- Create: `internal/grouproll/claim.go`; Modify: `internal/grouproll/state.go` (take before `Create`, ownership check at every writing verb's entry, release after `Finish`), `internal/grouproll/roll.go` (divergence written to the claim before the local file)
-- Modify: `infra/modules/region-host/group_operator.tf` (statement `GroupMaintenanceClaim`), `infra/modules/region-host/tests/group_operator.tftest.hcl`
-- Modify: `scripts/region-group-roll.py` (read the claim before `State.create`; refuse `busy` or `blocked`), `scripts/region_group_held_test.py` (its tests)
-- Test: `internal/grouproll/claim_test.go`, `claim_minio_test.go`
-
-**Interfaces:**
-- Produces: `func ClaimKey(groupARN string) string` (`control/group-maintenance/<hex(sha256(group_arn))[:32]>.json`); `type Claim struct{...}` (spec §8 body); `func ReadClaim(ctx, st release.Store, c Config) (Claim, etag string, present bool, err error)` (presence from `List` of the exact key, never from a failed `Get`); `func TakeClaim(ctx, st release.Store, c Config, tx, owner, attendedBy, machine string) (etag string, err error)`; `func CheckOwnership(ctx, st release.Store, c Config, tx, owner, machine string) (etag string, err error)`; `func MarkDivergence(ctx, st release.Store, c Config, etag string, d Divergence) (string, error)`; `func ReleaseClaim(ctx, st release.Store, c Config, etag, outcome string) error`.
-
-- [ ] **Step 1: Failing tests.** `TestClaimRace` (Review Focus 3: two goroutines take an absent key; exactly one wins; the loser refuses `busy` and has written no journal). `TestClaimLifecycle`: absent → open (create-only PUT) → closed → open again with `If-Match`. `TestClaimAbsenceIsAListing`: a store whose `Get` of the missing key returns AccessDenied and whose `List` lacks it → absent; a `List` error → `api`, never absent. `TestClaimOwnership`: `resume` with a copied journal and owner file on another machine id → refused; with the right machine but another owner token → refused; a claim rewritten under a running verb → its next claim write is `busy` and nothing further is sent to the provider. `TestClaimDivergenceGroupWide`: machine A records a return hook, then `close-lost`; the claim is `closed` with `divergence` set; machine B's `roll` and `plan` refuse `blocked`. `TestClaimLostRelease`: release PUT fails; the next verb on the same machine with the same owner closes it first. `TestClaimNotStarted`: journal creation fails after the take → claim closed with `not-started`. `TestClaimNeverDeletes` (the fake store fails on any Delete). The MinIO variant runs under `CARLOS_MINIO_TEST=1`. Python: `test_script_refuses_open_claim` and `test_script_refuses_diverged_claim` in `region_group_held_test.py`, with the fake's list and get. The tftest asserts the statement: `s3:GetObject` and `s3:PutObject` on exactly `arn:<partition>:s3:::<deployment bucket>/<ClaimKey>` (computed in tofu with `sha256()` and `substr()`), and `s3:ListBucket` on the bucket with `StringEquals s3:prefix` equal to that key; no wildcard.
-- [ ] **Step 2: Run** `go test ./internal/grouproll -run 'TestClaim'` and `python3 -m unittest scripts/region_group_held_test.py -k claim` — FAIL.
-- [ ] **Step 3: Implement** with `release.Store.Put(ctx, key, body, ifMatch)` (`""` = create-only) and `ErrCASConflict` → `busy`; presence with `List(prefix=key)`.
-- [ ] **Step 4: Run** — PASS; `tofu test` in `infra/modules/region-host` with OpenTofu 1.13.9 if available, else say so in the commit body.
-- [ ] **Step 5: Commit** `grouproll: a claim in the deployment bucket serializes machines`.
+The cross-machine claim is cut (spec §8). Serialization is Task 1's local lock and the card's one-account rule; Task 5's `TestPreflightRefusesForeignTransactionShape` pins the shape backstop. No infra change.
### Task 12: The parity ledger, the boundary and integration
@@ -216,26 +204,26 @@ Starts only after `held-floor-sha-map` merges (stopping rule 4).
- Create: `internal/grouproll/testdata/parity-ledger.tsv`, `internal/grouproll/testdata/python-tests.txt` (the `def test_` names of the three Python files, generated once and committed; frozen at the port's merge), `internal/grouproll/parity_test.go`, `internal/grouproll/integration_minio_test.go`
- Modify: `region_ha_boundary_test.go` (core files listed), `internal/provision/region_group_guards_test.go` (run `region_group_document_test.py` also against the Go builder through a small `go run` shim)
-- [ ] **Step 1: Failing tests.** `TestParityLedgerComplete`: every name in `python-tests.txt` has a ledger row (while the Python files exist, a second check fails if they hold a name the list lacks); every Go test a row names exists in the package (`go test -list`). `TestCoreHasNoAWS` is the existing boundary test with the new files. `TestEndToEndNoAWSEnvironment`: with every `AWS_*` unset, `plan`, `roll`, `replace` and `remove` run to completion against the fake `Group` and `Box` and MinIO (edges files, locks, pointers, claim).
+- [ ] **Step 1: Failing tests.** `TestParityLedgerComplete`: every name in `python-tests.txt` has a ledger row (while the Python files exist, a second check fails if they hold a name the list lacks); every Go test a row names exists in the package (`go test -list`). `TestCoreHasNoAWS` is the existing boundary test with the new files. `TestEndToEndNoAWSEnvironment`: with every `AWS_*` unset, `plan`, `roll`, `replace` and `remove` run to completion against the fake `Group` and `Box` and MinIO (edges files, locks, pointers).
- [ ] **Step 2: Run** `go test ./internal/grouproll -run 'TestParity|TestEndToEnd' && go test . -run TestRegionHACoreImportsNoAWS` — FAIL until the ledger is filled.
- [ ] **Step 3: Fill the ledger**; each "does not apply" row carries a reason tied to a V-row of spec §7.
- [ ] **Step 4: Run** — PASS. **Commit** `grouproll: parity ledger, boundary and MinIO end to end`.
-### Task 13: Copy review and the runbook
+### Task 13: Copy review of the remaining strings and the runbook
-- [ ] **Step 1:** Extract every string in `internal/grouproll/text.go` plus the CLI usage text; run the copy-review skill; apply Paul's edits verbatim. Add the strings V1, V6 and §8 need (root refused, on a box, Windows, claim holder, claim forced) through the same review.
+- [ ] **Step 1:** Before Merge B: every `TEXT` string and `docs/site/cli.md` entry not reviewed in Task 5 Step 6, through the copy-review skill; apply Paul's edits verbatim. (Each later slice's strings are written into `text.go` only from this review's approved file; Tasks 7, 9 and 10 use the script's strings as placeholders marked in one list that this step empties.)
- [ ] **Step 2:** The runbook page for `carlos system group` (from the §25 runbook branch if merged, else a new `docs/site` page), through the same review.
- [ ] **Step 3:** `go test ./internal/grouproll ./ -run 'Text|Usage'` — PASS (golden usage output updated). **Commit** `grouproll: reviewed operator copy and runbook`.
### Task 14: Branch review, census and merge B
- [ ] **Step 1:** Full local suite once: `go test ./...` (scratch under `$TMPDIR`), both cross-compiles.
-- [ ] **Step 2:** Whole-branch review, Astra (`codex exec -m gpt-6-astra -c model_reasoning_effort="high" … < /dev/null`), brief from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, max three rounds; Fable as the second reader on Tasks 7, 9 and 11 (termination and the claim).
+- [ ] **Step 2:** Whole-branch review, Astra (`codex exec -m gpt-6-astra -c model_reasoning_effort="high" … < /dev/null`), brief from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, max three rounds; Fable as the second reader on Tasks 7 and 9 (termination).
- [ ] **Step 3:** `make census-card`, `make census-propose NAME=group-roll-verb CLAIMS=…`, the other-family reviewer's verdict on #280.
- [ ] **Step 4:** Re-merge main, CI green on the tip, `amadan branch merge carlos/platform <branch> -expect <full sha> -squash -message "$(cat msgfile)"`. The verb is inert; release, the claim statement's apply and the witnesses are Paul's steps.
### After merge (not tasks of this plan; each needs Paul's go)
-1. A release; apply the operator policy (claim statement) on dev, then flagship.
+1. A release. No infra apply.
2. Dev parity witnesses (spec §11 step 4): W1, W2, W4 (with the refused remove), one probe, one `cancel-drain` after a forced drain failure, from an operator machine other than the operator host. Compare journals and summaries with the script's runs.
3. Retirement branch, first commit: move the text, `remote_command` framing and session transport that `scripts/region_group_frames.py` (`:9-12`) and `scripts/region-group-fault/client.py` (`:14-15`, `:33-44`) import from the script into `region_group_frames.py`; run `region_group_fault_test.py` with the script moved aside. Then: delete `scripts/region-group-roll.py`, `scripts/region-group-probe.py`, `region_group_roll_test.py`, `region_group_held_test.py`, `region_group_probe_test.py`; point the document test at the Go builder only; update `TestRegionGroupHeldPythonGuards` and every CI entry naming the deleted files; update the runbook.
diff --git a/docs/superpowers/reviews/ASTRA-R2-group-roll-verb.md b/docs/superpowers/reviews/ASTRA-R2-group-roll-verb.md
new file mode 100644
index 000000000..9b9fdd6ba
--- /dev/null
+++ b/docs/superpowers/reviews/ASTRA-R2-group-roll-verb.md
@@ -0,0 +1,122 @@
+codex
+- **R1-1 — Partly resolved; P1 remains:** automatic force-release is removed, but manual recovery still relies on an insufficient at-rest check.
+- **R1-2 — Partly resolved; P1 remains:** shared divergence is preserved after successful writes, but not after a failed divergence PUT followed by closure.
+- **R1-3 — Resolved:** create-only acquisition and exact-key listing address missing-object authorization failures.
+- **R1-4 — Partly resolved; remaining P2:** environment isolation addresses endpoints; profile validation must use the same files and source-profile chain as credential loading.
+- **R1-5 — Partly resolved; P1 remains:** profile and endpoint arguments are corrected, but the same profile does not guarantee the same assumed-role session identity.
+- **R1-6 — Partly resolved; remaining P2:** parity artifacts are included; CLI documentation and copy review still come too late.
+- **R1-7 — Resolved:** retirement now migrates retained imports and freezes the Python test inventory.
+- **R1-8 — Partly resolved:** membership reads are added; the revised `Box` interface and adapter method now have incompatible signatures, a concrete P1.
+- **R1-9 — Resolved:** separate directories, filenames and explicit Go format validation provide the stated isolation.
+- **R1-10 — Resolved:** the previously omitted recovery rules are stated. Finding 3 below concerns their interaction with the new claim.
+- **R1-11 — Resolved:** the repeated `-run` flags are replaced by combined expressions.
+
+Reviewed commit `ab886832199c407fa8f30533e65b32e888fffc23`.
+
+1. **P1 — Spec §8 / Task 11: recovery still does not fence the previous executor.**
+
+ **Evidence:** [spec:370](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:370) checks ownership at verb entry and detects changes only at the next claim write. Lines 376–379 permit a controller hand edit after proving the member set at rest. [Task 11:207](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:207) tests that same delayed detection.
+
+ **Failure:** A pauses after acquiring the claim, before its first group write. The group is at rest. The controller closes the claim, B acquires it, and A resumes. A can perform provider writes before its next claim write detects the change. Moving release outside the CLI does not remove this race. Separately, copying the journal and owner file to another `--state-dir` on the **same machine** preserves every ownership field while creating an independent local lock.
+
+ **Fix:** refuse recovery unless the previous executor and dispatched operations are proven unable to continue; at-rest group shape alone must not authorize release. Establish one execution lock independent of selectable state directories, or explicitly refuse copied-state recovery.
+
+ **Fault family:** exclusive transaction ownership across machines — **second round, R1-1**.
+
+2. **P1 — Spec §8 / Task 11: a failed divergence PUT can still lose the group-wide block.**
+
+ **Evidence:** [spec:380](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:380) requires the shared PUT before the local flag. Task 11 follows that ordering. The existing [return path:1753](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/scripts/region-group-roll.py:1753) records `return-hook` after writing the flag; [close-lost:1410](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/scripts/region-group-roll.py:1410) closes directly without running the decider’s historical-hook check.
+
+ **Failure:** the tool observes `Pending:Wait`, but the divergence PUT fails without committing. Neither flag is set. After AWS terminates the member, `close-lost` succeeds and closes the claim carrying `divergence:null`. Another machine can then start a roll. Historical group responses survive in the journal, but the specified closure path does not reconcile them.
+
+ **Fix:** make every closure reconcile durable divergence evidence before releasing ownership. An unsuccessful divergence publication must prevent closure until publication succeeds. Test failed PUT, process restart, member loss, `close-lost`, and acquisition from another machine.
+
+ **Fault family:** durable, group-wide divergence interlock — **second round, R1-2**.
+
+3. **P1 — Spec §§6, 8 / Tasks 9 and 11: `cancel-drain` is refused precisely when recovery requires it.**
+
+ **Evidence:** [spec:291](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:291) preserves the finished `drain-failed` transaction and cancellation instruction. Section 8 releases its claim on finish, yet [spec:370](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:370) requires an **open** claim for `cancel-drain`. The script explicitly accepts a closed failed-drain journal at [script:2298](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/scripts/region-group-roll.py:2298), covered by [test:921](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/scripts/region_group_held_test.py:921).
+
+ **Failure:** a failed drain returns the member, finishes the transaction and closes the claim. The instructed `cancel-drain` then fails ownership validation, leaving the member fenced and draining.
+
+ **Fix:** define claim acquisition for cancellation of a finished transaction, with exclusive ownership during cleanup and refusal while another transaction owns the group. Cover both finished and stopped-but-open failed drains, including races with a new transaction.
+
+ **Fault family:** recovery-contract completeness — **second finding in the R1-10 family**.
+
+4. **P1 — Spec §5.3 / Task 4: matching profile names do not ensure `OwnSessions` authorization.**
+
+ **Evidence:** [spec:202](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:202) equates the selected profile with the same caller. [The policy:97](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/infra/modules/region-host/group_operator.tf:97) requires exact `aws:userid` equality, including the role-session name. The installed SDK generates a timestamp-based default session name at [assume_role_provider.go:274](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2/credentials@v1.19.6/stscreds/assume_role_provider.go:274). The plugin independently reloads credentials for reconnect and termination. [https://raw.githubusercontent.com/aws/session-manager-plugin/mainline/src/sessionmanagerplugin/session/sessionhandler.go](https://raw.githubusercontent.com/aws/session-manager-plugin/mainline/src/sessionmanagerplugin/session/sessionhandler.go)
+
+ **Failure:** an ordinary assume-role profile without `role_session_name` produces identity A for SDK `StartSession` and identity B when the plugin resolves that profile. Plugin reconnect and cleanup fail the exact identity condition. The proposed argv test cannot detect this.
+
+ **Fix:** establish identity continuity explicitly. The narrow cut is to refuse profile configurations whose caller identity cannot remain stable across these resolutions. Otherwise design a credential handoff that preserves the caller. Test independent resolutions and the actual `OwnSessions` condition.
+
+ **Fault family:** session identity continuity — **second round, R1-5**.
+
+5. **P1 — Task 4: the plugin command exposes the session credential in argv.**
+
+ **Evidence:** [plan:95](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:95) explicitly passes the response JSON as an argument. That response contains `TokenValue`, the connection credential. Modern AWS CLI instead passes the response through a child environment variable when supported. [https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_StartSession.html](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_StartSession.html), [https://raw.githubusercontent.com/aws/aws-cli/develop/awscli/customizations/sessionmanager.py](https://raw.githubusercontent.com/aws/aws-cli/develop/awscli/customizations/sessionmanager.py)
+
+ **Failure:** another local user able to inspect process arguments can copy the privileged maintenance session’s connection credential during startup. Private state-directory permissions do not protect argv.
+
+ **Fix:** require a plugin supporting the environment-variable response handoff, pass only that variable’s name in argv, and test that tokens never appear in arguments or diagnostic output.
+
+ **Fault family:** confidentiality of privileged session credentials — **new**.
+
+6. **P1 — Tasks 2 and 4: the adapter cannot implement the declared `Box` interface.**
+
+ **Evidence:** [Task 2:59](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:59) declares `Run(..., onSession func(id string))`. [Task 4:93](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:93) declares the implementing method without that parameter.
+
+ **Failure:** implementing the stated signatures makes `*Adapter` fail interface assignment when Task 5 wires the engine. The observer required for session journaling has no argument at the adapter entry point.
+
+ **Fix:** make the signatures identical and add a compile-time interface assertion. Specify how a session-journal write failure propagates through the observer.
+
+ **Fault family:** lossless provider abstraction — **second round, R1-8**. This is now a concrete method-set mismatch, rather than merely an incomplete interface description.
+
+7. **P2 — Task 3: profile validation can inspect different credentials configuration from the SDK.**
+
+ **Evidence:** [plan:81](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:81) prescribes `LoadSharedConfigProfile` before `LoadDefaultConfig`. Without explicit file options, the former uses default file lists at [shared_config.go:655](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2/config@v1.32.6/shared_config.go:655). Credential resolution also follows `SharedConfig.Source` recursively at [resolve_credentials.go:140](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2/config@v1.32.6/resolve_credentials.go:140).
+
+ **Failure:** a valid profile present only in the explicitly allowed `AWS_CONFIG_FILE` can fail validation, or validation examines a different profile definition. Checking only the selected profile also misses prohibited sources in its source-profile chain.
+
+ **Fix:** resolve file paths once, pass them consistently to both loaders, and validate the complete source chain. Add alternate-file and chained-profile tests.
+
+ **Fault family:** operator credential and endpoint isolation — **second round, R1-4**.
+
+8. **P2 — Tasks 5 and 13: Merge A still precedes required documentation and copy review.**
+
+ **Evidence:** [plan:117](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:117) merges runnable commands before Task 13. No task explicitly updates `docs/site/cli.md`, required by [AGENTS.md:423](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/AGENTS.md:423). The [copy-review skill](/home/paulca/.agents/skills/copy-review/SKILL.md) requires review before copy is written into implementation files.
+
+ **Failure:** the first visible slice lands without its required CLI reference additions and with unreviewed strings. A later runbook page does not fulfill the CLI-page requirement.
+
+ **Fix:** move the applicable copy review and CLI-reference updates into each slice before it lands. The parity-generation fix can remain as written.
+
+ **Fault family:** command-tree and published-contract consistency — **second round, R1-6**. This is P2; the remaining omission is not the previously demonstrated projection-test failure.
+
+9. **P2 — Spec §4/V4 / Tasks 1 and 3: isolation discards the advertised state-directory setting.**
+
+ **Evidence:** [spec:137](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:137) rebuilds the environment without `XDG_STATE_HOME`; [V4:329](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md:329) requires using it. Task 3 places isolation at CLI entry.
+
+ **Failure:** a configured XDG state location is silently replaced by the HOME fallback, so the tool looks in the wrong directory for transactions and observation records.
+
+ **Fix:** preserve `XDG_STATE_HOME`, or resolve and retain the state path before clearing the environment. Test the CLI initialization order.
+
+ **Fault family:** stable local recovery-state location — **new**.
+
+10. **P2 — Plan global bounds: the 65,536-byte “record cap” needs its correct scope.**
+
+ **Evidence:** [plan:16](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/docs/superpowers/plans/2026-11-09-group-roll-verb.md:16) presents that cap as verbatim parity. It applies to small state-file reads at [script:656](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/scripts/region-group-roll.py:656), not journal rows. [Journal.add:597](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-group-roll-verb/scripts/region-group-roll.py:597) has no such row cap; drain bodies may reach 1 MiB.
+
+ **Failure:** applying the stated cap to journal records rejects otherwise valid drain evidence. An in-memory reproduction accepted a 73,958-byte drain body and wrote its 74,168-byte journal response row.
+
+ **Fix:** explicitly restrict 65,536 bytes to the small state files and add a journal round-trip fixture exceeding that size.
+
+ **Fault family:** journal payload preservation — **new**.
+
+Stopping rule 2 applies to the repeated families above. The choices are an upfront refusal, a feature cut, or one enforcement point with guard tests. I recommend refusing recovery without proof the old executor cannot continue, and enforcing divergence publication and cleanup ownership through one claim-transition gate.
+
+Seven targeted terminate-decision and remote-command tests passed. The large-record reproduction intercepted all writes in memory. No full suites or live AWS calls ran; no files were changed.
+
+**Spec verdict: NOT READY — P1 findings 1–4.**
+
+**Plan verdict: NOT READY — P1 findings 1–6.**
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-group-roll-verb-R3.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-group-roll-verb-R3.md
new file mode 100644
index 000000000..ce64b2c06
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-group-roll-verb-R3.md
@@ -0,0 +1,83 @@
+# Review brief: `carlos system group` roll tool port, spec + plan, round 3 of 3
+
+Repo carlos/platform, branch `design-group-roll-verb`, commit named in the reviewer's prompt.
+Under review: `docs/superpowers/specs/2026-11-09-group-roll-verb-design.md` (spec) and
+`docs/superpowers/plans/2026-11-09-group-roll-verb.md` (plan). Give separate verdicts for each;
+they have separate round budgets.
+Authorities: `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (§7.5, §9.9,
+§12, §25 incl. §25.15) and the code on main: `scripts/region-group-roll.py`,
+`scripts/region-group-probe.py`, their tests, `internal/host/group_maintenance*.go`,
+`internal/host/hadrain.go`, `infra/modules/region-host/group_operator.tf`,
+`infra/modules/region-group-operator-document/`, `internal/release/systempointer.go`,
+`internal/rootaws/`, `region_ha_boundary_test.go`, `system_roles.go`, `system.go`.
+
+You are an independent reviewer. Read the documents, then the code they name, and check every
+claim against that code.
+
+## Fixed: do not re-argue
+
+- Paul (2026-11-09, via agent manager 8a3d302): port the script into the carlos binary;
+ provider-neutral core with an AWS adapter; exact behaviour parity; no root unless proven
+ necessary; no extra packages; parity proven by fixtures, the simulation and the fault tests;
+ rollout ends with the script retired; the census covers the port.
+- §25 rulings are binding (§25.15 r4; the r2 uncertain-drain cut: after a failed drain, exit
+ Standby only on proof no move runs). Report only mechanisms that fail to honour them.
+- The unmerged branch `held-floor-sha-map` (SHA-pinned floor) is a declared dependency: the spec
+ §9 says the floor task waits for its merge and follows it (stopping rule 4). Do not raise
+ "depends on unmerged work" as a P1; do check that §9 as written is safe on its own.
+
+## What to check
+
+1. Parity: does anything in spec §6 misstate what the script does? Is any script behaviour
+ missing from §6 that is not a declared deviation in §7? Pay attention to H4, H5, the
+ failed-drain return, divergence/hold, terminate recovery, abandon/close-lost conditions.
+2. The deviations V1-V7: is each one safe? In particular V1 (no root, per-user state), V3/V4
+ (journal format 2 and the overlap rule with the script), V6.
+3. The claim (§8): can two machines both run a transaction on one group? Can a claim be lost
+ or forced while a transaction is in flight? Is the at-rest force check sufficient?
+4. The provider boundary (§5): is the Phase mapping lossless for every distinction
+ classify()/terminate_decision() make? Does anything in the "core" column actually need AWS?
+5. The Session Manager transport (§5.3): is calling StartSession via the SDK and then running
+ session-manager-plugin equivalent to the CLI path the cards verified (interruption, session
+ id capture, TerminateSession permissions under the OwnSessions statement)?
+6. Credentials (§4): does the described loading actually ignore ambient keys and endpoints with
+ aws-sdk-go-v2, and is the "never as root / never on a box" refusal sound?
+7. The floor (§9): any way to guess a version, or fall back to DR-4 on an unreadable floor?
+8. Parity proof (§10): are the golden fixtures, simulation port, byte-identical commands and the
+ ledger enough to catch a divergent port? What would slip through?
+9. The plan: do tasks cover the spec? Wrong file paths, signatures that do not fit the code,
+ tests that cannot be written as described, ordering problems (stopping rules 4 and 6).
+
+## Round 3 (final)
+
+Earlier rounds: round 1 `docs/superpowers/reviews/ASTRA-R1-group-roll-verb.md`, round 2
+`docs/superpowers/reviews/ASTRA-R2-group-roll-verb.md`. Under stopping rule 2 the author did
+not fix repeated families a third time: the cross-machine claim is CUT (spec §8, rev 3 note),
+and unstable session identity is REFUSED up front (spec §4, V9). Treat the cut as fixed scope:
+report only if the cut itself leaves the port less safe than the script it replaces.
+
+First give one line per P1 and P2 from round 2: resolved, partly, or not. Then new findings with
+their fault family. This is the last round: a NOT READY also says whether the P1s share one
+cause, and whether refusing the case up front or cutting the feature would remove them.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the
+review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the section or task, the problem, the evidence (file:line,
+verified), the failure scenario, a concrete fix and the invariant or trust boundary it breaks (its
+fault family). End with exactly one verdict for the spec and one for the plan:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the
+full test suites.
diff --git a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
index 0cb3bca66..5960ffd07 100644
--- a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
+++ b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
@@ -1,4 +1,4 @@
-# `carlos system group`: the roll tool as a carlos verb (design, rev 2, 2026-11-09)
+# `carlos system group`: the roll tool as a carlos verb (design, rev 3, 2026-11-09)
**Asked by:** Paul, 2026-11-09, via agent manager 8a3d302: a spec for porting
`scripts/region-group-roll.py` into the `carlos` binary.
@@ -9,6 +9,16 @@ found twice is cut or turned into an invariant, not fixed a third time.
Line citations are to `origin/main` at `eed714da` unless they name a branch.
+**Rev 3 (Astra round 2, `~/.cache/group-roll-go/ASTRA-R2.md`, 4 spec P1).** Three
+families came back a second time, so under stopping rule 2 nothing was fixed a
+third time. The claim, source of the ownership and divergence families and of
+the `cancel-drain` gap, is **cut**: the verb keeps the script's model, one
+operator machine and account per deployment with local state, a local lock and a
+local divergence flag (§8). Session identity is an **up-front refusal**: profiles
+whose caller can differ between two resolutions are refused (§4). New in this
+round and fixed once: the session token goes to the plugin through its
+environment, never argv (§5.3).
+
**Rev 2 (Astra round 1, `~/.cache/group-roll-go/ASTRA-R1.md`, 4 spec P1).** The
claim drew three P1s from one cause, a shared object with too many jobs and an
escape hatch. It is now narrower: no forced release, ownership bound to a token
@@ -45,11 +55,11 @@ document tests; the roll, probe and fault suites run in no CI job.
| # | Decision | Section |
|---|---|---|
| D1 | Verb shape: `carlos system group <verb>`, one leaf per Python subcommand, plus `probe`. | §3 |
-| D2 | Where it runs: any operator machine (Linux or macOS), never as root, never on a carlos box, never through the console. | §4 |
+| D2 | Where it runs: one operator machine and account per deployment (Linux or macOS), never as root, never on a carlos box, never through the console. | §4 |
| D3 | What it needs: an AWS profile with the existing operator policy (plus two statements), and the Session Manager plugin. No root, no python, no AWS CLI, no cryptography package. | §4 |
| D4 | A provider-neutral engine (`internal/grouproll`) with an AWS adapter (`internal/grouprollaws`). | §5 |
| D5 | Exact behaviour parity, with the deliberate deviations listed in one table. | §6, §7 |
-| D6 | Cross-host serialization: a claim object in the deployment bucket replaces "everyone uses the one root host". | §8 |
+| D6 | Serialization stays the script's: one machine and account per deployment, a local lock; no shared claim (cut in rev 3). | §8 |
| D7 | The floor reads signed release records through `internal/release`; no SHA or version is guessed. | §9 |
| D8 | Parity proof: golden decider fixtures, a Go port of the seeded simulation and mutations, byte-identical remote commands, and a test-by-test parity ledger. | §10 |
| D9 | Rollout: W1-W5 run with the Python tool as planned; the Go verb then repeats W1, W2 and W4 on dev; then the script is deleted. | §11 |
@@ -89,8 +99,7 @@ flags-after-positionals trap of `cli-default-console-flagship` cannot arise.
- **The config file is the script's config file.** The same JSON keys, the same
validation (`validate_config`, `:506-545`, plus the `held-floor-sha-map`
keys `release_public_key`, `release_channels`, `release_platform`), so one file
- serves both tools during the overlap (§11). No key is added: the claim key
- is derived from the group ARN (§8).
+ serves both tools during the overlap (§11). No key is added.
- **Exit codes and output** follow the script: 0 on success, 1 on a refusal with
`Refused: <reason>` on stderr, phase lines `phase: detail` on stdout, the JSON
drain summary line, and `status` printing the saved transaction as one JSON
@@ -101,12 +110,13 @@ flags-after-positionals trap of `cli-default-console-flagship` cannot arise.
## 4. Where it runs and what it needs (D2, D3)
-**Any operator machine, never root.** The verb refuses `euid == 0` up front.
+**One operator machine and account per deployment, never root.** The verb refuses `euid == 0` up front.
Reasons:
- root is not needed: the script needed root only because its shared state
directory had to be tamper-proof against the other operators on one host
- (`State.__init__`, `:615-640`). A per-user state directory under the
- operator's own account (§8) plus the claim gives the same guarantee without it;
+ (`State.__init__`, `:615-640`). A dedicated, unprivileged operator account
+ whose 0700 state directory nobody else can write gives the same guarantee
+ without root (§8);
- `internal/rootaws` refuses shared profiles to root (`config.go:52-53`), and
this verb is profile-driven, so root would need a second credential path;
- it keeps the census disposition simple: root on a box never runs this code.
@@ -130,20 +140,31 @@ with a `_other.go` sibling, per the cross-compile gate.
**What it needs on the machine:**
1. **An AWS profile** named in the config's `profile` key, carrying the operator
policy output `group_operator_policy_json` (`infra/modules/region-host/group_operator.tf`)
- plus the claim statement in §8 and `held-floor-sha-map`'s `ReadReleasePointers`
- (§9). SDK options alone do not isolate it: `LoadDefaultConfig` still reads
+ plus `held-floor-sha-map`'s `ReadReleasePointers` (§9). SDK options alone do not isolate it: `LoadDefaultConfig` still reads
`AWS_ENDPOINT_URL*` and a profile's `endpoint_url`, and a profile with
`credential_source = Environment` reads ambient keys. So the verb isolates the
process instead. At entry, before any goroutine starts, it rebuilds its
environment from an allow-list: `HOME`, `PATH`, `TMPDIR`, `TERM`, `LANG`, `LC_*`,
- `USER`, `AWS_CONFIG_FILE`, `AWS_SHARED_CREDENTIALS_FILE`, `AWS_CA_BUNDLE`; it then
+ `USER`, `AWS_CONFIG_FILE`, `AWS_SHARED_CREDENTIALS_FILE`, `AWS_CA_BUNDLE`. (The
+ state directory and the two file paths are resolved before the rebuild and passed
+ explicitly to every loader, so validation and loading read the same files.) It then
sets `AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true` (honoured by the SDK,
`config/env_config.go:75`, and by the plugin's SDK), `AWS_EC2_METADATA_DISABLED=true`
and `AWS_PROFILE` to the config's profile. Everything else, including ambient
keys, `AWS_DEFAULT_PROFILE`, container and web-identity variables and endpoint
- overrides, is gone for the SDK and for the plugin it starts. A profile whose
- `credential_source` is `Environment`, `Ec2InstanceMetadata` or `EcsContainer` is
- refused up front. SSO and `credential_process` profiles work, since the verb
+ overrides, is gone for the SDK and for the plugin it starts.
+
+ **Stable caller identity, refused up front otherwise.** The policy's `OwnSessions`
+ statement matches `aws:userid` exactly, and the plugin resolves the profile again
+ for reconnect and `TerminateSession`, so the verb accepts only profiles whose caller
+ is the same on every resolution. It walks the whole `source_profile` chain and
+ accepts exactly: static keys; an SSO profile; an assume-role link that names
+ `role_session_name`, over a source that is itself accepted. It refuses
+ `credential_source` (any value), `credential_process`, web identity, and an
+ assume-role link without `role_session_name` (the SDK would name the session by
+ timestamp, so two resolutions give two callers). At start it calls
+ `sts:GetCallerIdentity` and journals the `UserId`. The script has the same exposure
+ through the CLI; this is a refusal the script lacks, recorded as V9. SSO and `credential_process` profiles work, since the verb
never runs as root. This matches what the script does to the CLI (`invoke`,
`:786-797`) and closes the profile-file endpoint the script left open.
2. **The Session Manager plugin** (`session-manager-plugin`) on `PATH`. This is the
@@ -159,7 +180,7 @@ with a `_other.go` sibling, per the cross-compile gate.
| Core (`internal/grouproll`, imports no AWS SDK) | AWS adapter (`internal/grouprollaws`) |
|---|---|
| The journal, the local lock, the transaction lifecycle (create, load, finish) | Describe the group: members and their lifecycle states, health, minimum, desired, maximum, launch template, target groups, tags |
-| The claim (§8), over `release.Store` (S3 or any S3-compatible store with conditional writes) | Target health in each target group |
+| | Target health in each target group |
| `Classify` (the script's `classify()`) and `TerminateDecision` (`terminate_decision()`) | Lower or raise minimum; raise desired (H4: never lower) |
| Preflight shape rules, readiness, identity, permit and process checks over box status | Park a member: `EnterStandby` with decrement; unpark: `ExitStandby` |
| The floor: edges files, `ha_take`, the pinned and the prepared release (§9) | Terminate a parked member without decrement |
@@ -172,8 +193,7 @@ The engine talks to two interfaces, `Group` (the right column's provider calls,
in provider-neutral terms; membership of one member, as the probe reads it, is a
separate call from whether an instance still exists) and `Box` (run one box verb
on one member and return its framed output, reporting each session id to the
-engine as it opens so it is journaled, and cancel a session by id after a cut). Object-store reads (edges files, locks, release pointers, the
-claim) are core and go through `release.Store`, so MinIO works as it does
+engine as it opens so it is journaled, and cancel a session by id after a cut). Object-store reads (edges files, locks, release pointers) are core and go through `release.Store`, so MinIO works as it does
everywhere else.
### 5.2 Provider-neutral member phases
@@ -202,10 +222,14 @@ The journal records the raw provider state beside the phase, for operators.
The adapter calls `ssm:StartSession` itself through the SDK with the approved
document and the framed command, then runs `session-manager-plugin` with the
returned session, the request, the region, the config's profile and the SSM
-endpoint the SDK resolved for that region and partition: the same arguments the
-AWS CLI passes (`awscli/customizations/sessionmanager.py`), so the plugin's own
-calls (reconnect, `TerminateSession`) run as the same caller, which the policy's
-`OwnSessions` condition on `aws:userid` requires. It runs on a pseudo-terminal,
+endpoint the SDK resolved for that region and partition, as the AWS CLI does
+(`awscli/customizations/sessionmanager.py`). The StartSession response holds the
+session's `TokenValue`, so it never goes in argv: the verb passes it in the plugin's
+environment variable `AWS_SSM_START_SESSION_RESPONSE` and puts only that name in
+argv, as current CLIs do, and refuses a plugin whose `--version` is below the version
+that CLI checks for that handoff (the plan pins the number from that file). The token
+is never logged or journaled. With §4's stable identity, the plugin's own calls
+(reconnect, `TerminateSession`) run as the journaled caller. It runs on a pseudo-terminal,
reading output until the frame or the bound. It keeps the script's behaviour
(`session_output`, `:733-784`): a 4 MiB output cap, session-id capture for
`TerminateSession` after a cut, the plugin's process group killed at the bound,
@@ -244,8 +268,7 @@ The Go verb does what the script does, decision for decision. In particular:
- **One serialized transaction per group.** The group directory is keyed by
`sha256(group_arn)[:32]` (`:627`); one `active-v2.json` names the open transaction;
a non-blocking exclusive lock guards every writing verb (`State.lock`, `:642-654`);
- `status` stays lock-free and read-only. The claim (§8) adds cross-host
- serialization on top; it replaces nothing.
+ `status` stays lock-free and read-only.
- **The journal.** Append-only, one fsynced JSON object per line, hash-chained
(`seq`, `previous`, `hash`), refusing on any gap, duplicate key, non-finite
number or bad hash (`Journal`, `:566-611`). Every provider call writes an
@@ -324,13 +347,14 @@ build to it.
| # | Script | Go verb | Why |
|---|---|---|---|
| V1 | euid 0 required; root-owned state with root-owned ancestors | euid 0 refused; state owned by the invoking user, 0700, ancestors not group- or world-writable and owned by root or that user | §4 |
-| V2 | Serialization only among users of one host's state directory | The same local lock plus a claim object in the deployment bucket | §8 |
+| V2 | All operators share root's state directory on the one operator host | One dedicated unprivileged operator account on one machine per deployment, named on the card | §8 |
| V3 | Journal rows hashed over Python's `json.dumps(sort_keys=True, separators=(",", ":"))`; times are Python floats | Journal format 2: a `"format": 2` header field, times as integer milliseconds, keys sorted, Go's canonical encoding defined in one function and pinned by golden bytes | Byte-identical float and escape formatting across languages is a trap; neither tool reads the other's journals |
-| V4 | State in the config's `state_dir` (root-owned): `<tx>.jsonl`, `active.json` | State in the invoking user's `$XDG_STATE_HOME/carlos/group` (default `~/.local/state/carlos/group`, or `--state-dir`); the config's `state_dir` is ignored. Files are `<tx>.v2.jsonl` and `active-v2.json`, and the reader refuses a journal whose header lacks `"format": 2` | The two tools can never share a directory (root versus user ownership) or a file name, so neither can misread the other; the claim and the script patch (§8) interlock them across tools |
+| V4 | State in the config's `state_dir` (root-owned): `<tx>.jsonl`, `active.json` | State in the invoking user's `$XDG_STATE_HOME/carlos/group` (default `~/.local/state/carlos/group`), with no override flag, so one account has exactly one state directory; the config's `state_dir` is ignored. Files are `<tx>.v2.jsonl` and `active-v2.json`, and the reader refuses a journal whose header lacks `"format": 2` | The two tools can never share a directory (root versus user ownership) or a file name, so neither can misread the other; the card names one tool per group during the overlap (§11) |
| V5 | SHA mapping verified with `python3-cryptography` (`held-floor-sha-map`) | `release.GetSystemPointer` (`internal/release/systempointer.go:259`), the code boxes use | §9 |
| V6 | Refuses nothing about where it runs, beyond root | Refuses on a carlos box and on Windows | §4 |
| V7 | `region-group-probe.py` is a separate script | `carlos system group probe` | Same engine; probe rules unchanged (read-only status sessions, the member's own `DescribeAutoScalingInstances` row overrides group membership) |
-| V8 | `provider-divergence.json` blocks only the host it is on | The block is also in the claim, so every machine sees it (§8) | Group-wide interlock across machines |
+| V8 | The session response goes to the plugin in argv (CLI versions without the environment handoff) | Always the environment handoff, and an older plugin is refused | The token is a session credential (§5.3) |
+| V9 | Any profile the CLI accepts | Only profiles with a stable caller identity (§4) | `OwnSessions` needs the same `aws:userid` for the plugin's calls |
Not deviations, recorded so nobody "fixes" them in the port: the drain-rerun
backoff and the TakeHost `wake_timeout` follow-ups from the held build stay
@@ -339,69 +363,30 @@ follow-ups; `check-region-group-plan.py` (the tofu plan gate), the fault harness
observation file `provider-observation.json` is still placed by the controller,
not written by `probe`.
-## 8. The claim: one transaction per group across machines (D6)
-
-The script serializes operators only if they all use one state directory on one
-host. A verb that runs on any operator machine needs a shared fact. The core
-already assumes an object store with conditional writes, so the claim is one
-object per group. It carries two things the script keeps in local files: which
-transaction is open, and whether provider divergence blocks the group.
-
-- **Key:** `control/group-maintenance/<hex(sha256(group_arn))[:32]>.json` in the
- deployment bucket (the config's `bucket`). No box reads or writes it.
-- **Body:** `{v:1, group_arn, state: "open"|"closed", transaction, owner,
- attended_by, machine, opened_at, closed_at, outcome, divergence}`.
- `owner` is a random 128-bit token made when the transaction is created and kept
- only in the machine's state directory, beside the journal, in a 0600 file named
- for the transaction; `machine` is the machine's identity (`/etc/machine-id` on
- Linux, `IOPlatformUUID` on macOS). `divergence` is `null` or
- `{transaction, phase, reason, at}`.
-- **Absence is a listing answer.** As the lock sweep already does (`:1009-1012`),
- the verb lists the exact key (`s3:ListBucket` with `s3:prefix` equal to the key)
- and treats the object as absent only when the listing lacks it. A failed GET is
- never absence; an AccessDenied is `api`.
-- **Take** (before the journal's first row): create-only PUT
- (`If-None-Match: *`) of an `open` claim. On a conflict, GET it: `closed` with
- `divergence: null` is taken with `If-Match` on its ETag; `closed` with a
- divergence refuses `blocked`; `open` refuses `busy`, naming the transaction,
- who, which machine and since when. A lost race (`release.ErrCASConflict`) is
- `busy`. Only after the PUT succeeds is the journal created; if journal creation
- fails, the claim is closed again with outcome `not-started`.
-- **Ownership on every writing verb.** `resume`, `return`, `rollback`, `abandon`,
- `close-lost` and `cancel-drain` first GET the claim and go on only when it is
- `open` for this transaction, its `owner` equals the token in this state
- directory, and its `machine` equals this machine. A journal copied to another
- machine therefore cannot act. Every claim write after the take uses `If-Match`
- on the ETag this verb last read, so a claim that changed under a running verb
- stops it at its next claim write (`busy`). There is no forced release: a claim
- whose machine is lost blocks the group, fail closed, and recovery is the
- controller's documented procedure (a hand edit of the object after proving the
- member set at rest), not a verb.
-- **Divergence is group-wide.** Wherever the script writes
- `provider-divergence.json` (`:1468`, `:1755`), the verb first writes the claim
- with `divergence` set (still `open`), then the local file. The close PUT
- carries `divergence` forward, and nothing the verb does clears it, `close-lost`
- included (`:1430-1431` keeps the flag; the claim keeps it too). The controller
- clears it by hand after resolving the provider contract, as it removes the file
- today. `plan` and every take refuse while it is set.
-- **Release:** when the transaction finishes (`State.finish`), the local finish
- comes first, then a PUT of `closed` with the outcome, `If-Match` on the ETag. A
- release that fails leaves the claim `open`; the next verb on the same machine,
- with the same owner token, finds its finished journal and closes the claim
- before anything else.
-- **No delete.** The store's IAM denies `s3:DeleteObject` in places
- (`lease-deleteobject-outage`); the claim is only ever overwritten.
-- **`plan` and `status` take no claim.** `plan` lists and reads it and reports an
- open claim or a divergence as a refusal. `status` reads only the local journal.
-- **The script during the overlap** (§11) reads the claim, read-only, before
- creating a journal, and refuses when it is open or diverged: a small patch to
- the script, with its own test, in the plan's claim task.
-- **IAM:** one new operator policy statement, `GroupMaintenanceClaim`:
- `s3:GetObject` and `s3:PutObject` on exactly that key, and `s3:ListBucket` on the
- deployment bucket with `s3:prefix` equal to that key. Census: an infra change on
- a card.
-- **Request budget:** per transaction, one LIST and one or two GETs and PUTs at the
- take, one GET per later writing verb, one PUT at close; none on a timer.
+## 8. Serialization: one machine and account per deployment (D6)
+
+Rev 2 added a claim object in the deployment bucket so any machine could run the
+verb. Two Astra rounds found that a shared claim cannot fence a paused executor,
+can lose the divergence block on a failed write, and blocks `cancel-drain` after a
+finished failed drain (`~/.cache/group-roll-go/ASTRA-R1.md` 1-2, `ASTRA-R2.md` 1-3).
+Under stopping rule 2 it is cut, and the verb keeps the script's model:
+
+- **One operator account on one machine per deployment.** The card names it, as it
+ names the operator host today. That account's state directory is the only one: it
+ is derived from `XDG_STATE_HOME` or `HOME` with no override flag (V4), owned by the
+ account, 0700, ancestors not group- or world-writable.
+- **Locally, exactly the script's rules.** One `active-v2.json`, the non-blocking
+ exclusive lock on every writing verb, `status` lock-free; `provider-divergence.json`
+ in the group directory blocks further rolls until the controller removes it, and
+ `close-lost` keeps it (`:1430-1431`); `cancel-drain` acts on a closed failed-drain
+ journal or one stopped by `return-refused-moving` (`:2298-2312`).
+- **What this leaves, unchanged from today.** Two machines or accounts with configs
+ for the same group are not serialized against each other; the card rule is the
+ control. The group's own shape is a partial backstop: preflight refuses unless
+ `min = desired = max = N` with every member in service and healthy (`:1271-1297`),
+ so a second transaction cannot start while another has lowered minimum or parked
+ a member.
+- **No new IAM, no new object.**
## 9. The floor from signed release records (D7)
@@ -488,7 +473,7 @@ checked rather than asserted.
### 10.5 Integration
The engine runs end to end in-process against MinIO (edges files, locks, release
-pointers and the claim) with a fake `Group` and a fake `Box` that runs the real
+pointers) with a fake `Group` and a fake `Box` that runs the real
`group-maintenance` status, drain and fence output shapes. The AWS adapter gets
request-shape tests against the SDK's middleware stack (no network): the exact
operations, the decrement flags and the group name on every write.
@@ -500,19 +485,18 @@ operations, the decrement flags and the group name on every write.
retirement; the port does not.
2. **Build and merge** the verb (the plan). It is inert: an operator verb nothing
runs on its own. The census card covers its packages (they are in the root
- binary's dependency closure) and the operator policy's new claim statement.
-3. **Release.** Paul schedules it. The policy apply (claim statement) is a card step.
-4. **Parity witnesses on dev** with the Go verb, from an operator machine that is not
- the operator host: W1 (replace), W2 (roll) and W4 (remove, including the refused
+ binary's dependency closure).
+3. **Release.** Paul schedules it. No infra change ships with it.
+4. **Parity witnesses on dev** with the Go verb, from the deployment's operator account
+ (not root): W1 (replace), W2 (roll) and W4 (remove, including the refused
remove), on the same probe and pass bar as §25.10. Plus one probe and one
`cancel-drain` after a forced drain failure. Their journals and drain summaries
are compared with the script's W1, W2 and W4 runs: the same phases in the same
order, the same provider writes, the same summary fields.
-5. **Overlap rule.** Until step 6 a card names one tool per group per window. The
- tools never share state (V4). The patched script refuses while the claim is open or
- diverged (§8), but it does not take the claim, so a Go take can still race a script
- transaction already past that check: the card rule covers that window. A divergence
- the script records stays in its local file only; the card sends it to the controller.
+5. **Overlap rule.** Until step 6 a card names one tool per group per window, and a
+ group whose last transaction ran under one tool is checked with that tool's `status`
+ (no open transaction, no divergence flag) before the other tool starts. The tools
+ never share state (V4).
6. **Retire the script.** First, in its own commit, move what the kept tools import from
it: `scripts/region_group_frames.py` (`:9-12`) and `scripts/region-group-fault/client.py`
(`:14-15`, `:33-44`) use its text, `remote_command` framing and session transport; those
@@ -537,13 +521,10 @@ member is parked and deregistered before its edge stops.
## 13. Open questions for Paul
-1. **The claim (§8).** Recommended: build it, since the verb runs anywhere. The cut: keep
- "one operator host per deployment" as a card rule, unenforced, as today, and keep the
- divergence block local as the script does.
-2. **A lost operator machine** leaves its claim open and the group blocked until the
- controller edits the object by hand. Recommended: accept; a forced-release verb is what
- round 1 found unsafe.
-3. **Parity witnesses (§11 step 4).** Recommended: W1, W2 and W4 only, not all of W1-W5,
+1. **Cross-machine serialization (§8).** Cut in rev 3 after two rounds in the same
+ family; the verb serializes as the script does. Recommended: accept. A shared claim
+ would need its own design with executor fencing, out of this port.
+2. **Parity witnesses (§11 step 4).** Recommended: W1, W2 and W4 only, not all of W1-W5,
because the script's runs already prove the box side.
-4. **Windows.** Recommended: refuse. Supporting it needs a ConPTY transport for one AWS
+3. **Windows.** Recommended: refuse. Supporting it needs a ConPTY transport for one AWS
plugin.