Skip to content

Keep a local context window's sources apart and refuse one above the advertised maximum (#380) - #462

Merged
BunsDev merged 1 commit into
mainfrom
lm5-context
Oct 31, 2026
Merged

BunsDev merged 1 commit into
mainfrom
lm5-context

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

LM-5 (#380), AC6: context-window evidence. main still doesn't construct LocalExecution, so product behaviour is unchanged. This PR is independent of #461 and touches different code.

What changes

The window a local child runs with was already the person's explicit localContextTokens, never a cloud default. This PR keeps each of its sources apart:

  • LocalModelDiscovery.advertisedContext(model). Main's record of what the runtime's last ready listing advertised for each model, by connection revision, with checkedAt. It counts Ollama's context_length, LM Studio's max_context_length and a /v1/models max_model_len.
    • A typed model records nothing.
    • A failed listing neither adds nor erases the record.
    • An edit or delete clears it.
  • LocalExecution. A new optional constructor parameter reads that record.
    • validate refuses a window above a known advertised maximum, before any process starts.
    • The admitted provenance gains context: { configured, source: "person", effective, advertised | "not-checked", loaded: "unknown" }.
    • No supported runtime reports the size it actually loaded, so loaded stays unknown.

Wiring discovery's record into a constructed LocalExecution comes with product admission, which is Val's decision.

Tests

New regressions in local-model-execution.test.ts and local-model-discovery.test.ts. Disabling each of the four guards in the compiled output made its regression fail:

  • the refusal;
  • the provenance context;
  • the discovery record;
  • the invalidate cleanup.

Both passed again after a byte-for-byte restore.

Check Result
Focused (execution, discovery, run-policy, runner local models) 58/58
pnpm build && pnpm test (head 5ea3f19) exit 0; desktop 2,091 passed, 20 skipped, 0 failed; every other package green

No UI changes.

Docs: docs/local-models.md, docs/status.md and the review record.

Still open on #380:

  • AC2, the network-denied offline canary, which needs Val;
  • AC4, real-runtime overflow, OOM and restart handling;
  • product admission.

🤖 Generated with Claude Code

…advertised maximum (#380)

AC6: the window a local child runs with is the person's explicit setting, never a cloud
default. LocalModelDiscovery now keeps each listed model's advertised context by connection
revision (typed models, failed listings and edited connections record nothing).
LocalExecution refuses a window above a known advertised maximum before spawning, and its
admitted provenance records configured, effective, advertised (or not-checked) and an
unknown loaded size.

Regressions in the execution and discovery suites; disabling each of the four guards in
the compiled output made its regression fail. Docs: local-models.md, status.md and a dated
review record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 31, 2026 3:04am UTC

Request Review

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main f51ef7e lm5-context 5ea3f19 +/-
66% 66% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@BunsDev
BunsDev added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 7eec3bf Oct 31, 2026
13 checks passed
@BunsDev
BunsDev deleted the lm5-context branch October 31, 2026 05:00

This branch was successfully deployed

1 active deployment
Preview — 5ea3f19b Deployed Oct 31, 2026 by vercel[bot]
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