Design + re-vendor: move push-mode landing instruction into harness LANDING_RULES, add dev-factory LANDING=pr interim rail (prereq for #193) #220

Closed
opened 2026-10-15 04:55:55 +00:00 by matou-build-agent · 1 comment

Filed from work on #193 (worker claim run=21817). #193's core cannot land as an agent iteration: three of its acceptance clauses require editing protected paths (protected-paths-lib.sh fingerprints all of .sandcastle/ and rolls back any create/change/delete), and the prompt change is factory-wide design work. This issue carries that machinery/design slice so a session can land it; once it lands, #193's remaining harness mechanics (host-side landing_land_worker_branch, run-swarm ordering, close-report two-phase gate) become implementable by an ordinary agent iteration.

Symptom (why #193 can't proceed from root files)

The push-mode "step 6" instruction a worker follows — git push origin HEAD:refs/heads/main — does not live in a harness skeleton. It is step 6 of the per-consumer workflow-verify enrichment (.sandcastle/prompt-enrichments/workflow-verify.md), which is a protected path in this repo and pull-only in product repos. The harness policy_landing_guidance block (policy-lib.sh, rendered as {{LANDING_RULES}}) merely says, for push mode, "land exactly as the workflow above says" — i.e. it defers to that enrichment step.

Consequences:

  • #193 AC#1 ("the prompt no longer instructs a worker to push to main") is impossible to satisfy from root files alone — the instruction is enrichment-resident.
  • Rewriting only policy_landing_guidance to describe a branch-then-host-land flow would make the rendered prompt contradict the still-present enrichment step 6, and that text reaches every consumer at the next pin bump (CLAUDE.md blast-radius rule, high-blast-radius prompt/enrichment work).
  • #193 AC#5 (set dev-factory's .sandcastle/swarm-policy.sh to LANDING=pr as the interim rail) is a protected-path creation — rolled back by the outcome boundary, so no agent run can make it stick.

Proposed machinery/design change (session)

  1. Decide where the push-mode landing instruction lives. Recommended: make {{LANDING_RULES}} (policy_landing_guidance in policy-lib.sh) own the full push-mode landing instruction (push to a per-run worker branch sandcastle/worker/<run>-<issue>, never main; the host lands after verify), and remove the push step from the workflow-verify enrichment so there is one source of truth. This is a prompt-rendering contract change touching the enrichment of every consumer — design work, re-rendered + re-vendored per consumer.
  2. Re-render + re-vendor dev-factory's own .sandcastle/ so the running copy carries the new worker instruction (onboarding/onboard.sh render-prompts + vendor .sandcastle <sha>).
  3. Create dev-factory's .sandcastle/swarm-policy.sh with LANDING=pr as the interim rail (two-way door, one policy file — triage already ruled this under ADR 0174 on #193) until the host-land mechanics land.
  4. #208 coupling: the host-side protected-path enforcement #193 relies on is PP_ENFORCE, default OFF today (verify-lib.sh). Flipping it on is the companion change #193 names ("land it in step"); sequence it with this re-vendor.

After this lands

#193's remaining, purely-harness mechanics become an ordinary agent iteration:

  • landing-lib.sh: host promotes the worker branch to main only after verify_workers + verify_protected_paths (PP_ENFORCE=1) + the pinned host tests; a protected-path touch → NOT landed, rescue parked, run red (tests/landing-lib-test.sh).
  • run-swarm.sh: verify before any push to main (tests/run-swarm-landing-test.sh).
  • close-report gate 1: reachability from the worker-branch head pre-land, from main post-land.

Context

  • Worked ticket: #193.
  • Out of scope (as #193): reviewer agent #197, server-side branch protection #194, healer push path #203.
_Filed from work on #193 (worker claim run=21817). #193's core cannot land as an agent iteration: three of its acceptance clauses require editing **protected paths** (`protected-paths-lib.sh` fingerprints all of `.sandcastle/` and rolls back any create/change/delete), and the prompt change is factory-wide design work. This issue carries that machinery/design slice so a session can land it; once it lands, #193's remaining harness mechanics (host-side `landing_land_worker_branch`, run-swarm ordering, close-report two-phase gate) become implementable by an ordinary agent iteration._ ## Symptom (why #193 can't proceed from root files) The push-mode "step 6" instruction a worker follows — `git push origin HEAD:refs/heads/main` — does **not** live in a harness skeleton. It is step 6 of the **per-consumer `workflow-verify` enrichment** (`.sandcastle/prompt-enrichments/workflow-verify.md`), which is a protected path in this repo and pull-only in product repos. The harness `policy_landing_guidance` block (`policy-lib.sh`, rendered as `{{LANDING_RULES}}`) merely says, for push mode, "land exactly as the workflow above says" — i.e. it defers to that enrichment step. Consequences: - #193 AC#1 ("the prompt no longer instructs a worker to push to main") is **impossible to satisfy from root files alone** — the instruction is enrichment-resident. - Rewriting only `policy_landing_guidance` to describe a branch-then-host-land flow would make the rendered prompt **contradict** the still-present enrichment step 6, and that text reaches **every consumer at the next pin bump** (CLAUDE.md blast-radius rule, high-blast-radius prompt/enrichment work). - #193 AC#5 (set dev-factory's `.sandcastle/swarm-policy.sh` to `LANDING=pr` as the interim rail) is a protected-path **creation** — rolled back by the outcome boundary, so no agent run can make it stick. ## Proposed machinery/design change (session) 1. **Decide where the push-mode landing instruction lives.** Recommended: make `{{LANDING_RULES}}` (`policy_landing_guidance` in `policy-lib.sh`) own the *full* push-mode landing instruction (push to a per-run worker branch `sandcastle/worker/<run>-<issue>`, never main; the host lands after verify), and **remove the push step from the `workflow-verify` enrichment** so there is one source of truth. This is a prompt-rendering contract change touching the enrichment of every consumer — design work, re-rendered + re-vendored per consumer. 2. **Re-render + re-vendor dev-factory's own `.sandcastle/`** so the running copy carries the new worker instruction (`onboarding/onboard.sh render-prompts` + `vendor .sandcastle <sha>`). 3. **Create dev-factory's `.sandcastle/swarm-policy.sh` with `LANDING=pr`** as the interim rail (two-way door, one policy file — triage already ruled this under ADR 0174 on #193) until the host-land mechanics land. 4. **#208 coupling:** the host-side protected-path enforcement #193 relies on is `PP_ENFORCE`, default OFF today (`verify-lib.sh`). Flipping it on is the companion change #193 names ("land it in step"); sequence it with this re-vendor. ## After this lands #193's remaining, purely-harness mechanics become an ordinary agent iteration: - `landing-lib.sh`: host promotes the worker branch to main only after `verify_workers` + `verify_protected_paths` (PP_ENFORCE=1) + the pinned host tests; a protected-path touch → NOT landed, rescue parked, run red (`tests/landing-lib-test.sh`). - `run-swarm.sh`: verify before any push to main (`tests/run-swarm-landing-test.sh`). - close-report gate 1: reachability from the worker-branch head pre-land, from main post-land. ## Context - Worked ticket: #193. - Out of scope (as #193): reviewer agent #197, server-side branch protection #194, healer push path #203.
Author
Member

Close report — #220 (worked by an interactive standing session under ADR 0174).

What landed

Two commits on origin/main:

  • 9930a2c — relocate the push-mode landing instruction into the harness {{LANDING_RULES}}; create dev-factory's .sandcastle/swarm-policy.sh = LANDING=pr; re-render the self-copy's .sandcastle/prompt.md; update tests + idss cutover fixtures; STATUS/journal/GOTCHAS 71.
  • 468ab80 — correct the STATUS/journal wording (the first commit wrongly said "Re-vendored"; see Ruling 2).

The design

policy_landing_guidance (policy-lib.sh, rendered as {{LANDING_RULES}}) is now the single source of truth for how a commit reaches main, in BOTH modes:

  • the push branch owns the full push-to-main instruction (incl. the #217 rebase-conflict re-test ladder), product-neutral — the token remote is derived from $FORGEJO_API at run time, no hardcoded host/repo (the enrichment's old git.matou.nz/Matou/… literal is gone);
  • the pr branch owns the land-pr.sh flow.

prompt_render_landing_rules no longer short-circuits a LANDING=pr repo to empty — it renders the (mode-independent) block for every repo. The per-consumer workflow-verify enrichment lost its Push step (Close renumbered to 6). Net effect: #193's AC#1 ("the prompt no longer instructs a push to main") is now editable from root files (policy-lib.sh) instead of the protected enrichment — which was the whole reason #193 could not proceed as an agent iteration.

Acceptance (ticket's 4 proposed items)

  1. Relocate push instruction into {{LANDING_RULES}}, remove from enrichment — DONE (9930a2c: policy-lib.sh, prompt-render-lib.sh, both workflow-verify enrichments).
  2. Re-render + re-vendor the self-copy — RE-RENDER done (.sandcastle/prompt.md committed; the running copy carries the new worker instruction NOW — the #217 per-repo-layer pattern). FULL RE-VENDOR (pin bump) deferred — see Ruling 2.
  3. Create .sandcastle/swarm-policy.sh = LANDING=pr — DONE and LIVE: the stale vendored .sandcastle/landing-lib.sh already branches on repo-level SWARM_POLICY_LANDING=pr (landing_push/landing_stage), so the interim rail is active in the running copy.
  4. PP_ENFORCE sequencing — RULED to stay OFF (Ruling 1).

Ruled by agent under ADR 0174 — veto anytime

Ruling 1 — PP_ENFORCE stays OFF (it flips WITH #193's host-land mechanics, not here). Two-way: revertible (one env default). Why not now: verify_protected_paths would roll back legitimate direct-to-main machinery work in every consumer still running machinery tickets directly (the hazard verify-lib.sh's own comment names) — the enforcement is only meaningful once #193 builds the worker-branch + host-land flow it gates. Proof: verify-lib.sh PP_ENFORCE default unchanged; #193's remaining mechanics carry the flip.

Ruling 2 — the FULL self-copy re-vendor (pin bump) is deferred to the coordinated human re-vendor. Two-way (revertible), and the operative outcome is already achieved via the per-repo-layer re-render (the #217 precedent). Why not forced here: a pin bump is all-or-nothing (it pins the whole manifest to one sha), and .sandcastle/ already lags origin/main across #200/#205/#217/#218/#228 — bumping to current would bundle #218's host-state cutover, which its own STATUS note says is "INERT until a human re-vendors + host-cron install on a clean /tmp" (a host-coordination op outside #220's scope). So the root policy-lib.sh/prompt-render-lib.sh + the new vendored tests reach the running copy at that coordinated re-vendor (GOTCHAS 4); until then the stale-rendered-prompt check stays a NOTE (advisory, never fails). Tracked in STATUS + docs/journal/2026-10-15-220.md.

Proof

Offline suite: my touched tests pass — onboard-lib 271, policy-lib 64, prompt-render-lib 41, worker-conflict-retest-prompt 6, docs-budget 3. The six suite reds (limit-lib/session-runner/claude-call-guards fp-keying #200, fleet-tui/tui account_fp+/tmp-marker #202/#205, git-cred-lib #195) are pre-existing on origin/main (verified against a clean origin/main worktree), none caused by this change.

Changed files: policy-lib.sh, prompt-render-lib.sh, tests/{policy-lib,prompt-render-lib,worker-conflict-retest-prompt}-test.sh, .sandcastle/prompt-enrichments/workflow-verify.md, .sandcastle/prompt.md, .sandcastle/swarm-policy.sh, onboarding/tests/fixtures/idss-prompts/{prompt-enrichments/workflow-verify.md,prompt.md}, STATUS.md, docs/GOTCHAS.md, docs/gotchas/71-*.md, docs/journal/2026-10-15-220.md.

#193's remaining mechanics (landing-lib.sh host-land, run-swarm.sh ordering, close-report two-phase gate) are now an ordinary agent iteration — re-arming it.

**Close report — #220 (worked by an interactive standing session under ADR 0174).** ## What landed Two commits on `origin/main`: - `9930a2c` — relocate the push-mode landing instruction into the harness `{{LANDING_RULES}}`; create dev-factory's `.sandcastle/swarm-policy.sh` = `LANDING=pr`; re-render the self-copy's `.sandcastle/prompt.md`; update tests + idss cutover fixtures; STATUS/journal/GOTCHAS 71. - `468ab80` — correct the STATUS/journal wording (the first commit wrongly said "Re-vendored"; see Ruling 2). ## The design `policy_landing_guidance` (`policy-lib.sh`, rendered as `{{LANDING_RULES}}`) is now the **single source of truth** for how a commit reaches `main`, in BOTH modes: - the **push** branch owns the full push-to-main instruction (incl. the #217 rebase-conflict re-test ladder), product-neutral — the token remote is derived from `$FORGEJO_API` at run time, no hardcoded host/repo (the enrichment's old `git.matou.nz/Matou/…` literal is gone); - the **pr** branch owns the `land-pr.sh` flow. `prompt_render_landing_rules` no longer short-circuits a `LANDING=pr` repo to empty — it renders the (mode-independent) block for **every** repo. The per-consumer `workflow-verify` enrichment lost its Push step (Close renumbered to 6). Net effect: #193's AC#1 ("the prompt no longer instructs a push to main") is now editable from **root files** (`policy-lib.sh`) instead of the protected enrichment — which was the whole reason #193 could not proceed as an agent iteration. ## Acceptance (ticket's 4 proposed items) 1. **Relocate push instruction into `{{LANDING_RULES}}`, remove from enrichment** — DONE (`9930a2c`: `policy-lib.sh`, `prompt-render-lib.sh`, both `workflow-verify` enrichments). 2. **Re-render + re-vendor the self-copy** — RE-RENDER done (`.sandcastle/prompt.md` committed; the running copy carries the new worker instruction NOW — the #217 per-repo-layer pattern). FULL RE-VENDOR (pin bump) deferred — see Ruling 2. 3. **Create `.sandcastle/swarm-policy.sh` = `LANDING=pr`** — DONE and LIVE: the stale vendored `.sandcastle/landing-lib.sh` already branches on repo-level `SWARM_POLICY_LANDING=pr` (`landing_push`/`landing_stage`), so the interim rail is active in the running copy. 4. **PP_ENFORCE sequencing** — RULED to stay OFF (Ruling 1). ## Ruled by agent under ADR 0174 — veto anytime **Ruling 1 — PP_ENFORCE stays OFF (it flips WITH #193's host-land mechanics, not here).** Two-way: revertible (one env default). Why not now: `verify_protected_paths` would roll back legitimate direct-to-main machinery work in every consumer still running machinery tickets directly (the hazard `verify-lib.sh`'s own comment names) — the enforcement is only meaningful once #193 builds the worker-branch + host-land flow it gates. Proof: `verify-lib.sh` `PP_ENFORCE` default unchanged; #193's remaining mechanics carry the flip. **Ruling 2 — the FULL self-copy re-vendor (pin bump) is deferred to the coordinated human re-vendor.** Two-way (revertible), and the operative outcome is already achieved via the per-repo-layer re-render (the #217 precedent). Why not forced here: a pin bump is all-or-nothing (it pins the whole manifest to one sha), and `.sandcastle/` already lags `origin/main` across #200/#205/#217/#218/#228 — bumping to current would bundle #218's host-state cutover, which its own STATUS note says is "INERT until a human re-vendors **+ `host-cron install` on a clean /tmp**" (a host-coordination op outside #220's scope). So the root `policy-lib.sh`/`prompt-render-lib.sh` + the new vendored tests reach the running copy at that coordinated re-vendor (GOTCHAS 4); until then the stale-rendered-prompt check stays a NOTE (advisory, never fails). Tracked in STATUS + `docs/journal/2026-10-15-220.md`. ## Proof Offline suite: my touched tests pass — `onboard-lib` 271, `policy-lib` 64, `prompt-render-lib` 41, `worker-conflict-retest-prompt` 6, `docs-budget` 3. The six suite reds (`limit-lib`/`session-runner`/`claude-call-guards` fp-keying #200, `fleet-tui`/`tui` `account_fp`+`/tmp`-marker #202/#205, `git-cred-lib` #195) are **pre-existing on `origin/main`** (verified against a clean `origin/main` worktree), none caused by this change. Changed files: `policy-lib.sh`, `prompt-render-lib.sh`, `tests/{policy-lib,prompt-render-lib,worker-conflict-retest-prompt}-test.sh`, `.sandcastle/prompt-enrichments/workflow-verify.md`, `.sandcastle/prompt.md`, `.sandcastle/swarm-policy.sh`, `onboarding/tests/fixtures/idss-prompts/{prompt-enrichments/workflow-verify.md,prompt.md}`, `STATUS.md`, `docs/GOTCHAS.md`, `docs/gotchas/71-*.md`, `docs/journal/2026-10-15-220.md`. #193's remaining mechanics (`landing-lib.sh` host-land, `run-swarm.sh` ordering, close-report two-phase gate) are now an ordinary agent iteration — re-arming it.
matou-build-agent 2026-10-15 08:57:16 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#220
No description provided.