Skip to content

fix: repair the trust guarantees and research claims from the 2026-09-26 deep review - #164

Merged
CodeWithJuber merged 5 commits into
masterfrom
claude/forgekit-deep-review-issues-ww6y0h
Sep 26, 2026
Merged

CodeWithJuber merged 5 commits into
masterfrom
claude/forgekit-deep-review-issues-ww6y0h

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

An external deep review of d2abfa6 (2026-09-26) found 43 items: 16 reproduced defects (F01–F16), 15 research and documentation findings (R01–R15), and 12 architecture recommendations (A01–A12). Its common theme was a label (PASS, complete, exact, trusted, $0) that claimed more than the evidence behind it. This PR fixes every reproduced defect, each with a regression test. It also corrects the research and docs, and implements the recommendations that can be done in code.

Reproduced defects (all fixed, one regression test each):

ID Defect Fix
F01 The verification fingerprint missed untracked renames, byte moves between files, empty files, modes and symlinks Canonical manifest bound to HEAD (manifest-v2); an unreadable file makes the state unbindable
F02 forge context returned ok: true over its hard budget Tokens are measured on the rendered block; over budget means overflow: true, ok: false
F03 A - read <file> pointer counted as coverage Coverage depends on the variant; a pointer is a pending read
F04 Exact reuse keys erased >=/<=, case and literals Lossless key (whitespace only); near hits need the new semantic guard
F05 Edited or deleted cached artifacts still served File hash plus dependency contracts are checked at serve time; no atlas means unknown
F06 7/8/9/40-character spellings of one commit counted as four votes One event, one vote; abbreviations are stored under the full object id
F07 A rewritten lesson inherited the old wording's trust Evidence carries over only for equivalent rewrites; lineage is recorded
F08 A failing workspace package was hidden behind a green root suite Per-package suite plan and coverage; uncovered means INCOMPLETE
F09 A devDependency runner became a required suite Split into inventory and obligation (testInventory, "available")
F10 A PASS was signed for code that changed during the run Pre/post capture; a changed tree gives INCOMPLETE with mutated: true
F11 One $0.05 attempt predicted about $88.87 Sparse fallback to mean-log cost with an explicit variance prior
F12 Infeasible budgets looked like recommendations feasible: false, reason, minimumExpectedCost, labeled fallback
F13 Read routes had no Host check; writes had no token Host allow-list on every route; per-session token plus exact Origin for writes
F14 The exact/near benchmark rows actually timed misses Real git evidence, each tier validated before timing, cold caches cleared, re-measured
F15 Archived was treated as refuted Archive reasons in attic/<id>.log; only retracted or dormant claims drop lessons
F16 Opposite rules merged on lexical similarity Semantic guard applied to consolidation and duplicate compaction; conflicts reported

Research and docs (R01–R15). The refuted routing factor is out of the live cost model. A claim/status registry (docs/status/claims.json) is now checked in CI by scripts/claims-status.mjs --check. Theorem D and the silent-miss bound are restated. The universal-router headline is labeled repository-reported. P4 is marked partial. The Qur'anic lens is kept separate from empirical claims, with the Arabic text and translations unchanged. Citation existence and claim support are graded separately. The historical editions are indexed in research/HISTORICAL_EDITIONS.md.

Router reproduction (R10/R11/R12). bench/universal-router/reproduce.sh rebuilds the shipped prior from pinned, sha256-checked public inputs. The refit matches data/router_prior.json exactly: all 176 fitted values, with only fittedAt different. It ran on Node v22.22.2 and took about 413–424 s on a 4-vCPU Xeon, so the reviewer's 180 s limit was too short. The revision 78f471b lives in SWE-bench/SWE-bench_Verified. A new held-out experiment, holdout_eval.mjs, is labeled as new and not as a reproduction. In it the router does not beat a fixed cascade on solve rate (80.0% vs 80.6%) and is slightly cheaper. It also under-predicts cost by 5–22%, because failed attempts cost 1.2–2.0× as much as successful ones; R12 is now documented as a measured limit. The 76.3% / $0.093 headline still cannot be reproduced from this repo, because its harness is external.

Recommendations: A01 immutable, MAC'd verifier events (.forge/verify-events.jsonl), which route outcome --verify-run can cite · A02 seeded property tests (test/trust_properties.test.js) and a CI research job (49 + 23 pytest, theorem checks, recomputation) · A03 src/cli.js 3,117 → 1,670 lines by a pure move into src/cli/ · A04 src/schema.js validation for .forge/models.json, router outcomes (plus attempt ids) and evidence records · A05 imagine --run described as an isolated checkout, not a sandbox, with unsupported runners reported · A06 benchmarks record fs type, commit and uncommitted state, and forge substrate reports a capped graph · A07 docs/INTEGRATIONS.md, and route universal labels models no provider serves as advice only · A08 UI checks documented as advisory · A09 onboarding leads with three jobs · A10 cost numbers labeled as estimates, with missing logs shown as unknown and not $0 · A11 archive reasons, lineage, --fix --dry-run, and a concurrent-append test · A12 legacy and research material marked historical.

Not done here, on purpose:

  • A live or paid evaluation (review E2–E4).
  • A labeled keyboard and screen-reader set for UI checks (A08 names what one would need).
  • Rebuilt research PDFs. The old PDFs are recorded as historical, pre-correction editions in research/HISTORICAL_EDITIONS.md (git blob and sha256 for each). A fresh render set the Qur'anic Arabic in mixed fallback fonts that nobody could check, so it was not published. The refutation paper also needs a TeX toolchain, which isn't installed here.

The zero-runtime-dependency rule (ADR-0001) meant the schema and semantic-guard helpers were written in-house instead of pulling in a library.

Checklist

  • npm test passes: 1,678 tests, 1,674 pass, 0 fail, 4 platform-gated skips (Node 22 locally; CI runs the matrix)
  • npm run check passes (Biome lint + format)
  • New public functions have a test
  • Conventional commit message (feat:/fix:/docs: …)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency (dev deps ok)
  • Substrate/docs updated if this changes forge substrate, forge impact, router/gate, or MCP substrate tools

Risk & rollback

  • Risk level: medium. Several results are deliberately stricter, and scripts that read --json may need to adapt:

    • verify can now return INCOMPLETE where it used to return PASS, and stamps from older forge versions no longer verify.
    • Artifacts minted before this change never exact-hit.
    • context reports overflow.
    • route universal returns ok: false when the request is infeasible.
    • Dashboard writes need the session token.

    These warrant a minor version bump at release.

  • Rollback plan: revert the merge commit. The on-disk formats are additive: new fields, attic/<id>.log, and verify-events.jsonl. After a rollback, re-run forge verify so the stamp uses the older fingerprint again.

Extra checks (tick if applicable)

  • npm run typecheck passes
  • Input validated at boundaries; errors handled (no swallowing)
  • Authorization/ownership checked (if it touches access): dashboard Host/Origin/token
  • Logs contain no secrets/PII
  • If AI-assisted: I understand it, verified the package APIs, and it has tests

🤖 Generated with Claude Code

https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2


Generated by Claude Code

Every reproduced finding (F01-F16) gets a fix and a regression test:

- verify: the code-state fingerprint is a canonical, length-delimited
  manifest bound to HEAD (renames, byte repartitions, empty files, modes,
  symlinks; unreadable files fail closed) (F01); nested workspace suites
  are planned, run and reported as coverage (F08); a runner found only as
  a dependency is inventory, not an extra obligation (F09); a tree that
  changes while the tests run is INCOMPLETE, never a signed PASS (F10);
  each run records a MAC'd verifier event (A01).
- reuse: exact keys are lossless except whitespace (F04); near candidates
  must pass a semantic guard; artifacts are revalidated at serve time
  against their file digest and dependency contracts, and a missing atlas
  is "unknown", not "ok" (F05).
- ledger: evidence is counted per event, so aliases of one git object vote
  once (F06); a rewritten lesson inherits no trust unless equivalent (F07);
  archive reasons are recorded and an idle/duplicate archive is not a
  refutation (F15); similar-but-opposite rules are never merged (F16).
- context: the rendered block never exceeds the budget while claiming
  success, pointers are pending reads, spans/truncation are explicit
  (F02, F03, R13).
- dash: every route checks Host; writes need a session token and the
  exact origin (F13); missing spend is unknown, not $0 (A10).
- router: sparse cost fits use the mean log cost with an explicit variance
  prior (F11); infeasible budgets/targets are explicit (F12); outcomes are
  schema-validated, idempotent and labeled self-reported (A04).
- bench: every labeled reuse tier is validated before timing; all sketch
  caches are cleared for cold rows (F14, A06).
- imagine: an isolated checkout, not a sandbox; foreign runners are an
  explicit unsupported result (A05).
- CI runs the Python prototype suites and the research recomputation (A02).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
…c/cli/

A pure move (review A03): the ledger/reuse/context, verify/imagine/uicheck
and route/models/cost command handlers now live in src/cli/memory.js,
src/cli/verification.js and src/cli/routing.js, with the shared
presentation helpers (heading, paint, table, bar) defined once in
src/cli/shared.js. cli.js keeps dispatch, help and the remaining handlers
(3,188 -> 1,670 lines). Handler bodies are unchanged apart from their
relative dynamic-import paths; the package stays one installable unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
Follow-up to the 2026-09-26 deep review fixes:

- route universal (A07): each cascade step names the providers that can
  serve it and where its cost comes from; a recommendation containing a
  model no configured provider serves is labeled advice only
  (applicable: false, unmapped). The shipped default recommendation was
  two such models.
- substrate (A06): a graph truncated by the atlas file cap says so
  (capped, skippedFiles) in the result and the rendered advisory.
- verify: forge's own outputs under .forge/ (provenance.json,
  verify-events.jsonl) are no longer counted as changed files, matching
  the code-state fingerprint; nestedPackages treats an empty git listing
  as authoritative instead of falling back to a directory scan.
- router cost fit: the sparse mean-log path no longer returns a value
  from a forEach callback (Biome useIterableCallbackReturn).
- dash: template literals for the estimate labels (Biome useTemplate).
- A02: seeded property tests for manifest transformations (any
  composition moves the fingerprint, undoing restores it) and for stale
  artifacts (never served after an edit, move or deletion).
- bench: src/cli/memory.js is a labeled claimText dependent after the
  CLI handler move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
…inputs

Review R10/R11/R12: the shipped prior's refit had no in-repo path, and
the reviewer's attempt stopped at a 180 s limit.

- reproduce.sh runs the whole path on a cold machine: a venv with the
  pinned pyarrow, build_input.py (downloads the sources pinned in
  sources.json and checks each sha256), fit_prior.mjs, then
  compare_priors.mjs against data/router_prior.json. Exit 0 only when
  every value matches except provenance.fittedAt.
- Result on this container: all 176 fitted values identical (Node
  v22.22.2, Python 3.11, 4-vCPU Xeon @ 2.80GHz, fit ~413-424 s). The
  dataset revision 78f471b lives in SWE-bench/SWE-bench_Verified.
- holdout_eval.mjs is a NEW seeded 150/350 held-out experiment, labeled
  as such (not a reproduction of the external 76.3% / $0.093 headline):
  the router does not beat a dev-chosen fixed cascade on solve rate
  (80.0% vs 80.6%, paired bootstrap) and is slightly cheaper; expected
  cost is under-predicted by 5-22% because failed attempts cost
  1.2-2.0x as much as successful ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
Research and documentation findings R01-R15 plus the documentation side
of A05, A07-A10 and A12:

- Claim/status registry (docs/status/claims.json, 47 claims assessed at
  d2abfa6) with a generated table; scripts/claims-status.mjs --check
  validates it, fails on a stale table or a drifted docs/ copy of a
  research/ file, reads CRLF checkouts correctly, and now runs in the CI
  quality gate.
- Cost model: scenarios built on the refuted 0.62 routing factor are
  withdrawn; stage savings are hypotheses; a cost headline must meet a
  stated acceptance rule. Cost numbers state currency, basis and
  missing-data status (missing logs are unknown, not $0).
- Theorem D joint attainability (with counterexample), the silent-miss
  bound's equality condition, "a caught miss is not a completed task",
  the frozen-model thesis restated with in-context learning, prior art
  (CoALA, Reflexion), threshold-separated impact-oracle results;
  recompute_corrections.py --theorem-checks asserts them without data.
- Universal router: the run-4 headline is repository-reported; the
  prior's exact in-repo refit, the new held-out replay and the modeling
  limits (cost under-prediction, optimistic targets, budgets bound only
  expected cost, infeasible results, outcome provenance) are documented.
- Evidence grades split bibliographic verification from claim support,
  design, replication and transfer; METR scoped to its study.
- Qur'anic lens: source text, translation, tafsir and the author's
  design analogy are labeled separately; no Arabic text or translation
  changed (verified run by run).
- Research PDFs are recorded as historical, pre-correction editions
  (research/HISTORICAL_EDITIONS.md) and were not re-rendered.
- docs/INTEGRATIONS.md: per tool, config emission, MCP registration,
  automatic hooks and enforcement, each tested/declared/unsupported.
- README leads with the three jobs; P4/P8 partial; imagine --run is an
  isolated checkout, not a sandbox; UI checks are advisory; legacy files
  carry archive banners.
- GUIDE: verify coverage/binding/events, stack inventory, ledger archive
  reasons and conflicts, reuse semantics and revalidation, dashboard
  Host/token, route advice-only models.
- Benchmarks re-measured after the CLI move (reports/benchmarks.md,
  README, landing: 851 ms gate, 1.68 ms blast radius).
- CHANGELOG [Unreleased] covers the whole review repair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
Comment thread scripts/claims-status.mjs
Comment on lines +149 to +151
String(s ?? "")
.replace(/\r?\n/g, " ")
.replace(/\|/g, "\\|")
@CodeWithJuber
CodeWithJuber marked this pull request as ready for review September 26, 2026 21:05
@CodeWithJuber
CodeWithJuber merged commit 7eef611 into master Sep 26, 2026
13 of 14 checks passed
CodeWithJuber pushed a commit that referenced this pull request Sep 26, 2026
CodeQL flagged one new high-severity alert in #164 and two older ones.
A local run of the same CodeQL version (2.27.0, javascript-code-scanning
suite) goes from 3 results to 0 with this change.

- scripts/claims-status.mjs (js/incomplete-sanitization, new in #164):
  table cells escaped `|` but not `\`, so a trailing backslash could
  undo the escape. Backslashes are escaped first.
- src/model_catalog.js (js/polynomial-redos, pre-existing): the
  tokenizer's `/(?:\.0)+$/` and trimUrl's `/\/+$/` backtracked
  quadratically on library input. Trailing ".0" parts are popped
  instead, and URLs use a new linear stripTrailingSlashes (src/util.js).
- The same patterns in code added by #164 are hardened too: the
  workspace-glob trim (src/stack.js) and the semantic guard's edge
  punctuation trim, now a code-point scan (trimEdges).

Each replacement is checked against the regex it replaced (tokenize on
known ids; trimEdges on 2,000 seeded random tokens) and gets a
linear-time test on a hostile input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
CodeWithJuber pushed a commit that referenced this pull request Sep 26, 2026
After the 2026-09-26 review fixes merged (#164), several surfaces still
described the old behavior:

- Mintlify reference: forge verify (per-package coverage, pre/post
  binding, verifier events, .forge/forge.config.json), forge stack
  (available runners), forge context (what COMPLETE means, --budget,
  --block), forge reuse and forge ledger (lossless keys, serve-time
  revalidation, one vote per event, archive reasons, conflicts,
  --fix --dry-run), forge dash (Host check on every route, session
  token), and the universal router, which the site did not cover at all
  (objectives, INFEASIBLE, advice-only models, outcome provenance, and
  the limits of its evidence).
- Landing page: all ten native targets (OpenClaw was missing, "Nine
  native targets"). The grid is now two rows of five on wide screens and
  two columns below 1180px, checked in headless Chromium at eight widths
  with no overflow or horizontal scroll.
- Claim registry: the claims the review found refuted at d2abfa6 are
  re-assessed on 7eef611 (the merge), after re-running the review's
  probes as regression tests (46 pass; 1 skip needs a non-root user):
  verify binding, context completeness and exact reuse are implemented
  (with their scope in the notes); evidence independence and outcome
  provenance are partial; the imagine sandbox and router target claims
  stay refuted. The impact fixture's F1 is 0.28 after the CLI move.
- biome.json migrated to the installed Biome 2.5.13 (schema URL;
  `recommended` → `preset`); lint results unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
CodeWithJuber pushed a commit that referenced this pull request Sep 26, 2026
The v1.5.0 release commit (fd71bf8) moved the [Unreleased] notes of #164 under
[1.5.0] and bumped the version strings; this branch had added its own notes to
the same [Unreleased] section, so the PR could not merge and CI never ran.

Resolution:
- CHANGELOG.md: this PR's four new entries (the CodeQL fixes, the generated
  changelog page, the Mintlify reference sync and the two historical
  corrections) move back to [Unreleased]; [1.5.0] keeps exactly what shipped,
  apart from this PR's bold headline leads. Fixes a doubled "separately" in the
  Qur'anic-lens entry.
- landing/index.html: this branch's page with the release's version strings
  (softwareVersion and both "forgekit v1.5.0" labels), as scripts/bump.mjs
  writes them.
- mintlify/changelog/overview.mdx: re-rendered with `forge docs render`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVVG2VDETWsDxMu6MBWPz2
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.

3 participants