# Scratchpad — RI-050 orchestrator (jarvis, dragon-lin)

Mission: alpha 0.0.50 release-integrity floor. Issue #1275. Base `next` @ 476db12b.
Design SSOT: jarvis-brain `docs/plans/2026-08-16_mosaic-stack-sdlc-protocol.md` (SDLC-D-033..038).

## Mode (Jason's directives)

- Orchestrator: jarvis (this session, dragon-lin). NOT mos-claude; work stays on this host.
- Workers: local pi headless — `pi --model zai/glm-5.3:high -p` in the card's worktree, tools read,bash,edit,write.
- Delegation override of stack AGENTS.md `agent` column: rows carry `pi-glm-5.3` (outside cron table so no auto-claim).
- Target branch: `next`. Cards branch from `origin/next`, squash-merge via PR.

## Operational constraints (measured this session)

- Main checkout at `/home/jwoltje/src/mosaic-stack` is a dirty diverged `main` (ahead 1139/behind 711) — NEVER touched. All work in `/home/jwoltje/src/mosaic-stack-worktrees/<branch>`.
- Disk: /home 187G free. /tmp only 8.7G — keep pnpm stores/node_modules under /home.
- `main` and `next` have DIVERGED; PRs target `next`.
- Identity: pin `GITEA_LOGIN=mosaicstack-jarvis` for all wrapper ops. Issue #1275 verified authored by @jarvis.
- `ci-queue-wait.sh` on this host is fail-open (board: fix #1032 not installed) — substitute SHA-status checks via `/commits/{sha}/status` and diff failing step names.
- CI on PRs runs `pull_request` pipelines (any branch) incl. ci-postgres service. Push CI runs on main only; publish runs on push/tag to next + manual.
- Wrapper gaps on this host per board (7 gaps; e.g. no pr-review-list, issue-assign broken, pr-merge makes no trailers): verify outcomes by reading back provider state, never trust rc alone.
- Publish pipeline currently: install → build → publish-npm/publish-next-npm (+image). No verify. CI steps: install, sanitization, upgrade-guard, typecheck, lint, format, test, ci-postgres.

## Budget

Soft cap 250K. Projected 190K across 10 cards. Track per-card used vs estimate in TASKS.md notes.

## Progress log

- 2026-08-16 23:52 — Issue #1275 created (@jarvis verified).
- 2026-08-16 23:5x — Bootstrap branch `docs/ri-050-mission-bootstrap` from origin/next@476db12b; PRD section + TASKS.md + this scratchpad written. RI-0-001 in-progress.

## Wave 1 dispatched (2026-08-17 00:35)

- RI-1-001 worker: pi glm-5.3:high, pid 2322125, worktree ri-1-001, log /var/tmp/ri-050/ri-1-001-run.log
- RI-2-001 worker: pi glm-5.3:high, pid 2322126, worktree ri-2-001, log /var/tmp/ri-050/ri-2-001-run.log
- Gotcha recorded: pi has no -f flag (that's pi-do.sh); pass brief as positional message. First launch died "Unknown option: -f" — relaunched.
- CI lane: PR #1276 (bootstrap) fails `test` at base like every next PR — fred's green #1270 unblocks (comms sent 2026-08-17T05:21Z, `comms/20260817T052148Z__from-jarvis__650fe8.md`). Merge gate for all RI PRs queues behind #1270.
- Live RI-N1 evidence posted to #1275 (comment 22915): pipeline 2439 publish-next-npm SUCCESS beside build-gateway FAILURE.

---

# HANDOFF — RI-050 continuation (written 2026-08-17 ~08:45 UTC, jarvis/dragon-lin)

You are taking over the alpha 0.0.50 release-integrity workstream in place. Everything you
need is on the remote. Read this whole file, then `docs/release-integrity/TASKS.md` (same
branch), then the PRD section (`docs/PRD.md` § Release Integrity Workstream, same branch).

## Identity / mode

- Orchestrator identity: `jarvis` (dragon-lin). You continue as the RI-050 orchestrator under
  whatever identity Jason gives you — if you are NOT jarvis, say so in comms and PR bodies.
- Jason's standing directives for this mission: work happens on THIS repo (mosaicstack/stack),
  PRs target `next` (NOT main), workers are local pi headless sessions on
  `zai/glm-5.3:high`. Do not hand this to mos-claude. Do not borrow other seats' lanes.
- All wrapper ops: pin `GITEA_LOGIN=mosaicstack-jarvis` (issue #1275 was verified authored by
  @jarvis; keep identity consistent or verify yours with issue-view and READ BACK user.login).
- CI substitution rule (this host's ci-queue-wait.sh is fail-open; fix #1032 not installed):
  judge CI by SHA-status via `/api/v1/repos/mosaicstack/stack/commits/{sha}/status` or the
  woodpecker API (`pipeline-status.sh -r mosaicstack/stack -n N -f json`), and DIFF THE
  FAILING STEP NAMES rather than trusting rc.

## Mission state at handoff

Mission: alpha 0.0.50 release-integrity floor. Issue #1275 (open, has live-evidence comment).
Decisions SDLC-D-033..038 live in jarvis-brain
`docs/plans/2026-08-16_mosaic-stack-sdlc-protocol.md` (normative text also mirrored in the
PRD section on this branch, so this repo is self-sufficient).

Base: `origin/next` @ 476db12b. NOTE: `main` and `next` have DIVERGED — never base on main.

Branches (all pushed, all clean trees):

- `docs/ri-050-mission-bootstrap` @ 5114faa2 → PR #1276 (open, mergeable) — bootstrap docs +
  this scratchpad + TASKS.md DAG. STATUS: CI red on `test` only, which is the known lane-wide
  failure (see blocker below); own prettier issue already fixed.
- `feat/ri-050-publish-gate` @ 0aa5ed35 → PR #1277 (open, mergeable) — RI-1-001 COMPLETE
  (worker reported success, orchestrator review PASSED: verify step asserts CI_COMMIT_SHA ==
  git rev-parse HEAD then runs canonical `pnpm verify:release`; every publish/image step
  depends_on verify directly, confirmed by parsing the DAG: publish-npm, publish-next-npm,
  build-gateway/appservice/web all -> [build, verify]; invariant test
  scripts/verify-release.test.mjs passes 7/7 locally with negative fixtures). CI: same known
  lane-red `test` step only.
- `fix/ri-050-forge-fail-closed` @ 99b8f6ea → PR #1278 (open, mergeable) — RI-2-001 worker
  reported success (typed `FORGE_*` capability errors, --simulate typed simulated everywhere,
  vacuous true/echo gates replaced, closed ForgeOutcome set, 116 tests green incl. 16 new).
  ORCHESTRATOR REVIEW NOT YET DONE — your first job. Review the diff
  (1391 insertions across forge src), check the fail-closed paths and that simulated
  results cannot satisfy any consumer, run `pnpm --filter @mosaicstack/forge test`.

## The one blocker

Every `next` PR pipeline is red on ONE assertion:
`packages/mosaic/framework/tools/fleet/test-start-agent-session.sh:103` ("host provides 'pi'
in the system path"). Pre-existing at base; affects PRs #1276/#1277/#1278 identically.
fred's PR #1270 ("unblocks every PR on next") is green and open — it is HIS to merge; do not
merge it yourself. jarvis sent comms (`comms/20260817T052148Z__from-jarvis__650fe8.md` in
jarvis-brain) asking merge timing; no reply yet as of handoff. Merge gates for ALL RI PRs
queue behind #1270 landing. Until then: review/develop freely, merge nothing that needs the
green gate (docs-only #1276 arguably could merge red-lane with Jason's explicit call — ask,
don't assume).

## Remaining DAG (docs/release-integrity/TASKS.md is canonical)

Wave 2 (next): RI-2-002 MACP fail-closed (brief pattern: mirror RI-2-001 for
packages/macp/src/gate-runner.ts — empty commands, stub executors, unimplemented CI-provider
gates fail closed; explicit simulate) and RI-4-001 PRD authority (one PRD service;
@mosaicstack/prdy docs/prdy authoritative via `mosaic mission --plan`; `mosaic prdy` routes
or becomes named Markdown adapter; mission<->PRD linkage persists — see PRD RI-N3).
Wave 3: RI-3-001 probe inventory (docs), RI-5-001 web stale-safety.
Wave 4: RI-1-002 negative-control tests, RI-3-002 TS evaluator absorbs shell probes.
Final: RI-V-001 evidence pack (real green next publish run post-gate + all cards verified).

## Worker mechanics (measured, reuse)

- Dispatch: create worktree `git -C /home/jwoltje/src/mosaic-stack worktree add
/home/jwoltje/src/mosaic-stack-worktrees/<id> -b <branch> origin/next`, write a brief to
  /var/tmp/ri-050/, then run from INSIDE the worktree:
  `pi -p --no-session --model zai/glm-5.3:high --tools read,bash,edit,write "$(cat brief.md)"`
  (pi has NO -f flag — pass the brief as a positional message; first dispatch died on that).
- Briefs for 1-001/2-001 are at /var/tmp/ri-050/ on dragon-lin (may not survive; the
  pattern is fully described above and in TASKS.md).
- Briefs must carry: worktree path, branch, base, requirements, known base-red list (so the
  worker doesn't chase it), gates to run, PR creation command with GITEA_LOGIN pin, "do NOT
  merge, do NOT touch docs/TASKS.md", and the JSON report format.
- Verify worker claims: read the PR, run their tests yourself, parse pipeline step names.

## Do-not-touch

- Main checkout at /home/jwoltje/src/mosaic-stack (dirty diverged main) — never touch.
- fred's open PRs (#1270 and others) — review evidence welcome, merging his is not yours.
- Other RI PRs' authors' lanes: #1277/#1278 are yours to gate and merge ONCE lane is green
  and review is recorded.
- Never `--no-verify`; never bypass the wrapper-fails-closed rule (wrapper failure ⇒
  `blocked + report exact command + stop`).

## Session-restore command sequence

1. `git -C /home/jwoltje/src/mosaic-stack-worktrees/ri-050 fetch origin --prune`
2. Read this file + `docs/release-integrity/TASKS.md` + PRD section.
3. Check PR states (#1270, #1276, #1277, #1278) and lane CI (SHA-status per above).
4. Review RI-2-001 (PR #1278) if not yet done; then dispatch wave 2.

— jarvis, 2026-08-17

---

# CONTINUATION — fargo (sb-it-1-dt)

Orchestrator seat is now **fargo** on sb-it-1-dt (Jason, 2026-08-17): Claude seat, worktree discipline
per fred's ruling (`~/agent-work/<slug>`, create → work → commit → push → remove as one act; the
helper's `/src` refusal is a web1 convention, does not bind here). fred supports; lane rulings are
his. Workers remain local pi `zai/glm-5.3:high` + limited Claude per Jason.

## 2026-08-17 — RI-2-001 independent review DONE

- **PR #1278 APPROVED** (Gitea review 172, pinned to head 99b8f6ea). Executed evidence, not read-only:
  forge suite 116/116 at head (matches PR claim), forge lint green, forge typecheck green after
  building `@mosaicstack/macp` dist (TS2307 on bare `pnpm install --frozen-lockfile` is a
  minimal-install build-order artifact — the macp import is type-only, vitest passes unbuilt; CI
  installs build workspace deps, hence green there), **workspace typecheck 45/45 at head**,
  consumer sweep: no external type consumers of RunManifest/StageStatus/ForgeTaskResult/
  TaskExecutor; only importer of the package is packages/mosaic via registerForgeCommand
  (smoke test asserts registration/help only — cannot break). Digest gate (shaggy's) before==after
  with both-arm reactivity controls.
- CI red on #1276/#1277/#1278: lane-wide `test` failure only
  (test-start-agent-session.sh:103, fred's guard mis-wired; #1270 unwires it). Fred measured log
  content: one real byte-identical failure per pipeline (2456/2457/2458); 13 of ~14 `FAIL` grep
  hits are passing fail-loud test NAMES. **The red carries no information about the RI changes.**
- Non-blocking finding: README L141-143 + skills/mosaic-forge/SKILL.md document bare
  `mosaic forge run`/`resume`, which now exits 1 FORGE_NO_EXECUTOR — fast-follow docs touch.
- **Identity incident, ruled on by fred:** review 172 recorded under shared host principal
  mos-dt-0, not fargo. Mechanism (measured, wrapper source): pr-review.sh resolves its acting login
  from the tea login list only; no fargo tea login on this host → silent host-default fallback;
  MOSAIC_GIT_IDENTITY is only read in detect-platform.sh get_gitea_token's fallback arm, never
  reached. Exact-id read-back verifies against the writing token, so it passed while attribution
  was wrong — durable-provenance machinery proves the write, not the seat. Fred's ruling: review
  172 stands (substance/verdict/pin correct; label wrong); NO re-approval (one approval,
  annotated, is the stronger record); fred posts the provenance correction under @fred with
  --login fred-ms (hard-fail path); no fargo tea login ever (freeze + Jason's to authorize);
  tooling gap filed by fred. Also explains (does not reopen) #1228's mos-dt-0 attribution.
- Merge gate: all RI PRs queue behind fred's green #1270 (Jason's call).

## Next

1. Wave 2 dispatch: RI-2-002 (MACP fail-closed, mirror RI-2-001 pattern for
   packages/macp/src/gate-runner.ts) + RI-4-001 (PRD authority). Two parallel workers max.
2. Docs fast-follow (README + mosaic-forge skill) — fold into #1276 or a tiny docs card.
3. RI-V-001 evidence at the end.

— fargo, 2026-08-17

---

# RESUMPTION + DAILY-HANDOFF PROTOCOL (Jason, 2026-08-17)

Orchestrator seat is back with **jarvis** (dragon-lin). Expect daily handoff between jarvis
and fargo. Protocol (both seats, every handoff):

1. **This file is the shared mission log.** Append a dated section per session: state
   measured, actions taken, PR/review states, next actions. Never rewrite prior sections.
2. **TASKS.md stays current within one session** — status, PR number in notes, review
   evidence. Stale rows are handoff debt.
3. **Cross-review rule (SDLC-D-011 in practice):** the reviewing seat must differ from the
   producing seat. jarvis reviews fargo-dispatched PRs, fargo reviews jarvis-dispatched
   PRs. Producers are always pi workers; dispatching seats verify before push; the other
   seat records the Gitea review.
4. Handoff = append here + push + (optional) issue #1275 comment if a decision changed.

## RESUMED — jarvis/dragon-lin, 2026-08-17 (afternoon)

- Measured: next = 8199261c (#1270 merged — lane unblocked for new PRs). #1293/#1294
  (fargo, wave 2) CI-green, mergeable, no recorded reviews. #1276/#1277/#1278 still based
  on 476db12b with stale red CI → need rebase onto 8199261c. #1278 review pinned to old
  head 99b8f6ea by @mos-dt-0 (fargo's, mis-attributed per his note) — rebase will dismiss
  it; re-approval must come from fargo/fred (author is @jarvis, cannot self-approve).
- Live evidence #2: push pipeline 2462 (the #1270 merge itself) ran publish-next-npm
  SUCCESS beside build-gateway FAILURE again.
- Plan: rebase the three original branches; independently review #1293/#1294; merge order
  once green+reviewed: #1276 (docs) → #1277 (publish gate) → #1278/#1293/#1294 (code).
  After #1277 merges, watch the next push pipeline prove the verify gate live.
- fargo's non-RI PRs (#1291/#1296/#1297/#1281) stay strictly his lane.

## jarvis session 2026-08-17 (evening) — reviews, rebases, merge plan

- Rebased #1276/#1277/#1278 onto 8199261c (heads 59e2c460 / 46784c8d / 4917df1f);
  invariant tests 7/7 and forge 116/116 re-run green at new heads. #1270 touched
  test-enumeration-exclusions.txt + package.json, NOT ci.yml — no semantic overlap with
  #1277's ci.yml changes (checked, was a real concern).
- Independent reviews recorded: #1293 APPROVED (review 173; macp 109/109; fail-closed paths
  + aggregate state machine verified), #1294 APPROVED (review 174; prdy 20/20 + command
  specs 9/9; single-writer + linkage persistence + labeled export + conflict-aware import
  verified). Note: 19 unrelated mosaic suites fail on bare minimal install (known workspace
  build-order artifact, documented by fargo) — not this change.
- Measured: `next` has NO branch protection (API: only main listed). Cross-seat review
  discipline is protocol-enforced, not Gitea-enforced. Flagged to fargo for Jason: direct
  pushes to next trigger ungated publishes; protection is Jason's call (#1231 adjacent).
- Merge order planned: #1276 (docs-only — no publish run) -> #1277 (first gated publish)
  -> #1278 -> #1293 -> #1294. Sent fargo review requests with pinned head SHAs
  (comms/20260818T011932Z__from-jarvis__a9c02b.md). Not merging #1293/#1294 before my three
  clear fargo's review — order optimality beats speed; every pre-#1277 merge publishes ungated.
- CI on the three rebased heads: pending at time of this entry.
