Floor ticket threads push with no pre-push gates — turnCommand's checkout never sets core.hooksPath (git-setup.sh and session-runner.sh both do) #299

Closed
opened 2026-10-21 23:01:43 +00:00 by matou-build-agent · 4 comments

Problem

A Floor ticket thread (#296) pushes from a checkout with no pre-push gates. turnCommand in fleet-tui/floor/server/threads.js makes the thread's checkout with a bare git clone (and git pull --ff-only on the opening turn), and never sets core.hooksPath. So .sandcastle/git-hooks/pre-push (the language gates, Gate 3b gofmt, the vendored-file drift gate) and commit-msg never run on anything a thread commits or pushes.

The other two places that push from a checkout already set it:

  • git-setup.sh:136 — git config core.hooksPath .sandcastle/git-hooks
  • session-runner.sh:538 — the same, on SESSION_RUNNER_CHECKOUT

Threads are the one path that pushes main and doesn't.

How it showed up

idss#1913 thread on matou-workstation (~/.local/share/dev-factory/threads/Matou/idss), 2026-10-21: git config core.hooksPath came back empty, and idss d6c66927 was pushed to main with no gate run. I ran the gate by hand over the range afterwards and it was clean (no Go touched), but nothing enforced that. This is the same gap idss#1912 asked about ("either core.hooksPath was not set or the push used --no-verify"), which is how gofmt debt reached idss main in ce04cd10. I set core.hooksPath on that one checkout by hand. Every other thread checkout, existing or new, still lacks it.

Fix

In turnCommand's script, after cd "$dir" and on every turn (not only on clone, so existing thread checkouts heal too):

[ -d .sandcastle/git-hooks ] && git config core.hooksPath .sandcastle/git-hooks || true

The guard keeps it a no-op in a repo that has no vendored hooks.

Acceptance

  • A fresh thread checkout has core.hooksPath = .sandcastle/git-hooks before claude starts.
  • An existing thread checkout without it gets it on its next turn, including --resume turns.
  • A repo with no .sandcastle/git-hooks/ gets no core.hooksPath and the turn still starts.
  • A test in the threads suite pins the line in turnCommand(...).script, same as the clone/pull lines.
## Problem A Floor ticket thread (#296) pushes from a checkout with **no pre-push gates**. `turnCommand` in `fleet-tui/floor/server/threads.js` makes the thread's checkout with a bare `git clone` (and `git pull --ff-only` on the opening turn), and never sets `core.hooksPath`. So `.sandcastle/git-hooks/pre-push` (the language gates, Gate 3b gofmt, the vendored-file drift gate) and `commit-msg` never run on anything a thread commits or pushes. The other two places that push from a checkout already set it: - `git-setup.sh:136` — `git config core.hooksPath .sandcastle/git-hooks` - `session-runner.sh:538` — the same, on `SESSION_RUNNER_CHECKOUT` Threads are the one path that pushes `main` and doesn't. ## How it showed up idss#1913 thread on matou-workstation (`~/.local/share/dev-factory/threads/Matou/idss`), 2026-10-21: `git config core.hooksPath` came back empty, and idss `d6c66927` was pushed to `main` with no gate run. I ran the gate by hand over the range afterwards and it was clean (no Go touched), but nothing enforced that. This is the same gap idss#1912 asked about ("either `core.hooksPath` was not set or the push used `--no-verify`"), which is how gofmt debt reached idss `main` in `ce04cd10`. I set `core.hooksPath` on that one checkout by hand. Every other thread checkout, existing or new, still lacks it. ## Fix In `turnCommand`'s script, after `cd "$dir"` and on **every** turn (not only on clone, so existing thread checkouts heal too): ```sh [ -d .sandcastle/git-hooks ] && git config core.hooksPath .sandcastle/git-hooks || true ``` The guard keeps it a no-op in a repo that has no vendored hooks. ## Acceptance - [ ] A fresh thread checkout has `core.hooksPath = .sandcastle/git-hooks` before `claude` starts. - [ ] An existing thread checkout without it gets it on its next turn, including `--resume` turns. - [ ] A repo with no `.sandcastle/git-hooks/` gets no `core.hooksPath` and the turn still starts. - [ ] A test in the threads suite pins the line in `turnCommand(...).script`, same as the clone/pull lines.
Author
Member

This was generated by AI during triage.

Agent Brief

Category: bug
Summary: Floor thread checkouts never set core.hooksPath, so a thread can commit/push main with every pre-push gate skipped.

Current behavior:
The per-turn script produced by turnCommand (in the Floor server's thread
module) makes/updates the thread's checkout with a bare git clone (plus a
git pull --ff-only on the opening turn) and then execs claude. It never
runs git config core.hooksPath .sandcastle/git-hooks. As a result the
vendored .sandcastle/git-hooks/pre-push (language gates, Gate 3b gofmt, the
vendored-file drift gate) and commit-msg do not fire on anything the thread
commits or pushes. The two other checkouts that push — the one git-setup makes
and the one the session runner drives — both set core.hooksPath; threads are
the only push path that does not.

Confirmed during triage: turnCommand(...).script is git clone / cd /
git pull --ff-only / exec claude with no hooks-path config; both other
callers set core.hooksPath .sandcastle/git-hooks. Reproduced as reported on
the idss#1913 thread (hooksPath empty, a commit reached main ungated).

Desired behavior:
Every turn's script — not just the clone turn, so pre-existing thread
checkouts heal on their next turn including --resume turns — points
core.hooksPath at the vendored hooks directory after entering the checkout,
guarded so a repo with no vendored hooks is a clean no-op and the turn still
starts. Behaviorally: a thread's checkout has core.hooksPath set to the
repo's .sandcastle/git-hooks before claude runs, whenever that directory
exists.

Key interfaces:

  • turnCommand(opts) in the Floor server thread module — the returned
    script string must configure core.hooksPath to .sandcastle/git-hooks
    on every turn, after it cds into the checkout, guarded on the hooks
    directory existing (a missing dir leaves core.hooksPath unset and does not
    fail the turn).

Acceptance criteria:

  • A fresh thread checkout has core.hooksPath = .sandcastle/git-hooks
    before claude starts.
  • An existing thread checkout without it gets it on its next turn,
    including --resume turns.
  • A repo with no .sandcastle/git-hooks/ gets no core.hooksPath set and
    the turn still starts.
  • A test in the Floor threads suite (threads.test.js) pins the
    hooks-path line in turnCommand(...).script, the same way the clone and
    pull lines are pinned.

Out of scope:

  • Changing how git-setup or the session runner set core.hooksPath.
  • Altering the hooks themselves or what the gates check.
  • The git clone / git pull --ff-only behavior beyond adding the
    hooks-path line.

Triage ruling (ADR 0174 — veto anytime): routed ready-for-agent. This is
a self-contained fix in fleet-tui/floor/server/threads.js plus a vitest
assertion — not a prompt skeleton, not .sandcastle/, not .forgejo/, so no
ready-for-session standing is needed. It is a two-way door: fully revertible
by a later commit and provable by the pinned threads.test.js assertion. No
one-way-door residue (no credentials, no security widening, no trust accept, no
data destruction, no spend).

> *This was generated by AI during triage.* ## Agent Brief **Category:** bug **Summary:** Floor thread checkouts never set `core.hooksPath`, so a thread can commit/push `main` with every pre-push gate skipped. **Current behavior:** The per-turn script produced by `turnCommand` (in the Floor server's thread module) makes/updates the thread's checkout with a bare `git clone` (plus a `git pull --ff-only` on the opening turn) and then `exec`s `claude`. It never runs `git config core.hooksPath .sandcastle/git-hooks`. As a result the vendored `.sandcastle/git-hooks/pre-push` (language gates, Gate 3b gofmt, the vendored-file drift gate) and `commit-msg` do not fire on anything the thread commits or pushes. The two other checkouts that push — the one git-setup makes and the one the session runner drives — both set `core.hooksPath`; threads are the only push path that does not. Confirmed during triage: `turnCommand(...).script` is `git clone` / `cd` / `git pull --ff-only` / `exec claude` with no hooks-path config; both other callers set `core.hooksPath .sandcastle/git-hooks`. Reproduced as reported on the idss#1913 thread (hooksPath empty, a commit reached `main` ungated). **Desired behavior:** Every turn's script — not just the clone turn, so pre-existing thread checkouts heal on their next turn including `--resume` turns — points `core.hooksPath` at the vendored hooks directory after entering the checkout, guarded so a repo with no vendored hooks is a clean no-op and the turn still starts. Behaviorally: a thread's checkout has `core.hooksPath` set to the repo's `.sandcastle/git-hooks` before `claude` runs, whenever that directory exists. **Key interfaces:** - `turnCommand(opts)` in the Floor server thread module — the returned `script` string must configure `core.hooksPath` to `.sandcastle/git-hooks` on every turn, after it `cd`s into the checkout, guarded on the hooks directory existing (a missing dir leaves `core.hooksPath` unset and does not fail the turn). **Acceptance criteria:** - [ ] A fresh thread checkout has `core.hooksPath = .sandcastle/git-hooks` before `claude` starts. - [ ] An existing thread checkout without it gets it on its next turn, including `--resume` turns. - [ ] A repo with no `.sandcastle/git-hooks/` gets no `core.hooksPath` set and the turn still starts. - [ ] A test in the Floor threads suite (`threads.test.js`) pins the hooks-path line in `turnCommand(...).script`, the same way the clone and pull lines are pinned. **Out of scope:** - Changing how git-setup or the session runner set `core.hooksPath`. - Altering the hooks themselves or what the gates check. - The `git clone` / `git pull --ff-only` behavior beyond adding the hooks-path line. --- **Triage ruling (ADR 0174 — veto anytime):** routed `ready-for-agent`. This is a self-contained fix in `fleet-tui/floor/server/threads.js` plus a vitest assertion — not a prompt skeleton, not `.sandcastle/`, not `.forgejo/`, so no `ready-for-session` standing is needed. It is a two-way door: fully revertible by a later commit and provable by the pinned `threads.test.js` assertion. No one-way-door residue (no credentials, no security widening, no trust accept, no data destruction, no spend).
Author
Member

swarm-claim host=matou-dev-server-01 run=23830
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=23830 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #299 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #299 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #299 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261021-233255-c766f7 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 299,
  "status": "success",
  "commits": [
    "315e0dac822b96b7a7fbd8965a290f8f619aeaef"
  ],
  "changed_files": [
    "fleet-tui/floor/server/threads.js",
    "fleet-tui/floor/server/threads.test.js",
    "docs/GOTCHAS.md",
    "docs/gotchas/79-a-checkout-that-pushes-main-must-set-core-hookspath.md"
  ],
  "tests": [
    {
      "command": "node --test fleet-tui/floor/server/threads.test.js",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A fresh thread checkout has core.hooksPath = .sandcastle/git-hooks before claude starts": "turnCommand's script runs the hooks-path line after `cd \"$dir\"` and before `exec claude` (fleet-tui/floor/server/threads.js); pinned by the opening-turn test asserting `cd \"$dir\"\\n[ -d .sandcastle/git-hooks ] && git config core.hooksPath .sandcastle/git-hooks || true` (threads.test.js).",
    "An existing thread checkout without it gets it on its next turn, including --resume turns": "the line is a plain script element, not gated on clone, so it runs on every turn; the resumed-turn test (sessionId set) asserts the same line is present after `cd \"$dir\"` even with --resume (threads.test.js).",
    "A repo with no .sandcastle/git-hooks/ gets no core.hooksPath set and the turn still starts": "the `[ -d .sandcastle/git-hooks ] && ... || true` guard makes it a no-op when the dir is absent and never fails the turn (threads.js).",
    "A test in the Floor threads suite (threads.test.js) pins the hooks-path line in turnCommand(...).script, the same way the clone and pull lines are pinned": "two assertions added to threads.test.js (opening turn and --resume turn) match the line directly after `cd \"$dir\"`, beside the existing git clone / git pull assertions."
  },
  "summary": "turnCommand now points core.hooksPath at the repo's vendored git-hooks on every thread turn (guarded on the hooks dir), so a Floor thread's commits/pushes run the same pre-push gates git-setup and the session runner enforce.",
  "blockers": []
}
**close-report** for #299 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261021-233255-c766f7` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 299, "status": "success", "commits": [ "315e0dac822b96b7a7fbd8965a290f8f619aeaef" ], "changed_files": [ "fleet-tui/floor/server/threads.js", "fleet-tui/floor/server/threads.test.js", "docs/GOTCHAS.md", "docs/gotchas/79-a-checkout-that-pushes-main-must-set-core-hookspath.md" ], "tests": [ { "command": "node --test fleet-tui/floor/server/threads.test.js", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh", "exit_code": 0 } ], "criteria": { "A fresh thread checkout has core.hooksPath = .sandcastle/git-hooks before claude starts": "turnCommand's script runs the hooks-path line after `cd \"$dir\"` and before `exec claude` (fleet-tui/floor/server/threads.js); pinned by the opening-turn test asserting `cd \"$dir\"\\n[ -d .sandcastle/git-hooks ] && git config core.hooksPath .sandcastle/git-hooks || true` (threads.test.js).", "An existing thread checkout without it gets it on its next turn, including --resume turns": "the line is a plain script element, not gated on clone, so it runs on every turn; the resumed-turn test (sessionId set) asserts the same line is present after `cd \"$dir\"` even with --resume (threads.test.js).", "A repo with no .sandcastle/git-hooks/ gets no core.hooksPath set and the turn still starts": "the `[ -d .sandcastle/git-hooks ] && ... || true` guard makes it a no-op when the dir is absent and never fails the turn (threads.js).", "A test in the Floor threads suite (threads.test.js) pins the hooks-path line in turnCommand(...).script, the same way the clone and pull lines are pinned": "two assertions added to threads.test.js (opening turn and --resume turn) match the line directly after `cd \"$dir\"`, beside the existing git clone / git pull assertions." }, "summary": "turnCommand now points core.hooksPath at the repo's vendored git-hooks on every thread turn (guarded on the hooks dir), so a Floor thread's commits/pushes run the same pre-push gates git-setup and the session runner enforce.", "blockers": [] } ``` </details>
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#299
No description provided.