Skip to content

Fewer push cycles: catch at commit what the push tier now finds, and review only what changed #18

Closed

Description

@fatherlinux

For Scott

What: a short program of python-sdlc changes so an agent (or a person) finds problems at commit time and in one push, instead of across several 6–8 minute push rejections.
Why it matters: trentina #706 took five pushes, four rejected, about 28 minutes of gate time. Two were a tooling bug (#16), one was deterministic findings that a 3-second check at commit would have caught, and every retry re-reviewed the whole diff with fresh samples.
Recommendation: three releases (0.3.8, 0.4.0, 0.5.0) plus two small Gatehouse changes, below. Size M overall.
Needs from you: nothing. One constitution clause changes (Gourmand joins the commit tier); that supersedes the commit-tier-is-ruff-only decision.

Where it fits

Program: python-sdlc gate ergonomics. Evidence: crunchtools/trentina#706. Includes #16. Excludes #14 (Scott: not now). We expect to keep adding to this as we learn.
Reviewed by the cto agent against the source on 2026-11-04; file:line references below are from that review at 9d5efc7.

For the agent

0.3.8 (patch, alone)

0.4.0

  • Gourmand becomes a commit-tier default. Full mode, measured at 2.7 s warm on trentina (diff mode 0.4 s, but full sees cross-file duplicates). Keep it in push too. resolve() (sdlc:228-242) already allows it; Gourmand is image-rw via WRITES_TREE, and commit is one lane. Constitution XII's commit sentence gains one clause.
  • Semgrep stays consumer config, not a default. It takes 27 s, and t_semgrep exits 2 on a repo with no .semgrep (sdlc:850-851), which would break the commit hook fleet-wide. trentina's bump PR adds [tool.sdlc.commit] checks = ["semgrep"].
  • -- pass-through for single-check runs. Today bin/sdlc:629 runs run_plan "$1" and drops every later argument, so sdlc pytest tests/x.py silently runs the whole suite. Arguments after -- are joined with the unit separator into SDLC_ARGS and passed with -e, like SDLC_SKIP. t_pytest appends them after the config args, so -n0 overrides -n $SDLC_JOBS. Single-check runs only: refuse on commit/push/ci, and refuse extra arguments without -- (exit 2) rather than ignore them. pytest first; mypy, semgrep and ruff later on the same variable.
  • A verdict summary with durations: <git-dir>/sdlc/last-<command>.json listing check, exit, seconds and log path. Keep the per-check logs (today rm -rf "$OUT", bin/sdlc:584). The serial path every push takes (bin/sdlc:347-376) prints no durations at all, so nothing below can be tuned until this lands. Not .sdlc/, which is committed. No per-tool file:line parsing; the logs carry it.
  • Gatehouse's machine-readable findings: pass --consensus-json <git-dir>/sdlc/gatehouse.json. Gatehouse already prints ready-to-paste gatehouse-findings.toml entries (ledger.py:206 render_entry).
  • An agent recipe in --help (bin/sdlc:608-625) and the README; tiers stays the config printer:
    • run sdlc commit, then sdlc push, before the first push;
    • reproduce a push-tier-only failure with sdlc pytest -- <nodeid>;
    • the gate's Python is the image's 3.14, not the host's.
    • Also state plainly that CI triage, not the local record below, is the authority on review.

0.5.0 (after Gatehouse carry-forward, below)

  • Incremental local review, mirroring Gatehouse CI. CI already reviews incrementally on synchronize (gatehouse/src/gatehouse/review.py:1070-1100).
    • After a review that rendered a verdict (exit 0 or 1, never 2), t_gatehouse records <git-dir>/sdlc/gatehouse-reviewed (HEAD, base sha, image tag).
    • The next push reviews git diff <reviewed> HEAD, restricted to the files in origin/main...HEAD.
    • It reviews in full when there is no record, when the reviewed sha is not an ancestor of HEAD (rebase, amend), when the image tag changed, or when SDLC_GATEHOUSE_FULL=1.
    • No "answered" ledger in python-sdlc: the answers are the code itself and gatehouse-findings.toml.
  • Possibly a local lane for Gatehouse (network-bound, no CPU) so it overlaps pytest and CodeQL, if 0.4.0's durations justify it.

Gatehouse (crunchtools/gatehouse, in parallel; dependencies of this program)

  • Patch: the CI review comment states the accepted triage reply forms (not a bug:, deferred:, or a fix commit). triage.yml:17-23 has them; format_review_body (github.py:300-336) names none. One #706 triage round was lost guessing them.
  • Minor, carry-forward of prior findings: accept its own --consensus-json output as prior findings and re-check each evidence quote against the tree (entry_line exists for this), re-raising any finding that is neither fixed nor ledgered without a model call. 0.5.0 depends on it.

Rejected, with reasons

  • Caching verdicts on the tree: a retry's tree almost always changed, and per-check input keys (conftest, fixtures, uv.lock, env) hide real failures when wrong. mypy's and CodeQL's own caches are the correctness-preserving ones and already exist.
  • Semgrep as a commit default: see above.
  • Gourmand --diff-source at commit: full mode is 2.7 s and catches more.
  • Push lanes now: no durations yet to justify them.
  • SDLC_GATEHOUSE_SAMPLES=1 as a shortcut: fewer samples makes verdicts noisier, not findings fewer.

Known trade-off

Incremental review gives up the second look at unchanged code. On #706 that second look found two real crashes. CI's full review on PR open, plus triage, still finds them before merge: push predicts CI, it does not replace it. The local record could be forged by an agent wanting to skip review, but that's no new hole, since SDLC_SKIP=gatehouse and --no-verify already exist and CI triage remains the authority.

Done when: 0.3.8, 0.4.0 and 0.5.0 are released and pinned in trentina; a host test run no longer changes a push-tier verdict; sdlc pytest -- <nodeid> runs one test; a Gourmand finding fails git commit; a retry after a rejected push reviews only the new commits locally; last-push.json reports per-check seconds.
Out of scope: #14.

Activity

  1. fatherlinux commented on Nov 5, 2026

    @fatherlinux
    MemberAuthor

    What ships, and what does not

    Reviewed against the source with the cto agent on 2026-11-04. Four things in this issue changed, and the reasons are below. The work is one pull request, released as 0.4.0, and #14 is in it after all.

    In 0.4.0

    • A test run on the laptop makes the push tier fail tests that read their own file path #16, in both containers that mount the tree — run_in_image and the pytest-in-image argv. This issue named only the first. Reproduced and fixed end to end on trentina's own test_library_lines_are_fingerprinted: with host-compiled bytecode in the tree the gate fails it and prints the laptop's path in the traceback; with PYTHONPYCACHEPREFIX set and nothing else changed, the same poisoned tree passes.
    • Gourmand as a commit-tier default. 1.7s on python-sdlc, 3.2s on trentina, and the whole commit tier with it in is 2.6s. Semgrep stays out, for the reasons stated here.
    • -- pass-through, as proposed, with the refusals.
    • The verdict record with durations, at <git-dir>/sdlc/last-<command>.json plus kept per-check logs. run_serial gained the footer it never had, which is the gap this issue noted and then did not fix.
    • A Gatehouse lane on push, which this issue rejected "for lack of durations". That was the wrong reason to wait: the argument is that Gatehouse reads the diff bin/sdlc computes on the host and never the worktree, so the single-lane-when-rewriting rule does not apply to it, and it needs no measurement. 35s on a 365-line diff, previously spent with the CPUs idle. A lane whose every step is local is left out of the CPU division, so the main lane keeps the whole budget — without that it would have been the 0.3.2 regression again. And the lane that runs containers keeps the terminal: buffering it would mean watching nothing for the length of the test suite.
    • The agent recipe in --help and the README.

    Also in 0.4.0, not in this issue

    • --cap-drop=all --security-opt=no-new-privileges on the gate's own containers. pytest-in-image has been locked down since it was written; the containers that run far more repo-supplied code had none of it.
    • The correctness hole in A release builds the same commit twice; the tag event should promote the image that already exists #14 as filed: :<sha> is pushed before verify-digest, so a main run whose contract test failed leaves a pushed-but-untested digest that the tag run would have promoted. The tag path re-verifies.
    • z, not Z, in this repo's own hooks, which had taken the worktree out from under the shellcheck step — the bug bin/sdlc has documented since it was written, in this repo's own config. And the local Gatehouse hook pinned 0.22.0 while the image bakes 0.23.0.

    Not in 0.4.0

    • Incremental local review (the 0.5.0 section) is out, for three independent reasons: it trades the second look at unchanged code — which on trentina#706 found two real crashes — against accuracy, which is one of the goals here; it depends on two unshipped changes in crunchtools/gatehouse; and with the review now running beside the rest, it only saves wall time if the review is the longest lane, which nobody has measured. The durations shipped here are how that gets decided. Reopen when last-push.json across several repos shows the review lane longer than the main lane. This lands as 0.6.0 if it lands — 0.5.0 is taken by feat!: ci may not skip a push verdict #19.
    • --consensus-json is out. Gatehouse v0.23.0 has the flag, but the reviewer's container mounts the worktree read-only, so collecting the file would mean a new writable bind mount inside the git directory. That is a real cost against a convenience the terminal output already gives, and its only other purpose was feeding the incremental review above.

    Filed, not fixed

    One constitution change

    crunchtools/constitution#87 adds Gourmand to XII's commit sentence. Prose only; the machine check inspects which hooks a repo declares, not which checks a tier runs, so nothing has to be re-inherited and 0.4.0 does not wait on it. It supersedes the commit-tier-is-ruff-only decision.

  2. fatherlinux commented on Nov 5, 2026

    @fatherlinux
    MemberAuthor

    Closing as done against the re-cut scope above. Shipped: #16 (both containers), Gourmand at commit, -- pass-through, last-<command>.json with per-check seconds, the Gatehouse lane on push, the agent recipe, #14; v0.4.0 and v0.5.0 are released and trentina pins v0.5.0 (ce6a427). 0.3.8 folded into 0.4.0. constitution#87 merged.

    Not shipped, by decision: incremental local review and --consensus-json. The reopen condition was the review lane outrunning the main lane. trentina's first last-push.json shows gatehouse at 11 s against pytest 102 s + codeql 95 s, so it doesn't meet that condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions