M5a plan: task 16, the gate passes on macOS; the review's tasks become 17 to 20

The work moved to titan (macOS), where the gate failed for reasons older
than M5a: sockets under macOS's long TMPDIR pass its 104-byte limit,
gatewayd reads /proc/self for its uid, and /tmp is /private/tmp. Task 16
sets TMPDIR=/tmp for every process Cargo runs (.cargo/config.toml [env]),
has gatewayd take its uid from the owner of a pipe it makes (no dependency,
no unsafe), and hands over a toolkit shell.rs that compares resolved paths.
On a scratch tree the gate passes on titan and on talos with 936 tests, and
a wrong uid fails 7 gatewayd tests. Tasks 16 to 19 are renumbered 17 to 20.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-25 16:41:44 -07:00
committed by kyle
co-authored by Claude Opus 5.5
parent 0a7a95d709
commit 64190c3701
7 changed files with 223 additions and 15 deletions
+16 -11
View File
@@ -1,7 +1,7 @@
# M5a implementation plan: local memory
> **For the implementing model:** do not work from this file. The owner gives you one task file at
> a time (`01-…` to `19-…`). This file is the index for the owner and the reviewer.
> a time (`01-…` to `20-…`). This file is the index for the owner and the reviewer.
**Goal:** a new role, `memoryd`, owns the agent's memory: identity (`soul.md`, `memory.md`,
`user.md`, in every new session's prompt) and experience (`notes.md` and the session logs, found
@@ -64,13 +64,14 @@ the skeletons were cut (tip T25).
| 13 | `13-loopd-memory.md` | the block, the core tools, `session_updated` | `memory.rs`; `baseline.rs`, `pointers.rs`, `channel.rs` updated | reference; 6 mutations caught |
| 14 | `14-bxctl-memory.md` | `bxctl reindex`, `bxctl memory` | `cli_memory.rs` | reference; 5 mutations caught |
| 15 | `15-soul-and-device.md` | the starter soul; device checks with `memoryd` | `device.rs` updated, `support/memoryd.rs` | reference; `make verify-device` on straylight |
| 16 | `16-memoryd-no-slicing.md` | the day and the month with `get`, not a slice (review nit) | the existing ones | reference |
| 17 | `17-repeated-code.md` | repeated error lines written once (review nit) | the existing ones | reference; 4 mutations caught |
| 18 | `18-no-forged-headers.md` | a note cannot forge a `notes.md` header (review finding) | `forgery.rs`; `memory_args.rs`, `notes.rs` updated | reference; 4 mutations caught |
| 19 | `19-review-ids.md` | a staged write never reuses an id (review finding) | `review_ids.rs` | reference; 2 mutations caught |
| 16 | `16-macos-gate.md` | the gate passes on macOS: tests use /tmp, `gatewayd` finds its uid without `/proc` | `shell.rs` updated | reference; gate on titan and talos; 1 mutation caught (7 tests) |
| 17 | `17-memoryd-no-slicing.md` | the day and the month with `get`, not a slice (review nit) | the existing ones | reference |
| 18 | `18-repeated-code.md` | repeated error lines written once (review nit) | the existing ones | reference; 4 mutations caught |
| 19 | `19-no-forged-headers.md` | a note cannot forge a `notes.md` header (review finding) | `forgery.rs`; `memory_args.rs`, `notes.rs` updated | reference; 4 mutations caught |
| 20 | `20-review-ids.md` | a staged write never reuses an id (review finding) | `review_ids.rs` | reference; 2 mutations caught |
At the end of task 15: 936 tests (854 before task 01); tasks 16 and 17 change no behaviour and
keep 936; at the end of task 18, 939; at the end of task 19, 941. Each task's count was checked by running
At the end of task 15: 936 tests (854 before task 01); tasks 16 to 18 add no test and
keep 936; at the end of task 19, 939; at the end of task 20, 941. Each task's count was checked by running
the gate at its end state on its own.
## Changes during the run
@@ -92,14 +93,18 @@ the gate at its end state on its own.
are rustfmt-clean. The attempt is saved in `.state/runs/M5a/04-attempt-2/`. Resume from task
04. The measurements behind this are in `docs/research/2026-09-24-chat-template-tokens.md`,
added after the run.
- 2026-09-24, after the review: tasks 16 and 17 clean up the review's nits. Task 18 closes a hole
- 2026-09-24, after the review: tasks 17 and 18 clean up the review's nits. Task 19 closes a hole
the review found in the spec and the reference alike: a note's text could hold a line shaped like
a `notes.md` header, so an untrusted session could plant a `moved from memory.md` entry that
`recall` showed as identity. The spec was changed (`4ae827a`, section 3). Since task 18 hands
`recall` showed as identity. The spec was changed (`4ae827a`, section 3). Since task 19 hands
over new versions of two given tests, task 02's `memory_args.rs` is now `memory_args.rs-task02`
and task 06's `notes.rs` is now `notes.rs-task06`. Task 19 fixes review ids: counting only the
and task 06's `notes.rs` is now `notes.rs-task06`. Task 20 fixes review ids: counting only the
waiting writes gave a write staged after an accepted one the accepted one's id, and the write
was lost. Resume from task 16.
was lost.
- 2026-09-24, later: the work moved to titan (macOS) while talos's disk is replaced, and there
the gate failed for reasons older than M5a: socket paths under macOS's long `$TMPDIR`,
`gatewayd` reading `/proc/self`, and `/tmp` being `/private/tmp`. Task 16 makes it pass on
both; the review's tasks moved to 17 to 20. Resume from task 16.
## Running it