Skip to content

Enforce the local-only rule where each auxiliary call is made (#380) - #461

Merged
BunsDev merged 5 commits into
mainfrom
lm5-local-policy
Oct 31, 2026
Merged

BunsDev merged 5 commits into
mainfrom
lm5-local-policy

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

LM-5 (#380), slice 2. This makes the no-cloud-fallback rule for local threads hold where each auxiliary call is made, instead of relying on every caller to check. main still doesn't construct LocalExecution, so product behaviour is unchanged.

Why

Before this, each caller checked thread.localTarget itself:

  • the runner skipped Auto, follow-ups, naming and credit fallback;
  • the approval gate skipped Jev.

A new caller that forgot the check would leak a local thread to a cloud model or to Jev.

What changes

  • localOnly(thread) in engine/local-models/run-policy.ts is true for any persisted local target, valid or not.
  • Jev: the runner registers it through Decisions.guardThreads. Decisions.connect then returns no connection for a question naming a local thread (routing, follow-up or approval), before any key is resolved or CLI probed. Settings' Try it names no thread and is unaffected.
  • Credit fallback: creditFallback and recentCreditFallback return nothing for a local thread.
  • Naming: nameThread never asks a title model about a local thread.
  • Routines: sendUnattended refuses a local thread, and does not reroute it to a cloud model.
  • The callers' existing checks stay.

Tests

One new regression in runner-local-models.test.ts calls each chokepoint directly, with cloud controls. Disabling each of the five guards in the compiled output made it fail, and it passed again after a byte-for-byte restore.

A stub router in runner-routing-ceiling.test.ts gained the decisions seam.

Check Result
Focused (runner-local-models, local-run-policy, routing) 56/56
pnpm build && pnpm test, run 1 1 failure: the stub router above, now fixed
pnpm build && pnpm test, run 2 2,089 passed, 20 skipped, 1 failed (see below)
pnpm build && pnpm test, run 3 (head 6fbec39) exit 0; desktop 2,090 passed, 20 skipped, 0 failed; every other package green

The run 2 failure was companion-network, "each supported address has a reachable advertised listener", with a request timeout. This change doesn't touch that code, and it passed 12/12 in each of 5 isolated reruns.

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;
  • AC6, runtime context evidence;
  • AC4, real-runtime OOM, overflow and restart handling;
  • product admission of LocalExecution, which is Val's decision.

🤖 Generated with Claude Code

BunsDev and others added 2 commits October 30, 2026 21:11
Each caller checked thread.localTarget itself before skipping Jev, credit fallback, naming
or a routine turn, so a new caller could leak a local thread. localOnly(thread) in
run-policy.ts is now enforced at the chokepoints too: Decisions.connect gives a question
naming a local thread no connection before any key is resolved; creditFallback and
recentCreditFallback return nothing; nameThread asks no title model; sendUnattended refuses
rather than reroutes. The callers' checks stay.

One regression calls each chokepoint directly with cloud controls; disabling each of the
five guards in the compiled output made it fail. Docs: local-models.md, status.md and a
dated review record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 5:08am UTC

Request Review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-code-quality

github-code-quality Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 21f6a70 lm5-local-policy 95c2485 +/-
66% 66% 0%

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


Updated October 31, 2026 05:34 UTC

@BunsDev
BunsDev added this pull request to the merge queue Oct 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 31, 2026
@BunsDev
BunsDev removed this pull request from the merge queue due to a manual request Oct 31, 2026
@BunsDev
BunsDev added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 4d12737 Oct 31, 2026
13 checks passed
@BunsDev
BunsDev deleted the lm5-local-policy branch October 31, 2026 06:20

This branch was successfully deployed

1 active deployment
Preview — 95c24852 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