salvage 2026-11-06: uncommitted work from scratch/darkwing-scratch/r162/wt (disk cleanup #824)

This commit is contained in:
mos committed 2026-11-06 10:04:13 -06:00
1 parent cfde62f9ff
commit 1e92e2dc33
5 files changed
+1601 -42

No files matched your search

+59 -33
View File
@@ -342,43 +342,69 @@ reports checkout or copy identity and refactor drift, and writes nothing.
### Pinned stack update
```
scripts/stack-release.sh adopt BUSINESS
scripts/stack-release.sh activate ID BUSINESS [--pm] [--migrate] [--timeout S] [--plan]
scripts/stack-release.sh rollback BUSINESS [--restore ACTIVATION [--events N]] [--timeout S] [--plan]
scripts/stack-release.sh status BUSINESS
common options: --copies DIR, --bin DIR
```
This is an operator plan, not an action agents run. Both reviews and the
landing precede it. Mos grants each live step first. A bus restart ends
running sessions; do this only when no PM turn is in flight.
landing come before it. Mos grants each live run first. A bus restart ends
running sessions, so run it only when no PM turn is in flight. `--plan` and
`status` change nothing and need no go.
1. Make the pushed target copy with `stack-copy.sh copy COMMIT` and note
its full id. Before the first update, preserve the current Q81 CLI wrapper
(bytes and mode), bus and Console unit files and drop-ins, and the effective
WorkingDirectory/ExecStart output from each status command. Record the bus's
--claude pin and the Console's preview/send flags. Keep the bus pm.conf and
the existing Console copy or checkout: the first rollback needs them.
On later updates, also record the prior shared copy's full id.
2. With Mos's go, stop the Console, then stop the bus.
3. Mos removes overriding bus drop-ins identified by status. The first
update removes `~/.config/systemd/user/[email protected]/pm.conf`.
Reload systemd after removal; keep unrelated environment drop-ins.
4. With Mos's go, install the bus with `bus-service.sh install --copy ID --pm`
and its existing --claude pin, then the Console with
`webui-service.sh install --copy ID` and its existing preview/send flags.
5. With Mos's go, run `stack-copy.sh wrapper ID` to switch the human CLI.
6. Mos starts the bus first, then the Console. Read `stack-copy.sh check`,
both service status commands, Console `/healthz` and the canonical
`scripts/mosaic launches list`; the latter must show the PM.
7. Jason's plain `mosaic talk pm "..."` must print sent and a reply before
#225 closes. Keep the receipts for the three paths and reply.
The script keeps `<dataRoot>/state/stack-active.json` (the live copy, business,
PM flag, claude pin, Console flags, schema and activation) and appends every
run to `<dataRoot>/state/stack-activation-log.jsonl`: a `started` line, then
one final line with `result` `ok`, `refused`, `gate-failed` or
`rollback-failed`. A refusal exits 3, a gate failure that rolled back exits 1,
a failed rollback exits 2, usage exits 4. Only one run at a time holds
`state/stack-release.lock` (`run-locked`).
The first rollback restores the pre-update mixed setup, which has no shared
copy id. Each live step needs Mos's go: stop the Console then the bus;
reinstall the checkout bus unit without --copy or --pm, retaining its saved
--claude pin; restore the saved pm.conf and other bus drop-ins; restore the
saved Console unit and drop-ins pointing to its original checkout or
mosaic-console copy; restore the saved Q81 wrapper bytes and mode; reload
systemd; start the bus then the Console. Check their effective paths against
the saved status output, Console /healthz and the PM launch. The shared-copy
check is expected to refuse this restored mixed setup; #225 remains open.
1. Once per host, `adopt BUSINESS` records the running stack as the pointer:
the copy `stack-copy.sh check` reports, the bus unit's `--pm` and
`MOSAIC_CLAUDE_BIN`, the Console's flags without `--checkout`, and the
copy's schema version. It refuses when the check fails, the bus unit has no
`MOSAIC_CLAUDE_BIN` or a pointer exists.
2. Make the pushed target copy with `stack-copy.sh copy COMMIT` and note its
full id.
3. Run `activate ID BUSINESS --plan` and take the output to Mos. It names the
store's schema and the target's, any migration with `--migrate` and the
decision 96 condition 2 line (Jason present), the commits the run adds,
and the three install commands. It refuses `copies-unrelated` when neither
copy is an ancestor of the other.
4. Mos removes any bus drop-in that overrides ExecStart or WorkingDirectory;
`activate` refuses `drop-in-override` and names the file.
5. With Mos's go, `activate ID BUSINESS`, plus `--migrate` when the plan
says so. Before it stops anything, it refuses a missing, unpushed or
unreadable copy, a busy `mosaic-bus@` instance, and unit flags that differ
from the pointer. Then it saves the unit files, drop-ins and wrapper under
`state/stack-rollback/<activation>/`, stops the Console then the bus, and
reads the stopped store. A `-wal` or `-shm` beside it refuses
`store-unclean` and leaves the store alone. A migration takes an
owner-only backup under `<dataRoot>/backups/stack/<activation>/` first.
It installs the bus, the Console and the wrapper from the pointer's flags,
starts the bus then the Console, and runs the gate: both units active, a
live bus host for this start, Console `/healthz`, `stack-copy.sh check`
and, with `--pm`, exactly one `launched` journal line for a live run of
this start. A pass writes the pointer.
6. A gate failure puts back the saved units and wrapper, restores the backup
when a migration ran, keeps the store it replaced as
`bus.post-attempt-<stamp>`, starts the old copy and gates it. If that gate
fails too, both units stay stopped, the log says `rollback-failed`, and
Jason or Mos settles it from the rollback set the message names.
7. `rollback BUSINESS` returns to the copy before the pointer's, taken from
the log. When the schemas differ it needs `--restore ACTIVATION`; events
written after that backup need `--events N` with the count it prints, and
Jason decides first.
8. Jason's plain `mosaic talk pm "..."` must print sent and a reply. Keep the
`status` output with the receipts.
Later rollback repeats steps 2-6 with the prior shared copy's full id, each
live step again approved by Mos. Nothing prunes copies or removes mosaic-old.
A `started` line with no final line is an interrupted run. `status` shows
it, and `adopt`, `activate` and `rollback` refuse until Jason or Mos settles
it. Nothing prunes copies, rollback sets, backups or post-attempt stores.
After a switch, the human commands and `--tester` work only through `mosaic`
on PATH; the checkout's `scripts/mosaic` exits 3 with `human-required` or