Skip to content

fix(architecture): make the trusted kernel evaluate real heads - #298

Merged
hzcheng merged 2 commits into
mainfrom
agent-pivot/kernel-eval-fix
Aug 19, 2026
Merged

fix(architecture): make the trusted kernel evaluate real heads#298
hzcheng merged 2 commits into
mainfrom
agent-pivot/kernel-eval-fix

Conversation

@hzcheng

@hzcheng hzcheng commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

The trusted kernel added in PR #295 has never successfully evaluated a PR head. The workflow could not fetch the head (fixed in #297), and the evaluator itself then crashed: discoverFiles ran git ls-files inside the materialized head directory, which is not a git repository. Every trusted-kernel failure so far — including the current red on PR #296 — traces to this.

Fixes (verified end-to-end against the real PR #296 head: passes with approval, fails closed with only the protected-paths error without):

  • discoverFiles walks the materialized tree (filesystem only); the evaluator never needed git inside the head directory.
  • classifyFiles implements the canonical ** remainder-role rule from loadArchitecturePolicy (remainder must be last, claims only files no earlier role claimed). The kernel's stricter rule misclassified 119 files on a real head.
  • The kernel now shares the canonical compileGlob instead of its divergent variant (src/**/x must also match src/x).

New tests pin the remainder-role semantics and the remainder-not-last error.

Skill harvest

none — the applicable lesson (identify which side of the PR supplies a failing check's code) was already recorded in #297's .skills/fixing-regressions-with-ci update.

Known red check (bootstrap, last one)

trusted-kernel will fail on this PR: the check runs the default branch's kernel, which still contains the bug this PR fixes. After merge, the main-side kernel is fully functional and will evaluate PR #296 for real.

Owner approvals

Copy each line into a separate PR comment below (both bind the exact head SHA and expire when the head moves):

approve-architecture 2cc5b47de6e8fe51b4998293b0dc224ea908fdf3
approve 2cc5b47de6e8fe51b4998293b0dc224ea908fdf3

Change impact declaration

{
  "headSha": "2cc5b47de6e8fe51b4998293b0dc224ea908fdf3",
  "capabilities": [
    "MAIN-ARCHITECTURE-HARNESS"
  ],
  "modules": [],
  "invariants": [],
  "policyDelta": "tightening",
  "baselineWaiverDelta": "zero",
  "newFiles": [],
  "behaviors": [
    "ARCH-CHANGE-GATE-001",
    "ARCH-CLOSED-WORLD-001",
    "ARCH-INVARIANT-CATALOG-001",
    "ARCH-MODULE-BOUNDARY-001",
    "ARCH-MODULE-CYCLE-001",
    "ARCH-POLICY-SCHEMA-001",
    "ARCH-PROGRAM-LEDGER-001",
    "ARCH-SINGLE-WRITER-001",
    "ARCH-WEBVIEW-MANIFEST-001"
  ],
  "semanticImpact": {
    "stateAuthority": false,
    "writerSet": false,
    "protocol": false,
    "persistence": false,
    "identity": false,
    "recovery": false
  },
  "coordinators": [],
  "verification": "npm run test-compile; node --test tests/unit/architecture/** tests/unit/tooling/** (567 pass incl. 2 new remainder-role tests); npm run test:behavior-contracts; npm run lint; node scripts/run-trusted-kernel.js against the real PR #296 head: passes with approval, fails closed on protected paths without"
}

chenghongze added 2 commits August 19, 2026 20:38
The kernel added in PR #295 never successfully evaluated a PR head:
the workflow could not fetch the head (fixed in the transition PR), and
the evaluator itself then crashed — discoverFiles ran 'git ls-files' in
the materialized head directory, which is not a git repository.

Fixes, verified end-to-end against the real PR #296 head:

- discoverFiles walks the materialized tree (filesystem only); the
  evaluator never needed git inside the head directory.
- classifyFiles implements the canonical '**' remainder-role rule from
  loadArchitecturePolicy: the remainder role must be last and claims
  only files no earlier role claimed. The kernel's stricter rule
  misclassified 119 files on a real head.
- The kernel now shares the canonical compileGlob instead of its own
  divergent variant ('src/**/x' must also match 'src/x').

New tests pin the remainder-role semantics and the not-last error.
@hzcheng

hzcheng commented Aug 19, 2026

Copy link
Copy Markdown
Owner Author

approve-architecture 2cc5b47
approve 2cc5b47

@hzcheng

hzcheng commented Aug 19, 2026

Copy link
Copy Markdown
Owner Author

approve-architecture 2cc5b47

@hzcheng

hzcheng commented Aug 19, 2026

Copy link
Copy Markdown
Owner Author

approve 2cc5b47

@hzcheng
hzcheng merged commit d7246b2 into main Aug 19, 2026
9 of 12 checks passed
@hzcheng
hzcheng deleted the agent-pivot/kernel-eval-fix branch August 19, 2026 15:44
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