ts-gate.sh install step lacks CI=true — pre-push TS gate fails closed in the sandbox #168

Open
opened 2026-09-27 16:24:49 +00:00 by matou-build-agent · 4 comments

Symptom

Every TypeScript-touching push in the sandbox is refused at the pre-push gate:

gate: TypeScript change detected — running the pinned eslint lint gate
[ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY] Aborted removal of modules directory due to no TTY
error: failed to push some refs

Hit while landing #166.

Cause

.sandcastle/ts-gate.sh (per-repo TS gate, #152) runs pnpm install --frozen-lockfile --prefer-offline without CI=true, then CI=true pnpm -r typecheck. In this sandbox pnpm 11.6.0 decides node_modules needs a purge and, with no TTY, aborts the install (exit 1) instead of prompting — so the gate fails closed on a legitimate push. Only the typecheck line carries CI=true. (GOTCHAS 23/24; the #151 GATE_TS_CMD workaround still bypasses it.)

Proposed fix

Prefix the install line in .sandcastle/ts-gate.sh with CI=true too (matching the typecheck line), or export CI=true at the top of the script. .sandcastle/ is a protected path, so a worker cannot make this edit in-run — it needs a session/machinery change.

Workaround (already used to land #166)

GATE_TS_CMD="'CI=true pnpm install --frozen-lockfile --prefer-offline; CI=true pnpm -r typecheck'" on the push.

Filed while on #166.

## Symptom Every TypeScript-touching push in the sandbox is refused at the pre-push gate: ``` gate: TypeScript change detected — running the pinned eslint lint gate [ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY] Aborted removal of modules directory due to no TTY error: failed to push some refs ``` Hit while landing #166. ## Cause `.sandcastle/ts-gate.sh` (per-repo TS gate, #152) runs `pnpm install --frozen-lockfile --prefer-offline` **without `CI=true`**, then `CI=true pnpm -r typecheck`. In this sandbox pnpm 11.6.0 decides node_modules needs a purge and, with no TTY, aborts the install (exit 1) instead of prompting — so the gate fails closed on a legitimate push. Only the typecheck line carries `CI=true`. (GOTCHAS 23/24; the #151 `GATE_TS_CMD` workaround still bypasses it.) ## Proposed fix Prefix the install line in `.sandcastle/ts-gate.sh` with `CI=true` too (matching the typecheck line), or `export CI=true` at the top of the script. `.sandcastle/` is a protected path, so a worker cannot make this edit in-run — it needs a session/machinery change. ## Workaround (already used to land #166) `GATE_TS_CMD="'CI=true pnpm install --frozen-lockfile --prefer-offline; CI=true pnpm -r typecheck'"` on the push. Filed while on #166.
Author
Member

Close-report (pr-mode) — advances #168. Ruled by agent under ADR 0002 — veto anytime.

Landed as PR #182 (closes #168, a human merges). NOT pushed to main.

What it lands. .sandcastle/ts-gate.sh (the per-repo TS pre-push gate from #152 — drift-safe, not in FACTORY_MANIFEST) now prefixes its install line with CI=true:

CI=true pnpm install --frozen-lockfile --prefer-offline
CI=true pnpm -r typecheck

Before, only the typecheck line carried CI=true; the bare install let pnpm 11.6.0 abort on a no-TTY node_modules purge (ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY, exit 1), failing the gate closed on legitimate TS pushes (GOTCHAS 4/24). The comment is extended to explain why both lines carry it.

Commit. 939e399 — .sandcastle/ts-gate.sh, plus STATUS.md (header + log) and docs/GOTCHAS.md (GOTCHAS 23 follow-on) in the same commit.

Proof (no TTY, this host).

  • ./.sandcastle/ts-gate.sh from an empty node_modules → install + all 6 projects typecheck → exit 0.
  • Real pre-push entrypoint gate_ts_stage "$PWD" (resolves to ts-gate.sh, precedence #2) → exit 0.
  • check-harness-drift.sh → OK (ts-gate.sh is not vendored).

Honest note on the red. The exact abort is a sandbox store-state condition; on this standing checkout pnpm 11.6.0 reconciled a matching store cleanly in every synthetic case I tried (foreign node_modules, missing .pnpm, flipped nodeLinker, fresh store-dir), so I could not re-trigger the abort here. The red is the field capture on #166 (quoted in this ticket) plus the documented hazard GOTCHAS 4/24; the fix is proven GREEN above and matches the stated rule.

Door. Two-way: a revertible one-line change to a non-vendored layer file, provable by the gate. The .sandcastle/ protection that blocks a worker is a session/standing matter, which this change is.

**Close-report (pr-mode) — advances #168.** Ruled by agent under ADR 0002 — veto anytime. **Landed as PR #182** (`closes #168`, a human merges). NOT pushed to `main`. **What it lands.** `.sandcastle/ts-gate.sh` (the per-repo TS pre-push gate from #152 — drift-safe, not in `FACTORY_MANIFEST`) now prefixes its install line with `CI=true`: ``` CI=true pnpm install --frozen-lockfile --prefer-offline CI=true pnpm -r typecheck ``` Before, only the typecheck line carried `CI=true`; the bare install let pnpm 11.6.0 abort on a no-TTY `node_modules` purge (`ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY`, exit 1), failing the gate closed on legitimate TS pushes (GOTCHAS 4/24). The comment is extended to explain why both lines carry it. **Commit.** `939e399` — `.sandcastle/ts-gate.sh`, plus `STATUS.md` (header + log) and `docs/GOTCHAS.md` (GOTCHAS 23 follow-on) in the same commit. **Proof (no TTY, this host).** - `./.sandcastle/ts-gate.sh` from an empty `node_modules` → install + all 6 projects typecheck → exit 0. - Real pre-push entrypoint `gate_ts_stage "$PWD"` (resolves to `ts-gate.sh`, precedence #2) → exit 0. - `check-harness-drift.sh` → OK (`ts-gate.sh` is not vendored). **Honest note on the red.** The exact abort is a sandbox store-state condition; on this standing checkout pnpm 11.6.0 reconciled a matching store cleanly in every synthetic case I tried (foreign `node_modules`, missing `.pnpm`, flipped `nodeLinker`, fresh store-dir), so I could not re-trigger the abort here. The red is the field capture on #166 (quoted in this ticket) plus the documented hazard GOTCHAS 4/24; the fix is proven GREEN above and matches the stated rule. **Door.** Two-way: a revertible one-line change to a non-vendored layer file, provable by the gate. The `.sandcastle/` protection that blocks a worker is a session/standing matter, which this change is.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: state → ready-for-session. The ticket carried only bug and no state role, so it was untriaged on state. The worker's close-report above opened PR #182 and flagged this as a session/machinery change.

Why it's a two-way door: a label change, fully revertible; no credentials, no security widening, no spend. Not on the one-way-door list.

What proves it: docs/agents/issue-tracker.md — machinery changes under .sandcastle/ are filed ready-for-session. The fix is in .sandcastle/ts-gate.sh (a protected path) and PR #182 (closes #168) is open for a human session to merge.

> *This was generated by AI during triage.* Ruled by agent under ADR 0174 — veto anytime. **Ruling:** state → `ready-for-session`. The ticket carried only `bug` and no state role, so it was untriaged on state. The worker's close-report above opened PR #182 and flagged this as a session/machinery change. **Why it's a two-way door:** a label change, fully revertible; no credentials, no security widening, no spend. Not on the one-way-door list. **What proves it:** `docs/agents/issue-tracker.md` — machinery changes under `.sandcastle/` are filed `ready-for-session`. The fix is in `.sandcastle/ts-gate.sh` (a protected path) and PR #182 (`closes #168`) is open for a human session to merge.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Label applied: ready-for-session (category bug unchanged). The ADR-0174 ruling posted earlier today (15:08Z) already concluded ready-for-session, but the state label was dropped before it landed, so the ticket re-surfaced as untriaged on state. Applying it now closes that drop. PR #182 (closes #168) — the one-line CI=true prefix on .sandcastle/ts-gate.sh's install line — is open for a human/session merge.

Why it's a two-way door: a label change, fully revertible; no credentials, security widening, or spend. What proves it: docs/agents/issue-tracker.md:50 (machinery under .sandcastle/ → ready-for-session, never a worker PR) and the open PR #182.

> *This was generated by AI during triage.* Ruled by agent under ADR 0174 — veto anytime. **Label applied: `ready-for-session`** (category `bug` unchanged). The ADR-0174 ruling posted earlier today (15:08Z) already concluded `ready-for-session`, but the state label was dropped before it landed, so the ticket re-surfaced as untriaged on state. Applying it now closes that drop. PR #182 (`closes #168`) — the one-line `CI=true` prefix on `.sandcastle/ts-gate.sh`'s install line — is open for a human/session merge. **Why it's a two-way door:** a label change, fully revertible; no credentials, security widening, or spend. **What proves it:** `docs/agents/issue-tracker.md:50` (machinery under `.sandcastle/` → `ready-for-session`, never a worker PR) and the open PR #182.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: state → ready-for-human (category bug unchanged), correcting the prior ready-for-session ruling on this ticket.

Why the change. ready-for-session is not terminal here and provably loops. The session's job is done — PR #182 (closes #168) is open and green. By design, a pr-mode ticket with an open agent PR is "handed to review": the session runner deletes ready-for-session and adds nothing (.sandcastle/session-runner.sh:413-415 / :660-663, "#302"), because a human merges the PR. Each triage run then re-reads the stateless ticket as untriaged and re-adds ready-for-session, which the runner drops again. This issue's label timeline shows the churn (added 15:08Z, 15:39Z; dropped between). Re-adding it would only restart the loop.

## Why human. The sole residue is a human's decision to merge PR #182 — a change to a protected machinery path (.sandcastle/ts-gate.sh). The swarm worker lane cannot touch .sandcastle/, and the session drainer refuses the open PR by design, so only a human merge advances it. Proposed default: merge PR #182 as-is (the one-line CI=true prefix on the install line, so the pre-push TS gate stops failing closed on a no-TTY node_modules purge; proven green on this host, GOTCHAS 23/24). The same abort exists factory-side in the factory onboard template — carry it back on the next re-vendor.

Why relabelling is itself a two-way door: a label change, fully revertible, touching no credential, posture, or spend. What proves it: this issue's label-churn timeline and .sandcastle/session-runner.sh:413-415 / :660-663.

> *This was generated by AI during triage.* Ruled by agent under ADR 0174 — veto anytime. **Ruling: state → `ready-for-human`** (category `bug` unchanged), *correcting the prior `ready-for-session` ruling on this ticket.* **Why the change.** `ready-for-session` is not terminal here and provably loops. The session's job is done — PR #182 (`closes #168`) is open and green. By design, a pr-mode ticket with an open agent PR is "handed to review": the session runner **deletes `ready-for-session`** and adds nothing (`.sandcastle/session-runner.sh:413-415` / `:660-663`, "#302"), because a human merges the PR. Each triage run then re-reads the stateless ticket as untriaged and re-adds `ready-for-session`, which the runner drops again. This issue's label timeline shows the churn (added 15:08Z, 15:39Z; dropped between). Re-adding it would only restart the loop. **## Why human.** The sole residue is a human's decision to **merge PR #182** — a change to a protected machinery path (`.sandcastle/ts-gate.sh`). The swarm worker lane cannot touch `.sandcastle/`, and the session drainer refuses the open PR by design, so only a human merge advances it. **Proposed default:** merge PR #182 as-is (the one-line `CI=true` prefix on the install line, so the pre-push TS gate stops failing closed on a no-TTY `node_modules` purge; proven green on this host, GOTCHAS 23/24). The same abort exists factory-side in the `factory onboard` template — carry it back on the next re-vendor. **Why relabelling is itself a two-way door:** a label change, fully revertible, touching no credential, posture, or spend. **What proves it:** this issue's label-churn timeline and `.sandcastle/session-runner.sh:413-415` / `:660-663`.
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/coa#168
No description provided.