Skip to content

feat: intake reconcile --repo TARGET — read upstream for staleness #223

Description

@Jammy2211

Overview

intake reconcile ranks draft/ prompts that look already-shipped, but it reads only Mind-local evidence (complete/ records + active/). The 2026-08-09 draft/ sweep confirmed five stale prompts, and two of them left no Mind-local trace at all — one whose evidence sat inside a sibling prompt rather than a completion record, and one whose fix shipped as PyAutoFit#1418 with no completion record ever written. No amount of re-ranking Mind-local signals reaches those; the parent prompt proved that every attempt cost precision without gaining truth.

This is leg 3 of the staleness work (legs 1 and 2 are delivered: the PyAutoMind lifecycle.py gate keys, and the reconcile re-rank that took the flag rate from 96/148 to 29/136). It adds the upstream read that is the only route to the remaining two finding shapes.

Note: an earlier revision of this issue was mangled on creation — GitHub stripped every angle-bracketed placeholder (the word target wrapped in angle brackets) as an unknown HTML tag, including from the title, and dropped the collapsible detail blocks. Rewritten using TARGET and plain headings. No content was lost from the plan.

Plan

  • Add an opt-in --repo TARGET mode to intake reconcile that reads the target repo's main — the only evidence source that reaches prompts with no Mind-local trace.
  • Resolve target → GitHub slug from the two sources that already exist (repos.yaml github: and policy.yaml repo_aliases); refuse multi-repo pseudo-targets rather than guessing one.
  • Cache a plain --depth 1 clone per repo, and record the resolved sha so a verdict is reproducible and re-checkable.
  • Reuse the existing _IDENT_RE to extract each prompt's identifiers, grep the clone, rank on hits, and report file:line evidence a human can read.
  • Emit needs-review with evidence — never a shipped verdict.
  • Keep the default path offline by putting the upstream read behind an injectable seam, so the existing hermetic tests stay hermetic.
  • Record the new network surface in AUTONOMY.md.

The trap this turns on

draft/bug/autofit/test_mode_bypass_ordered_assertion_ties.md names five identifiers — FitException, check_assertions, ignore_assertions, instance_for_arguments, instance_from_vector. All five are on PyAutoFit main, yet the prompt is confirmed NOT shipped: main catches exc.FitException in the TEST_MODE bypass, which looks exactly like the requested fix, but the catch wraps only the likelihood call while model.instance_from_vector — where check_assertions actually raises on an ordering tie — sits on the line before the try.

A naive identifier-presence matcher scores this 5 of 5 and calls it shipped. That is the one mis-grade this tool must never make, and it is the acceptance criterion.

Architectural note — the Brain's first network access

Nothing under agents/ currently uses urllib, requests, gh or git clone. Every conductor and faculty is stdlib-only and offline. This leg breaks that invariant, which is why the flag is strictly opt-in and the default path must stay provably offline.

Detailed implementation plan

Work Classification

Library

Affected Repositories

  • PyAutoBrain (primary) — the code
  • PyAutoMind — docs only

Branch Survey

Repository Current Branch Dirty?
./PyAutoBrain main clean
./PyAutoMind claude/automind-task-planning-wxq004 clean

Suggested branch: feature/reconcile-upstream-repo-mode

Conflict check: worktree_check_conflict reconcile-upstream-repo-mode PyAutoBrain PyAutoMind → clean. (Note: the first run of this guard was vacuous — it resolves active.md under $PYAUTO_MAIN, default $HOME/Code/PyAutoLabs, which does not exist in a cloud session, so it returned 0 without reading anything. Re-run with PYAUTO_MAIN set, it confirms the same answer for real: the only other live claim is profile-validation-resample-recovery on PyAutoGalaxy.)

Implementation Steps

  1. agents/conductors/intake/_intake.py — add helpers above reconcile():
    • resolve_repo(mind, target) returning (slug, err), reading PyAutoMind repos.yaml github: plus config/policy.yaml repo_aliases (which already carries pyautoarray → autoarray and the sizing faculty's PyAutoFit → autofit package form). Do not add a third mapping.
    • _clone_upstream(slug, cache) returning (path, sha)GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 on first use, git fetch --depth 1 thereafter.
    • _grep_source(root, idents) returning {ident: [file:line]}.
  2. Refuse multi-repo pseudo-targets non-zero, naming the real candidate repos. workspaces (23 prompts across four work-types), health_fixes (6), priors (6) and graphical_ep are among the largest buckets in draft/ and are not repos — guessing one would produce confident nonsense on the biggest part of the backlog.
  3. reconcile() grows a source_reader=None seam. When set, add finding kind upstream-identifier-present.
  4. Band label for --repo results is needs-review, never high/shipped. emit_reconcile() prints the resolved sha header and the file:line evidence lines.
  5. Argparse: rc.add_argument("--repo", default=""). intake.sh needs no plumbing change (it forwards unrecognised args through to _intake.py), but its -h block gains the new mode.
  6. Identifier extraction: the parent prompt proposes scoping to the prompt's ## Scope / ## Acceptance sections. That rule needs a stated fallback — the trap prompt above has neither heading (its only heading is a dated correction block), so a strictly section-scoped rule no-ops on exactly the prompts that matter most.
  7. AUTONOMY.md — a line stating the network surface and that it is opt-in.

Key trade-off

Plain --depth 1 over the --filter=blob:none treeless clone the parent prompt suggested: grepping source refetches every blob on demand, so treeless is a false economy here. This is a deliberate correction to the parent.

Testing approach

tests/test_intake_reconcile_ranking.py is currently fully hermetic — every fixture is a fictional Mind tree in tmp_path, and that property is worth more than integration coverage. Preserve it by injecting the seam with a fake local source tree. New cases pin:

  • the five-identifier trap is not reported as shipped;
  • pseudo-targets are refused non-zero;
  • the default (no --repo) path performs no network access;
  • no prompt is moved or retired by the tool.

Key Files

  • agents/conductors/intake/_intake.pyreconcile(), emit_reconcile(), _IDENT_RE, the argparse reconcile subparser
  • agents/conductors/intake/intake.sh — help text only
  • config/policy.yaml — existing repo_aliases, reused
  • tests/test_intake_reconcile_ranking.py — hermetic contract tests
  • AUTONOMY.md — network-surface policy line
  • PyAutoMind repos.yaml — the github: slug source

Baselines verified at planning time

  • intake reconcile flags 29 suspects of 136 scanned (7 high, 22 medium).
  • No --repo flag exists in _intake.py's argparse.
  • No network access anywhere under agents/.

Acceptance

  • --repo TARGET resolves via repos.yaml + policy.yaml, and refuses workspaces / health_fixes / priors / graphical_ep non-zero, naming the real repos.
  • Run against PyAutoFit, test_mode_bypass_ordered_assertion_ties.md is NOT reported as shipped despite all five identifiers being present upstream. Pinned by a test.
  • No prompt is moved or retired by the tool. Pinned by a test.
  • The default reconcile path performs no network access. Pinned by a test.
  • The existing hermetic tests still pass unchanged.
  • Output records the resolved upstream sha.

Original Prompt

Filed at PyAutoMind active/reconcile_upstream_repo_mode.md (advanced from draft/feature/pyautobrain/), split 2026-08-10 from draft/feature/pyautomind/draft_staleness_detection_signals.md (legs 1–2 delivered). The prompt file is the verbatim source of the plan above; see the PyAutoMind branch claude/automind-task-planning-wxq004.

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