Skip to content

Own the unknown-model context assumption and adopt agent-core alpha.3 - #254

Merged
qduc merged 1 commit into
mainfrom
claude/epic-mendel-b94le8
Nov 11, 2026
Merged

qduc merged 1 commit into
mainfrom
claude/epic-mendel-b94le8

Conversation

@qduc

@qduc qduc commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Why

Term2 pinned @qduc/agent-core@0.2.0-alpha.2 with a pnpm patch carrying two things not yet released: the core's unknown-model scheduling assumption raised to 500,000 tokens, and the cache-usage / context-price-tier accounting. The 500,000 figure is Term2's policy, so the core owner removed the core's default instead of adopting Term2's number (qduc/agent-runtime#10, #11). 0.2.0-alpha.3 is now published: its planner schedules automatic compaction for an uncatalogued model from the host's Model.contextWindow, it exports no DEFAULT_ASSUMED_CONTEXT_WINDOW, and it includes the accounting changes (#8).

What changed

  • src/model/provider.ts: Term2 defines its own UNKNOWN_MODEL_CONTEXT_WINDOW = 500_000 (commented as Term2's scheduling assumption for models it cannot size) and uses it in the unknown-window warning and in contextWindow: catalogContextWindow ?? …. Uncatalogued models still get a 500,000-token Model.contextWindow and no catalogContextWindow, as before.
  • src/model/index.ts: dropped the DEFAULT_ASSUMED_CONTEXT_WINDOW re-export. That made the file's last runtime export, an unused ModelFailure re-export, unreachable and check-reachability failed. No production or test code imports ModelFailure from this file (runtime code takes it from src/model/failure.ts), so I removed the dead re-export and the file is now a type-only surface, which the gate treats as erased. No allowlist entry was added.
  • package.json pins @qduc/agent-core 0.2.0-alpha.3; patches/@qduc__agent-core@0.2.0-alpha.2.patch and its patchedDependencies entry are deleted; the minimumReleaseAgeExclude entry moves from alpha.2 to alpha.3 (alpha.3 was published minutes before). pnpm-lock.yaml regenerated by pnpm install; it has no patch hash for agent-core.
  • Docs: docs/reference/release-agent-core.md sections become "Retired unknown-model context patch" / "Retired cache accounting bridge" with the reason; src/model/README.md says Term2 owns the number and passes it as Model.contextWindow; AGENTS.md no longer says the core is vendored as vendor/qduc-agent-core-*.tgz (there is no such tarball; the package is an exact-pinned npm prerelease).

The wire package pin is untouched.

Verification

Revision: this branch's head, built on Node 24 / pnpm 11.7.0.

  • Release content compared by behaviour, not text: I applied main's patch to a pristine npm pack of alpha.2 and ran diff -r against alpha.3's dist. The only differences are the fix(cost): treat invalid catalog rates as unpriced #11 changes (removed constant, new assumedContextWindow planner input passed from model.contextWindow, and its validation). All accounting hunks (turn-budget.js, turn-model-compaction.js, model-cost.js, token-usage.d.ts, Usage fields) are identical.
  • node_modules/@qduc/agent-core/package.json reports 0.2.0-alpha.3.
  • Passed: pnpm exec tsc -p tsconfig.build.json --noEmit, node scripts/check-layers.mjs, check-reachability.mjs (after the src/model/index.ts fix above), check-complexity.mjs, check-rules.mjs, check-engine-callbacks.mjs, check-baselines.mjs, pnpm exec node scripts/run-ci-lane.mjs quality (22 tests), pnpm typecheck, pnpm lint, pnpm build.
  • pnpm exec node scripts/run-ci-lane.mjs provider-black-box: 48 files passed, 3 skipped (5 tests skipped by their own conditions; none in cost accounting). cache-cost.blackbox.ts ("accounts for cache creation, whole-request context tiers and one-hour writes") passed.
  • Temporary probe (not committed), through Term2's createProviderRegistry with the installed, unpatched alpha.3: an uncatalogued OpenRouter model resolved with contextWindow 500,000, no catalogContextWindow, and the warning "automatic compaction assumes 500,000 tokens". With the planner inputs that the core's compaction call site passes (catalogue capacity, and model.contextWindow as the assumption) and ratio 0.8, the planner returned not_needed at 399,999 measured tokens and went on to a compaction attempt at 400,000.

Not verified here

  • The integration, test and e2e lanes were not run in full: in this container some of their cases fail on unmodified main because bwrap/socat are missing and it runs as root. GitHub CI is the evidence for those lanes.
  • No real provider traffic; the probe reaches the planner directly rather than through a live turn.

Generated by Claude Code

@qduc/agent-core 0.2.0-alpha.3 no longer holds a default window for
uncatalogued models; its planner schedules automatic compaction from the
host's Model.contextWindow. Term2 now owns its 500,000-token figure
(UNKNOWN_MODEL_CONTEXT_WINDOW in src/model/provider.ts) and keeps supplying
it as Model.contextWindow, so behaviour for uncatalogued models is unchanged.

alpha.3 also contains the cache usage and context-price tier accounting
that the alpha.2 pnpm patch carried, so the patch and its
patchedDependencies entry are removed and the pin moves to the release.

src/model/index.ts loses its only runtime export (an unused ModelFailure
re-export that was reached only through the removed constant import) and
is now a type-only surface; runtime code already takes ModelFailure from
src/model/failure.ts.

Docs: the release reference records why the patch is retired, the model
README says Term2 owns the number, and AGENTS.md no longer claims the core
is vendored as a tarball.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JqbJBBoCXgqyyFZaYn5Co4
@qduc
qduc merged commit bcd955d into main Nov 11, 2026
8 checks passed
@qduc
qduc deleted the claude/epic-mendel-b94le8 branch November 11, 2026 15:29
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.

2 participants