Skip to content

[Bug]: 4 project-harness analysis defects — history windows collapse, instruction-surface misclassification, project gates invisible, Rules surface missing #195

Open

Description

@liushuhao

[Bug]: 4 defects in project-harness analysis — history windows collapse, instruction-surface misclassification, project gates invisible, Rules surface missing from asset inventory

Environment: better-harness 0.7.0-alpha2 (plugin cache, commit 34899f36)
Workspace: a Python repository with one root AGENTS.md (47,459 bytes), 49 ADRs, 117 markdown docs under docs/, 1,268 commits, 278 source files, 176 test files.

All four findings below were reproduced by running the CLI locally. Commands and raw counts are included so they can be verified without extra tooling.


1. The 30/90/180-day history windows are the same commit range

core-change-watch git-history-profile returns three windows labeled recent-hotspots, sustained-hotspots, and legacy-or-long-range-hotspots. Their hotFiles, supportingHotFiles, and hotPaths arrays are byte-identical across all three, yet reviewMatrix["history-window-coverage"] reports ready.

Reproduction:

better-harness core-change-watch git-history-profile --cwd <workspace> --json

Observed:

"range": { "maxCommits": 500, "analyzedCommits": 500, "newest": "ea2317c", "oldest": "dfb75f7" }

All three windows report analyzedCommits: 500 (at the cap). The repository has 1,268 commits; 774 predate the earliest window start. Concretely:

git rev-list --count HEAD                      # 1268
git rev-list --count --before=2026-09-10 HEAD  # 779
git log -500 --format=%H | tail -1             # oldest scanned commit, dated 2026-09-09

The window start dates (30-day = 2026-09-03, 90-day = 2026-07-05, 180-day = 2026-04-06) all fall before the bounded oldest commit (2026-09-09). The windows cannot diverge, because all three are truncated to the same 500 most recent commits.

Why this matters beyond cosmetics: three trend labels presented as independent corroboration let a reader conclude a hotspot is "sustained" or "legacy" when there is only one measurement. This affects every repository with more than maxCommits commits whose history extends past the shortest window.

Suggested fix: when the commit cap binds for a window, either report the actual covered range and mark the window as capped, or suppress the trend label rather than emitting one that the data does not support. reviewMatrix["history-window-coverage"] should not be ready when the windows are provably identical.


2. Instruction-coverage judgement counts only files literally named AGENTS.md

project-profile reports agentInstructions.status: "thin" with these reasons:

"root AGENTS.md present"
"AGENTS.md count 1 is below suggested minimum 2 for source scale"
"large source tree has no nested AGENTS.md coverage"

The second and third reasons are artifacts of matching on one filename. The repository's actual instruction surface:

wc -c AGENTS.md          # 47459 bytes — architecture seams, gate protocol, human-review tiering
ls docs/adr | wc -l      # 49 ADRs
ls docs/agents/          # domain.md, issue-tracker.md, triage-labels.md

None of these is named AGENTS.md, so none is counted. The "no nested AGENTS.md coverage" claim is literally true and substantively empty.

The second consequence is more actionable: suggestedScopes on the unfiltered run proposes writing instruction coverage into data-product directories:

{"path": ".scratch/archive-2026-08-16", "sourceFiles": 27}
{"path": ".scratch/window-closeout-2026-10", "sourceFiles": 26}
{"path": ".scratch/archmap-closeout-2026-09", "sourceFiles": 23}
{"path": ".scratch/l2-cluster2-2026-09", "sourceFiles": 8}

Following that advice would place agent instructions inside scratch space.

Note that with data-product directories excluded via --ignore, status flips to adequate — but that is a side effect of a smaller corpus, not a better measurement, so it should not be read as the fix.

Suggested fix: treat a domain glossary, a docs/agents/ conventions directory, and an ADR/spec directory as instruction carriers for coverage accounting; and constrain suggestedScopes to source directories rather than whatever directories happen to hold many files.


3. Project-owned gates are invisible, so validation guidance is presented as authoritative but is narrow

followUpActions["validate-impact"] is titled "Run focused validation for changed core or hotspot areas" and lists 8 files (7 tests + 1 fixture) as the validation scope, with reason "Detected tests or fixtures can anchor validation."

This repository has four deterministic gates:

Gate Command
Delivery gate (full suite + dead-import scan + data gate) python tools/verify-task.py
Scoped check routing python -m tools.verify --affected <paths> / --affected-git
Pre-write source gate PreToolUse hook requiring a fresh gate marker per edit
Test suite 3,051 tests collected

None appear anywhere in the analysis output. Substring counts over the serialized JSON:

verify-task     0
current-ticket  0
affected-git    0
pre-tool-gate   0

The generic behavior is understandable — a cross-project tool cannot know each project's gates. The defect is the framing: the tool emits a narrow list as the authoritative validation scope rather than declaring that project-owned gates are unknown. An agent following it runs a strict subset and silently skips the delivery gate and dead-import scan.

Suggested fix: when project-owned validation surfaces cannot be identified, validate-impact should state that explicitly instead of presenting detected tests as the scope. Consider emitting a "discovery" hint (check for a delivery/verify wrapper, CI config, or pre-commit hook) rather than a closed list.


4. Root AGENTS.md is not classified into any asset surface

The Claude asset inventory reports:

"assetInventory": { "summary": { "skills": 1, "mcps": 1, "rules": 0, "hooks": 0, "agents": 0, "commands": 0 } }

and coverageRows contains exactly two surfaces:

[{"surface": "Skills", "scopes": ["Project"], "count": 1},
 {"surface": "MCP",   "scopes": ["Project"], "count": 1}]

Meanwhile the file exists, is git-tracked, and is loaded as the project instruction file by the provider:

git ls-files | grep -E '(^|/)AGENTS\.md$'   # AGENTS.md
wc -c AGENTS.md                              # 47459

There are two readings, and the gap holds under both:

  • If rules is intended to mean only ~/.claude/rules/**-style directories, then rules: 0 is correct but the root AGENTS.md is classified into no surface at all.
  • If rules is meant to include root AGENTS.md, then the count is wrong.

Either way, the practical consequence is the same: any omission / redundancy / rule-skill-overlap judgement made against this inventory silently ignores the workspace's largest instruction owner.

Suggested fix: classify a tracked root AGENTS.md into the Rules surface so it appears in coverageRows and in ownerRoutes. If the Rules surface is intentionally directory-only, a separate row for root instruction files would preserve the accounting.


Reproduction environment

better-harness 0.7.0-alpha2 (34899f36)
node v26.5.1, Windows 11
findings 1-2 reproduced unfiltered; 3-4 reproduced with --ignore excluding data-product dirs

No repository files were modified while producing this report.

Activity

  1. liushuhao commented on Oct 4, 2026

    @liushuhao
    Author

    5. Lifecycle classification assigns High confidence to an episode with zero acceptance evidence

    In lanes.sessionEvidence.data.candidates[].lifecycle[], one episode carries two intent entries that both map to the same dimension/check pair with confidence: "High":

    [
     {"intent":"documentation-maintenance","family":"documentation-maintenance","dimensionId":"reliable-delivery","checkId":"acceptance-evidence","confidence":"High"},
     {"intent":"release-delivery","family":"review-acceptance-delivery","dimensionId":"reliable-delivery","checkId":"acceptance-evidence","confidence":"High"}
    ]

    The same episode records:

    "changes": {"edits": 0, "files": 0},
    "checks": [{"kind":"pytest","status":"passed","relation":"no-change-context"}],
    "closure": "no-change-observed",
    "acceptanceEvidenceCeiling": "lead"

    So acceptance-evidence reaches its highest confidence on an episode that observed no changes and whose only check has no change context. Any consumer filtering by confidence would count this no-op closeout as accepted.

    Likely mechanism (inferred, not observed): the confidence input reads the intent text without reading the change/relation facts. The confidence field's derivation is not exposed in the bundle, so this remains a hypothesis.

    Suggested fix: include change and check-relation facts in the confidence decision, or downgrade confidence when closure is no-change-observed / acceptanceEvidenceCeiling is below the checked dimension. Surfacing contradictory rows explicitly would also help.

    Boundary: only 1 emitted episode carries lifecycle facts, so the contradiction rate cannot be estimated from this sample.

    6. No Task Episode in the window binds a final change to a reviewed relevant check

    "populationCoverage": {"withChanges":33,"withChecks":72,"withReviewedRelevantCheck":0, ...}
    "diagnosticFlags": ["portfolio-truncated","population-portfolio-divergence","no-reviewed-relevant-check-evidence"]

    Across 200 candidate episodes: 33 have changes, 72 have checks, 0 have a reviewed relevant check. The producer's own diagnostic flag names this. The three emitted episodes are all zero-change closeouts with relation: "no-change-context".

    The important qualifier: this is a gap in the review pipeline's ability to bind check↔change, not a claim that the repository skipped validation. The repository does run a full suite and a delivery gate; the bundle cannot connect "which check judged which change".

    Contributing factor worth noting in the same report — the episode portfolio is truncated by budget:

    "omitted": {"candidateBudget": 163, "noRequest": 993, "duplicateRequests": 34, "lowSignal": 4},
    "availableClasses": {"change-gap": 33, ...}, "emittedClasses": {..., "change-gap": 0}

    163 of 200 candidates were dropped by budget, and the change-gap class (33 available) emitted 0 episodes. The class most relevant to "changed but not closed" is precisely the one fully truncated, so any conclusion about change closure in this window is unavailable rather than clean.

    Suggested fix: preserve at least one episode per available class when truncating, or mark fully-truncated classes explicitly so downstream consumers do not read their absence as "no occurrences".

    Reproduce with: better-harness harness evidence-bundle --workspace <workspace> --platform claude --depth normal --format json, then read lanes.sessionEvidence.data.populationCoverage and candidates[].lifecycle[].

  2. phodal commented on Oct 8, 2026

    @phodal
    Member

    @liushuhao welcome to PR

  3. subaru-ye commented on Oct 13, 2026

    @subaru-ye

    Hi @phodal, @liushuhao — I'd like to help fix this issue if it's still unclaimed.

    What I've verified so far on current main (a7d77fb):

    Defect 1 (history windows collapse): confirmed the mechanism. git-history-profile runs a single bounded git log -<maxCommits> and derives all three windows by filtering that one commit list by window start (commit.timestamp >= sinceSeconds). When the cap binds — as in the reported repo (1,268 commits, 774 older than the bounded range) — all three windows receive identical commit sets. historyConfidence already records bounded at maxCommits=..., but that fact never propagates into the per-window trend labels or reviewMatrix["history-window-coverage"], which is why identical windows still report ready.

    Defects 2–4: I've located the owning modules (project-profile.mjs for instruction coverage, evidence-pack.mjs for validate-impact framing, coding-agent-practices/inventory.mjs for the asset surface) but haven't reproduced them yet — I'd re-verify each finding against this report before changing anything.

    Proposed plan:

    1. Fix the defects as small independent PRs, starting with defect 1 (smallest, most testable): when the cap binds for a window, report the actually-covered range and mark the window capped; history-window-coverage should not stay ready when windows are provably identical.
    2. Then defect 4 (classify a tracked root AGENTS.md into an asset surface / coverageRows). Defects 2 and 3 involve semantic calls — what counts as an instruction carrier, and how validate-impact should frame unknown project gates — so I'd bring a concrete proposal there for review rather than deciding unilaterally.
    3. Focused tests per PR; happy to open a short spec first if you prefer (per AGENTS.md).

    Scope note: the two follow-up defects from the comments (High confidence on zero-change episodes, budget truncation of change-gap episodes) look like a separate lane in sessionEvidence — I'd keep them out of this effort unless you want them tracked here.

    @liushuhao — if you're already preparing a PR, just say so and I'll take whichever defects you'd rather leave, or review yours instead.

  4. phodal commented on Oct 13, 2026

    @phodal
    Member

    @subaru-ye welcome to PR

  5. phodal commented on Oct 13, 2026

    @phodal
    Member

    @subaru-ye welcome to PR

  6. phodal commented on Oct 13, 2026

    @phodal
    Member

    @subaru-ye welcome to PR

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