oficina / equipo Public

plans: Task 17 live plan, pin and rulings

Pin 6b7f6ee1 (R36: malformed MicroVM IDs refused, fail closed; the
first real ID is recorded and an R36 refusal is a stop). R37: IAM calls
are the named global exception; controller blocks run with the sandbox
off using setsid nohup, PID files and identity checks (U20 settled).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 4eb30168d5167f13fc3649bd99d073af184d8f1c parent 6b7f6ee
1 file changed, +58 −39
  • docs/superpowers/plans/2026-11-23-hosted-1a-task17-live-plan.md +58 −39
diff --git a/docs/superpowers/plans/2026-11-23-hosted-1a-task17-live-plan.md b/docs/superpowers/plans/2026-11-23-hosted-1a-task17-live-plan.md
index 6f08b95c..a72d1341 100644
--- a/docs/superpowers/plans/2026-11-23-hosted-1a-task17-live-plan.md
+++ b/docs/superpowers/plans/2026-11-23-hosted-1a-task17-live-plan.md
@@ -10,11 +10,12 @@ command or SDK call of any kind was made while writing it.
through one guard that clears ambient credentials and endpoint overrides, pins the profile and
region, and checks the STS account before the block does anything else. Nothing touches
`149757027610`; any ARN naming it aborts.
-- **Global endpoint, one exception.** No Cost Explorer or other billing call (R33): spend is
- estimated from rates and the recorded lifetimes of what the run created, and Paul reads the bill
- himself. IAM is a global service with no regional endpoint; the plan needs two roles (the image
- build role and the connector's network-interface role), so it makes 6 IAM create calls and 5 IAM
- delete calls, all under the same account guard. Approving the plan approves those IAM calls.
+- **Global endpoint, one named exception (R37).** No Cost Explorer or other billing call (R33):
+ spend is estimated from rates and the recorded lifetimes of what the run created, and Paul reads
+ the bill himself. IAM is global, with no regional endpoint, so the IAM calls for the two roles
+ (the image build role and the connector's network-interface role: create, attach inline policy,
+ read back, delete) are the one exception to eu-west-1-only. They run behind the same `kass`
+ account check as every other call, and Paul's one approval covers them.
- **Tags (R34).** Every taggable resource gets `purpose=equipo-hosted-dev` and `run=<RUN>` (a
random run ID chosen in 0.2): the VPC, its default security group (and that group's two default
rules), its main route table and its default network ACL, the subnet, the route table, the
@@ -25,7 +26,7 @@ command or SDK call of any kind was made while writing it.
R32), and teardown proves each one ended.
- **The connector's network interfaces** are created and deleted by Lambda. They are recorded by
ID when the connector is ACTIVE and verified gone after the connector is deleted.
-- **Code.** The exact revision `PIN_SHA` (the pre-flight's final commit, R35). Before anything is
+- **Code.** The exact revision `PIN_SHA` = `6b7f6ee1` (the pre-flight's final commit, R35). Before anything is
built, 0.1 checks that HEAD contains it, that it contains R32 (`f95575c6`), and that nothing
outside `docs/` differs from it, committed or not.
- **The reaper is scoped to this run's image (R32).** The controller's List, and so its orphan
@@ -76,10 +77,16 @@ and Elastic IP setting, which the installed CLI cannot show, are checked before
- **Long blocks.** Blocks that can run past the Bash tool's 10-minute foreground limit (2.3, 3.8,
3.9, 6.1, 7.2, 7.4, 7.5, 8.2, 9.A, 9.C, 10.1, 10.2) are started with the tool's background
option and read when they exit. The block itself does not depend on that option.
-- **The controller** is started with `setsid nohup` by `start_ctl`, which writes its PID and, when
- it ends, its exit status to files. `stop_ctl` checks the PID still belongs to this run's binary
- (via `/proc/<pid>/cmdline`) before signalling it. If the process does not survive between tool
- calls, or `/proc` hides it while its ports are open, that is an abort.
+- **The controller, with the sandbox off (R37).** A sandboxed Bash call kills its child processes
+ when it returns, so every block that starts, checks or stops the controller runs with the agent's
+ sandbox OFF: 5.6, 6.1, 7.1, 7.2, 7.3, 7.4, 8.1, 8.2, 9.A, 9.G, 10.1, 10.9, S.1 and S.3. Outside
+ the sandbox `$TMPDIR` is different, so those blocks set `T17` explicitly to the path 0.2 printed;
+ their first line reads `set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"`, and that
+ path is the only text the agent fills in. `start_ctl` starts the controller with `setsid nohup`,
+ writes its PID and, when it ends, its exit status to files. `ctl_alive` and `stop_ctl` check that
+ the PID still belongs to this run's binary (`/proc/<pid>/cmdline`) before anything is signalled.
+ If the controller is gone when a block expects it, or a port stays open with no matching
+ process, that is an abort.
- **docs-t1.** The controller listens on `127.0.0.1:18443` (API) and `127.0.0.1:18444` (metrics)
only, checked after every start. The hook server in the image listens on port 9000 inside the
MicroVM, not on docs-t1. Scratch is `$TMPDIR/equipo-t17`, removed in 10.9. Go caches stay at
@@ -97,12 +104,14 @@ and Elastic IP setting, which the installed CLI cannot show, are checked before
### 0.1 Code pin and local tools (no AWS call)
-`PIN_SHA` is `3103334e` (`3103334e2a3c8d4b20fc113c0310569f17087674`), the pre-flight's final commit
-(cleanup fixes and evidence logging, after `41178b00`), relayed by the coordinator.
+`PIN_SHA` is `6b7f6ee1` (`6b7f6ee1ee3939c85c75785ff8bf48c195714d35`), the pre-flight's final commit
+(cleanup fixes and evidence logging in `41178b00` and `3103334e`; R36 in `6b7f6ee1`: the adapter
+refuses MicroVM IDs that are not 1 to 128 characters of `[A-Za-z0-9-]`, failing closed), relayed by
+the coordinator.
```sh
set -euo pipefail
-PIN_SHA='3103334e2a3c8d4b20fc113c0310569f17087674'
+PIN_SHA='6b7f6ee1ee3939c85c75785ff8bf48c195714d35'
case "$PIN_SHA" in *'<'*|'') echo "ABORT: PIN_SHA is not filled in"; exit 1;; esac
cd /home/paulca/amadan.net/oficina/equipo-hosted-1a
git rev-parse --verify "$PIN_SHA^{commit}"
@@ -131,6 +140,7 @@ mkdir -m 700 "$TMPDIR/equipo-t17"/{out,image,iam,keys,bin}
cat > "$TMPDIR/equipo-t17/env.sh" <<'ENVEOF'
# env.sh: sourced by every block, after `set -euo pipefail`. Task 17 only.
: "${TMPDIR:?TMPDIR is unset}"
+# T17 may be set by a sandbox-off block (R37); otherwise it is $TMPDIR/equipo-t17.
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_SECURITY_TOKEN AWS_DEFAULT_PROFILE \
AWS_CONFIG_FILE AWS_SHARED_CREDENTIALS_FILE AWS_ROLE_ARN AWS_ROLE_SESSION_NAME AWS_WEB_IDENTITY_TOKEN_FILE \
AWS_CA_BUNDLE AWS_ENDPOINT_URL AWS_USE_FIPS_ENDPOINT AWS_USE_DUALSTACK_ENDPOINT
@@ -138,7 +148,8 @@ for _v in $(env | sed -n 's/^\(AWS_ENDPOINT_URL_[A-Z0-9_]*\)=.*/\1/p'); do unset
export AWS_PROFILE=kass AWS_REGION=eu-west-1 AWS_DEFAULT_REGION=eu-west-1 AWS_PAGER="" \
AWS_STS_REGIONAL_ENDPOINTS=regional AWS_RETRY_MODE=standard AWS_MAX_ATTEMPTS=3
export CGO_ENABLED=0
-export T17="$TMPDIR/equipo-t17" REPO=/home/paulca/amadan.net/oficina/equipo-hosted-1a
+if [ -z "${T17:-}" ]; then T17="$TMPDIR/equipo-t17"; fi
+export T17 REPO=/home/paulca/amadan.net/oficina/equipo-hosted-1a
export ACCOUNT=640012953448 TAGV=equipo-hosted-dev
export LEDGER="$T17/ledger.env" JOURNAL="$T17/journal.tsv" VMS="$T17/vms.tsv"
export NO_INGRESS=arn:aws:lambda:eu-west-1:aws:network-connector:aws-network-connector:NO_INGRESS
@@ -357,7 +368,7 @@ ENVEOF
RUN=$(date -u +%m%d)-$(openssl rand -hex 3)
NAME=equipo-hosted-dev-t17-$RUN
cat > "$TMPDIR/equipo-t17/run.env" <<RUNEOF
-export PIN_SHA='3103334e2a3c8d4b20fc113c0310569f17087674'
+export PIN_SHA='6b7f6ee1ee3939c85c75785ff8bf48c195714d35'
export RUN=$RUN NAME=$NAME
export OPERATOR_ROLE=$NAME-conn-op BUILD_ROLE=$NAME-build CONN_NAME=$NAME-egress IMAGE_NAME=$NAME
export BUCKET=$NAME-640012953448 LOG_GROUP=/aws/lambda-microvms/$NAME TOPIC_NAME=$NAME-alerts SG_NAME=$NAME-vm
@@ -371,8 +382,9 @@ echo "T17=$T17 RUN=$RUN NAME=$NAME"
```
- The `PIN_SHA` line in `run.env` carries the same value as 0.1.
-- Expected: one line with the scratch path, the run ID and the base name. Every later block must see
- the same `$TMPDIR` (the environment file refuses to load otherwise).
+- Expected: one line with the scratch path, the run ID and the base name. Record the `T17=` path:
+ sandboxed blocks find it through `$TMPDIR`, and the sandbox-off blocks (R37) set it from this line.
+ The environment file refuses to load if the directory is not there.
- Abort if: the scratch directory already exists.
### 0.3 First AWS call: who am I
@@ -968,7 +980,7 @@ subnet and group only, and no service-managed Elastic IPs (`network.go`). This a
database to `aws:640012953448:eu-west-1` (R28) and proves the SNS topic takes startup alerts.
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
start_ctl "$T17/bin/controller" audit-only
ctl_ready
grep -F 'launches enabled: false' "$T17/controller.log" || die "the controller did not report launches off"
@@ -996,7 +1008,7 @@ Runs after 9.A to 9.F (client-token behaviour known, facts VMs settled).
### 6.1 Run it, then settle every VM it made
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
need A3_RESULT IMAGE_ARN
! ctl_alive || die "the controller is running"
scan >/dev/null; [ -z "$(live_ids)" ] || die "live VMs of this image before the contract: $(live_ids)"
@@ -1005,6 +1017,7 @@ export EQUIPO_HOSTED_LIVE_CONFIG="$T17/live.json"
if gotest "$T17/out/6-contract.log" -tags hostedlive ./internal/isolatedjob/awsjob -run TestLiveContract -count=1 -v -timeout 60m; then rc=0; else rc=$?; fi
jw "PHASE contract end rc=$rc"
settle_all
+! grep -E "microvm id is missing or malformed|microvm id is malformed|empty or malformed ref" "$T17/out/6-contract.log" || die "the adapter refused a MicroVM ID as malformed (R36): stop and ask"
grep -E 'visibility: Get showed new VM |list lag: List showed running VM ' "$T17/out/6-contract.log" || die "the contract logged no visibility or list-lag lines"
fails=$(grep -oE -- '--- FAIL: TestLiveContract/[A-Za-z]+' "$T17/out/6-contract.log" | sed 's|.*/||' | sort -u | tr '\n' ' ')
echo "rc=$rc failed subtests: [$fails]"
@@ -1035,7 +1048,7 @@ echo "contract: approved exceptions only: $fails"
### 7.1 Start with launches on, check readiness
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
scan >/dev/null; [ -z "$(live_ids)" ] || die "live VMs of this image: $(live_ids)"
start_ctl "$T17/bin/controller" sequence EQUIPO_HOSTED_ENABLED=1
ctl_ready
@@ -1045,7 +1058,7 @@ grep -F 'launches enabled: true' "$T17/controller.log" || die "launches are not
### 7.2 Driver sequence: launch Small, drain, quiescent, suspend, resume, stop with proof
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
. "$T17/driver.env"
ctl_alive || die "the controller is not running"
jw "PHASE sequence start"
@@ -1055,6 +1068,7 @@ grep -E 'attempt |launch:|running:|pause:|suspended:|resume:|stop:|timings:' "$T
harvest "$T17/controller.log" controller
stop_ctl
settle_all
+! grep -hE "microvm id is missing or malformed|microvm id is malformed|empty or malformed ref" "$T17/out/7.2-sequence.log" "$T17/controller.log" || die "a MicroVM ID was refused as malformed (R36): stop and ask"
[ "$rc" = 0 ] || die "TestLiveControllerSequence failed"
att=$(grep -oE 'attempt task17-[0-9a-f]+' "$T17/out/7.2-sequence.log" | head -n 1 | cut -d' ' -f2); rec SEQ_ATTEMPT "$att"
dbread "select attempt_id, state, vm_ref, epoch, pause_generation, stop_proof_json from jobs where attempt_id='$SEQ_ATTEMPT'"
@@ -1070,7 +1084,7 @@ dbread "select action, reason from audit where attempt_id='$SEQ_ATTEMPT' order b
### 7.3 Crash between the provider call and transaction 2: the launch step
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
. "$T17/driver.env"
rec CRASH_ATTEMPT "task17-crash-$(openssl rand -hex 4)"
rec CRASH_START "$(date -u +%FT%T)"
@@ -1105,7 +1119,7 @@ jw "CRASH controller exited 137 after launching $CRASH_VM"
second reaper pass, about 60 s after start (pre-flight concern 2).
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
. "$T17/driver.env"
need CRASH_ATTEMPT CRASH_VM CRASH_START
start_ctl "$T17/bin/controller" recover EQUIPO_HOSTED_ENABLED=1
@@ -1140,7 +1154,7 @@ dbread "select action, reason from audit where attempt_id='$CRASH_ATTEMPT' order
### 8.1 Start the controller (launches off: reaping works regardless) and plant a VM
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
scan >/dev/null; [ -z "$(live_ids)" ] || die "live VMs of this image: $(live_ids)"
start_ctl "$T17/bin/controller" orphan
ctl_ready
@@ -1163,7 +1177,7 @@ after rechecking ownership; so the stop lands between about P+11:00 and P+12:30,
within a minute or two after that.
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
need ORPHAN_VM ORPHAN_PLANTED
P=$(date -d "$ORPHAN_PLANTED" +%s)
while :; do
@@ -1208,7 +1222,7 @@ count as results; any other error aborts.
### 9.A Client token: same request, then changed request
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
! ctl_alive || die "the controller is running"
scan >/dev/null; [ -z "$(live_ids)" ] || die "live VMs of this image: $(live_ids)"
printf 'task17-a' > "$T17/out/payload-a"; printf 'task17-b' > "$T17/out/payload-b"
@@ -1218,6 +1232,8 @@ launch A1 "$TOKEN_A" 900 "$T17/out/payload-a"
rec A1_AFTER "$(date -u +%FT%T.%3NZ)"
[ "$L_RC" = 0 ] || die "A1 failed: $L_CODE"
rec VM_A "$L_ID"
+jw "FIRST-VM-ID $VM_A (length ${#VM_A})"; echo "first real MicroVM ID: $VM_A (length ${#VM_A})"
+[[ "$VM_A" =~ ^[A-Za-z0-9-]{1,128}$ ]] || { vm_end "$VM_A"; die "MicroVM ID [$VM_A] is outside R36's form; the adapter refuses it (fails closed): stop and ask"; }
launch A2 "$TOKEN_A" 900 "$T17/out/payload-a"
if [ "$L_RC" = 0 ] && [ "$L_ID" = "$VM_A" ]; then rec A2_RESULT same-vm
elif [ "$L_RC" = 0 ]; then vm_end "$L_ID"; vm_end "$VM_A"; rec A2_RESULT "new-vm:$L_ID"; die "a replay of the same request made a second VM"
@@ -1231,7 +1247,9 @@ cat "$T17/out/launch-A3.err"
echo "A2=$A2_RESULT A3=$A3_RESULT"
```
-- Expected: A2 returns `VM_A` (one attempt, one VM). A3 is refused with `ConflictException` or
+- Expected: the first real MicroVM ID is recorded with its length and fits R36's form (1 to 128
+ characters of `[A-Za-z0-9-]`); if it does not, the adapter would refuse every ID, so the run stops
+ and asks. A2 returns `VM_A` (one attempt, one VM). A3 is refused with `ConflictException` or
`ValidationException`; the exact message is recorded.
- A3 answered with `VM_A` (AWS ignores the body on replay) or with a new VM (ended at once) are
results, recorded; with a new VM, 6.1's `ChangedSpecConflicts` exception no longer applies.
@@ -1345,7 +1363,7 @@ scan >/dev/null; echo "image list: $(wc -l < "$T17/last_scan.tsv") VMs, $(grep -
### 9.G Final token replay (after section 8)
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
need TOKEN_A VM_A A1_BEFORE
! ctl_alive || die "the controller is running"
launch G1 "$TOKEN_A" 900 "$T17/out/payload-a"
@@ -1375,7 +1393,7 @@ a direct read before the next dependency is touched, and recorded with `deleted`
### 10.1 No controller, no VM, then the image and both versions
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
need IMAGE_ARN VER_SMALL VER_LARGE
stop_ctl
settle_all
@@ -1511,7 +1529,7 @@ for k in run purpose; do v=$([ "$k" = run ] && echo "$RUN" || echo "$TAGV")
### 10.9 Evidence into the progress file, then remove scratch
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"
! ctl_alive || die "the controller is running"; [ -z "$(listeners)" ] || die "listeners open"
cut -f2- "$JOURNAL" | grep -vE '^(INTENT|CONTROLLER) ' > "$T17/journal-for-progress.txt"
wc -l "$T17/journal-for-progress.txt" "$VMS"
@@ -1533,7 +1551,7 @@ Run in this order after any abort. Each part is safe to run whatever phase the r
**S.1 Controller.**
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"
stop_ctl
```
@@ -1569,7 +1587,7 @@ The agent then runs `rec <VAR> <ID>` for each resource found this way whose inte
exist and this part is skipped. Otherwise:
```sh
-set -euo pipefail; . "${TMPDIR:?}/equipo-t17/env.sh"; guard
+set -euo pipefail; T17='<T17 printed by 0.2>'; . "$T17/env.sh"; guard
need IMAGE_ARN
! ctl_alive || die "the controller is running"
settle_all
@@ -1674,8 +1692,11 @@ EOF
- **U9, connector interfaces:** the pinned SDK documents asynchronous interface cleanup on delete,
then not found. The 15 and 40 minute bounds are ours; exhausting them is a stop.
- **U15, billing service name:** removed with the Cost Explorer call (R33).
+- **U20, process survival:** settled by R37: sandboxed calls kill their children on return, so the
+ controller blocks run with the sandbox off, with PID files and identity checks; a missing
+ controller is an abort.
-### Still unconfirmed (each is a stop point if it goes wrong; nothing is changed live)
+### Still unconfirmed, 15 (each is a stop point if it goes wrong; nothing is changed live)
1. **U2. Operator role scoping.** That Lambda needs `ec2:DeleteNetworkInterface` and describe
calls (the SDK says so; the documented policy lacks them), and that the `ec2:Subnet` condition
@@ -1699,19 +1720,17 @@ EOF
12. **U16. Ireland rates** for snapshots, launch reads and image storage, and whether builds or
connectors are billed; the worst case adds 20 % and counts builds as VM time.
13. **U17. MicroVM ID format** (`mvm-` and the guide's pattern) for harvesting IDs from logs; the
- image-scoped scans are the authoritative inventory either way.
+ image-scoped scans are the authoritative inventory either way. 9.A records the first real ID;
+ one outside R36's form is a stop.
14. **U18. Error codes** used in expected-failure branches that are taken from models or
convention, not observed: `404` for `head-bucket` and `head-object`, `NotFound` (or
`NotFoundException`) for SNS, `ResourceNotFoundException` for Lambda reads, and the
`An error occurred (<code>)` text the `try` helper parses. A different code aborts.
15. **U19. Image version tags:** whether versions carry the image's tags; recorded as read in 3.8,
not required.
-16. **U20. Process survival:** that a controller started with `setsid nohup` survives between agent
- tool calls in the sandbox, and that `/proc/<pid>/cmdline` is readable for it. If not, abort;
- no other process mechanism is improvised.
### Placeholders
-None. `PIN_SHA` is `3103334e2a3c8d4b20fc113c0310569f17087674`; the controller and contract log lines grepped
-above are the exact texts in that commit (`internal/hostedctl/logs.go`,
+None in the plan. `PIN_SHA` is `6b7f6ee1ee3939c85c75785ff8bf48c195714d35`; the controller and contract log
+lines grepped above are the exact texts in that commit (`internal/hostedctl/logs.go`,
`internal/isolatedjob/isolatedjobtest/contract.go`).