Skip to content

Add a DeepWork review rule for scope discipline - #433

Open
dkrattiger wants to merge 6 commits into
dimitri/pending-fixesfrom
panopticon/deepreview-scope-discipline
Open

dkrattiger wants to merge 6 commits into
dimitri/pending-fixesfrom
panopticon/deepreview-scope-discipline

Conversation

@dkrattiger

Copy link
Copy Markdown
Contributor

What

Adds a single .deepreview rule to this repo that flags additions the task didn't require.

Why

PRs keep arriving with more in them than the task needed — helpers with one call site, guards for states that can't occur, drive-by reformatting, comments restating the next line. Each is individually defensible, which is why they accumulate; the cost lands on whoever reviews, since attention is spent per line whether or not the line needed to exist.

unsupervised-main already runs DeepWork Reviews (.deepreview files under app/ and test/, shared instructions under .deepwork/review/). This repo had none, so nothing was watching for it here. tarot has none either.

Design

all_changed_files — the match patterns are only a tripwire; the reviewer receives the entire changeset. "Is this diff bigger than the task required" is a question about the whole PR, not about any one file, so per-file strategies can't answer it.

One rule, not several. configure_reviews warns that each rule spawns its own sub-agent with material overhead, and scope creep is a single judgement rather than seven independent ones.

It only ever argues for removing things. Correctness, coverage, and completeness belong to human review and to other rules. A rule that could argue in both directions would relitigate the whole PR and drown the signal it exists to produce.

Two explicit guards in the instructions, because getting them wrong makes the rule worse than useless:

  • Don't flag work the task actually required, however large. A big diff isn't a finding; a big diff for a small task is.
  • Don't flag missing work.

It also refuses rather than guesses: if the task can't be inferred from the title, branch, and commits, it says so and stops instead of inventing a narrower task and flagging everything outside it.

Notes

  • Validated as YAML; key shape matches the existing unsupervised-main rules exactly (no unknown keys at either level).
  • Reviews are on-demand — no GitHub Action runs them in unsupervised-main either. This supplies the policy; invoking it stays a deliberate step (/review, or uvx deepwork review).
  • Excludes .venv/** and generated Alembic migrations, which would otherwise trip the tripwire on every schema change.

🤖 Generated with Claude Code

dkrattiger and others added 6 commits September 22, 2026 08:57
…-pod build, scoped SA)

Bundle to give panopticon task agents the finder prod-testing capability:
- finder-repro-rbac.yaml: dedicated finder-repro namespace + panopticon-repro SA
  (pods CRUD/exec/log) + ResourceQuota/LimitRange ceiling.
- unsupervised-main/Dockerfile.finder-builder + publish.finder-builder.yml: pre-baked
  Harbor builder image (deps installed, source overlaid per build) reproducing
  build.finder.yml; published with existing HARBOR_USERNAME/PASSWORD.
- build-finder-in-pod.sh: agent-run in-pod build (no DinD) — overlay current src,
  pyinstaller, copy binary out; pulls via unsupervised-regcred.
- README: design, apply sequence, rebuild cadence.

Still pending (credential-handling, blocked by the auto-mode classifier — need operator OK):
image-layer.head.dockerfile (kubectl + kubeconfig-wiring wrapper) and apply.sh
(regenerates PROD_REPRO_KUBECONFIG_B64 scoped to finder-repro).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…files

- finder-repro-rbac.yaml: add finder-test run-SA (IRSA -> read-only prod S3);
  panopticon-repro stays the control-plane SA.
- iam-finder-repro-readonly.json: scoped IAM role templates (trust = EKS OIDC +
  finder-repro:finder-test; permissions = read-only s3 on unsupervised-prod-internal/internal/*).
- image-layer.head.dockerfile + apply.sh: the credential-handling files (kubectl wrapper
  that materializes the kubeconfig; apply.sh wires config and rewrites PROD_REPRO_KUBECONFIG_B64
  scoped to finder-repro, test-before-overwrite + backup). Layer build smoke-tested.
- repro-pod.template.yaml: finder test pod running as finder-test.
- prod-testing-gate.md: operator turn-handoff approval rule for agents.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Neither the operator nor I have IAM-admin on prod (SSO grants only Unsupervised-Engineer,
which can't iam:CreateRole), so the scoped finder-repro namespace is deferred. Interim uses
the broad prod-unsupervised-main role by running test pods in default as unsupervised-unsupervised
-- zero cluster/credential/IAM changes (panopticon-repro already has pod-create in default; its
kubeconfig already points there; unsupervised-unsupervised + unsupervised-regcred already exist).

- build-finder-in-pod.sh / repro-pod.template.yaml: target default / unsupervised-unsupervised.
- apply.sh: config is the interim default (layer + repo PATCH only); scope-sa gated as phase-2.
- prod-testing-gate.md: default ns; the turn-handoff is now the ONLY guardrail (no quota) so
  approval is emphasized as mandatory.
- finder-repro-rbac.yaml + iam-finder-repro-readonly.json: banner-marked PHASE 2 (needs IAM-admin).
- README: two-phase framing.

Trade-off accepted by operator: broad role + no compute quota in the interim; tighten to the
scoped read-only role + quota once an IAM-admin can create it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ecompile)

Addresses the proprietary-source concern: the pre-baked builder image now bakes ONLY the
toolchain + third-party deps + the compiled bfinder wheel + a RUST_SRC_HASH marker -- no finder
Python source and no Rust source persist in Harbor (python-utils remains as an installed dep,
unavoidable for pyinstaller). Strictly less than the prod image already ships.

build-finder-in-pod.sh overlays the agent's current finder source at build time and recompiles
the bfinder wheel ONLY when the overlaid Rust source hash differs from RUST_SRC_HASH -- so a
Python-only change uses the fast baked wheel, and a Rust change is never tested against a stale
wheel. --force-rust overrides. The overlaid source is transient (deleted with the pod).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…specific .dockerignore)

The published builder image required two CI fixes, now reflected here:
- Dockerfile.finder-builder + build-finder-in-pod.sh: maturin build -r -o /tmp/wheels (the wheel
  lands in the Cargo *workspace* target, not pybfinder/target, so the old target/wheels/*.whl glob
  missed it).
- finder-builder.Dockerfile.dockerignore: BuildKit uses this instead of the repo-root .dockerignore
  (which excludes subrepos/), so the build context includes subrepos/finder + subrepos/python-utils.

finder-builder:latest is now published to Harbor (native amd64, no finder/Rust source).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PRs keep arriving with more in them than the task required — helpers with one
call site, guards for states that can't occur, drive-by reformatting, comments
restating the next line. Each is individually defensible, which is why they
accumulate, and the cost lands on whoever reviews: attention is spent per line
whether or not the line needed to exist.

`unsupervised-main` already runs DeepWork Reviews (`.deepreview` files under
app/ and test/, instructions under .deepwork/review/). This repo had none, so
nothing was watching for it here.

One rule, `all_changed_files`: the match is only a tripwire, and the reviewer
gets the whole changeset — "is this diff bigger than the task required" is a
question about the whole, not about any one file. Deliberately a single rule
rather than several: each spawns its own sub-agent with real overhead, and
scope creep is one judgement.

The rule only ever argues for removing things. Correctness, coverage, and
completeness belong to human review and to other rules; a rule that could argue
in both directions would just relitigate the whole PR.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant