carlos / platform Public

Preserve witness verdicts across cleanup recovery and record F4 state

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev e8c9cd008e74b372941bad338adb996aad861645 parent 2a1f829
3 files changed, +70 −40
  • docs/superpowers/notes/region-ha-p3b1-f4-followups.md +45 −37
  • scripts/region-group-boot-witness.py +14 −3
  • scripts/region_group_boot_witness_test.py +11 −0

CI failed — run details

diff --git a/docs/superpowers/notes/region-ha-p3b1-f4-followups.md b/docs/superpowers/notes/region-ha-p3b1-f4-followups.md
index b9e86a5d4..c3b4be5a9 100644
--- a/docs/superpowers/notes/region-ha-p3b1-f4-followups.md
+++ b/docs/superpowers/notes/region-ha-p3b1-f4-followups.md
@@ -1,43 +1,51 @@
-# P3b-1 F4 follow-ups for the controller
+# P3b-1 F4 controller handoff
-F4 review round 1: Opus reviewed a81a885c against amadan origin/main f6f91e2a.
-READY, 0 P1, 0 P2, 4 P3. Review stops here. The external census unit
-`infra/modules/region-host/group-init.sh.tftpl` and its module envelope were
-approved. Controller records that approval on #280; no amadan write was made
-by the implementer. The final test-only follow-up expands tmpfs-default paths
-in the static guard; root source and census fingerprints are unchanged.
+F4 review round 1 remains closed: Opus reviewed a81a885c against amadan
+origin/main f6f91e2a, READY, 0 P1 / 0 P2 / 4 P3. It approved the external
+`group-init.sh.tftpl` census unit and the `infra/modules/region-host` envelope.
+The controller records that approval on #280. No implementer amadan write
+or new review was made in rounds 2–4.
-The live witness is incomplete and explicitly refused by its CLI. Review
-approval covers that refusal and the local dry run, not live AWS execution.
-The requested role lacks GetParametersByPath and the signed channel/floor/
-identity/artifact reads needed to reach edge startup; a random scratch public
-key also cannot verify the real dev signatures. Resolve this contract before
-implementing or reviewing live execution. Do not remove LIVE_BLOCKERS alone.
+Implementer round 4 completes the witness lifecycle under Paul's final
+rulings: `floor=absent-expected (Paul 2026-11-04 21:09Z)`, the artifact SHA-256
+pin for both renders, the supplied dev public key verified through Go's
+release package, exact S3 object reads and the approved bucket-list statement.
+`LIVE_BLOCKERS` is empty. Execution requires both `--execute --i-have-budget`
+and an unused slot in the durable two-run ledger. The implementer ran no
+live witness and spent no live-run budget.
-P3 follow-ups from Opus, with invariant/fault family:
+The new AWS lifecycle code needs the controller's review before execution.
+The prior staging review did not cover live resource creation or cleanup.
+Carry the closed round history forward; implementation round 4 is not review
+round 4. Root source and census fingerprints are unchanged in this round.
-1. Exec-site audit: the guard skips a line containing bootstrap.sha256 without
- subprocess. A bootstrap exec with that string in a trailing comment can
- escape the execution counter. Check execution prefixes before that skip and
- add a mutation case. Forbidden tmpfs path scanning still runs first.
-2. Staging lifetime: failed boot leaves the root-only directory on disk.
- Rerunning user data refuses its existing helper or exclusive output files.
- Record this safe refusal in operational expectations; do not weaken it to
- reuse potentially stale bootstrap inputs.
-3. Witness evidence: after cleanup, the collector can inspect only the parent
- mount, and immediate collection may precede the edge's denied-write log.
- Obtain before/after mount evidence and wait for the specific journal event
- before enabling live assertions.
-4. Render hygiene: copytree(dirs_exist_ok=True) retains files removed from the
- source since a previous run. Build each render from a fresh source snapshot
- while keeping provider downloads outside it.
+The four P3 items from the closed review now stand as follows:
-Additional live-harness work (not claimed complete): durable two-run budget;
-validated live account/AMI/subnet/SG inputs; resource collision/ownership
-journal; response-loss recovery; retries and verified termination; complete
-version deletion; setup/cleanup signal coverage; post-run non-interference
-checks on failure; console decoding/persistence; all-failure evidence output.
+1. Exec-site audit: fixed the trailing `bootstrap.sha256` comment bypass and
+ added direct-exec, shell-wrapper and unverified-exec mutations.
+2. Staging lifetime: unchanged safe refusal. A failed boot may retain its
+ root-only staging directory. Rerunning user data refuses existing helper
+ or exclusive output files; never reuse those inputs. The witness always
+ terminates its instance, including on boot failure.
+3. Witness evidence: a separate cloud-boothook observer records the actual
+ staging leaf before ingress, its removal and the parent mount afterward.
+ Part 1 remains byte-identical to the module render. The collector waits
+ for the denied-publication journal event. The observer reports final
+ `cloud-init status --long` to the console after scripts finish.
+4. Render hygiene: each render uses a fresh module copy. Provider downloads
+ are cached outside that copy. The copy is removed in `finally`.
-Review history follows the change: any later review must carry this round,
-its closed staging/census verdict, and the newly agreed live scope. The known
-incomplete harness is not a successful real-AMI witness.
+P8 is explicitly inferred from successful W4. P10 checks effective installed
+edge/control unit settings, the live edge process's privileges and bind-mount
+flags. It does not repeat the separate active tenant/sidecar kernel drill or
+claim reboot coverage. No W/P real-AMI assertion has passed in this round;
+the dry-run table marks them NOT RUN.
+
+The controller's round-4 report, read-only preflight, dry-run call plan,
+assertion table and test logs are under
+`/home/paulca/.cache/p3b1-f4-work/`. The report is `astra-4-report.md`.
+Pending creates with no recoverable owned id remain LEAKED/unknown; a missing
+response never licenses declaring an instance terminated or deleting a
+same-name foreign resource. `--cleanup-only RUN` uses the original journal
+and baseline without spending a run; it preserves the original boot verdict
+and assertion table. Adding `--dry-run` only prints its plan.
diff --git a/scripts/region-group-boot-witness.py b/scripts/region-group-boot-witness.py
index 805ae6560..3f4c18284 100644
--- a/scripts/region-group-boot-witness.py
+++ b/scripts/region-group-boot-witness.py
@@ -1259,6 +1259,7 @@ def write_evidence(directory, journal, rows, error=''):
status = 'DRY RUN: simulated AWS; live assertions NOT RUN.' if data['dry'] else 'Live witness; see individual assertions.'
body = '# P3b-1 F4 witness evidence\n\n' + status + '\n\n' + FLOOR_LABEL + '\n\n'
body += 'Run: `' + data['scope']['run'] + '`. Account: `' + ACCOUNT + '`. Region: `' + REGION + '`.\n\n'
+ body += 'Run status: `' + data.get('run_status', data['status']) + '`. Current status: `' + data['status'] + '`.\n\n'
body += 'Final cloud-init: `' + data.get('cloud_init_status', 'not observed') + '`.\n\n'
if error:
body += 'Failure: ' + esc(error) + '\n\n'
@@ -1277,7 +1278,10 @@ def write_evidence(directory, journal, rows, error=''):
def lifecycle(aws, journal, launch, directory, pubkey_file, ledger, cleanup_only=False, sleep=time.sleep):
- error, leaks, rows = '', [], []
+ error, leaks = '', []
+ original_error = journal.data.get('error', '') if cleanup_only else ''
+ rows = [r for r in journal.data.get('assertions', []) if r[0] not in
+ ('target groups and control/edges/', 'cleanup verified')] if cleanup_only else []
old_handlers = {}
def interrupted(signum, frame):
raise KeyboardInterrupt('signal ' + str(signum))
@@ -1349,9 +1353,16 @@ def lifecycle(aws, journal, launch, directory, pubkey_file, ledger, cleanup_only
present = {name for name, ok, detail in rows}
rows += [(name, None if aws.dry else False, 'not reached: ' + error)
for name, ok, detail in assertions({}) if name not in present]
- journal.data.update(status='failed' if error or leaks or problems else 'complete', error=error, leaked=leaks)
+ if cleanup_only:
+ journal.data.setdefault('run_status', journal.data['status'])
+ journal.data.update(status='cleanup-failed' if error or leaks or problems else 'cleaned',
+ cleanup_error=error, leaked=leaks)
+ else:
+ status = 'failed' if error or leaks or problems else 'complete'
+ journal.data.update(status=status, run_status=status, error=error, leaked=leaks)
+ journal.data['assertions'] = rows
journal.save()
- write_evidence(directory, journal, rows, error)
+ write_evidence(directory, journal, rows, error or original_error)
finally:
for sig, handler in old_handlers.items():
signal.signal(sig, handler)
diff --git a/scripts/region_group_boot_witness_test.py b/scripts/region_group_boot_witness_test.py
index ea263b5ce..ff5ab0bdb 100644
--- a/scripts/region_group_boot_witness_test.py
+++ b/scripts/region_group_boot_witness_test.py
@@ -296,6 +296,17 @@ class LifecycleTests(unittest.TestCase):
self.assert_gone()
self.assertEqual(ledger,(self.directory/'budget.json').read_bytes())
+ def test_cleanup_only_preserves_original_witness_failure(self):
+ with patch.object(w,'follow_boot',side_effect=ValueError('boot failed')):
+ with self.assertRaisesRegex(ValueError,'boot failed'):self.run_lifecycle()
+ original=[r for r in self.j.data['assertions'] if r[0].startswith(('W','P'))]
+ self.run_lifecycle(cleanup_only=True)
+ self.assertEqual(self.j.data['status'],'cleaned')
+ self.assertEqual(self.j.data['run_status'],'failed')
+ self.assertEqual(self.j.data['error'],'boot failed')
+ self.assertEqual(original,[r for r in self.j.data['assertions'] if r[0].startswith(('W','P'))])
+ self.assertIn('boot failed',(self.directory/'evidence.md').read_text())
+
def test_lost_terminate_and_delete_replies_resolve_by_readback(self):
self.aws.fail_after[('ec2','terminate-instances')]=RuntimeError('reply lost')
self.aws.fail_after[('iam','delete-role')]=RuntimeError('reply lost')