Skip to content

LM-2: secure local connections and bounded discovery, review fixes (#378) - #398

Closed
BunsDev wants to merge 9 commits into
mainfrom
lm2-fixes
Closed

BunsDev wants to merge 9 commits into
mainfrom
lm2-fixes

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

LM-2 for #378 under #376, with the two defects from the independent review of draft #386 fixed.

This branch replays #386's six commits (3654053) onto main unchanged and adds a fix commit and a docs commit. #386's branch is still claimed by another session, so this is a separate PR rather than a push to it. Close whichever one you don't keep.

Fixes (each began with a failing regression)

  • P1: a failed profile write changed an old revision's credential. Each saved token now has its own versioned secret entry, local_connection:<id>:<uuid>, and the profile names the entry it uses. An edit writes the new token, then the profile, and removes the superseded entry only after the profile is durable. A failed write removes the new entry instead. The tests inject EIO on the profiles-file rename for rotation, clear, endpoint move with and without a token, delete and create. Revision 1 keeps its token and address, the view doesn't change and no orphaned entry is left.
  • P2: successful metadata could reflect the token into IPC. A listing whose model ID contains the saved token, exactly or embedded, is rejected whole as reflected-credential. It is never redacted into a different identity. Manual IDs holding the token are left out, and other manual IDs survive. Fixtures cover Responses, LM Studio and Ollama listings. IDs that only resemble the token are kept exactly.

Known trade-off: a very short token rejects any listing that contains it. That fails closed and shows as reflected-credential. Profiles saved by the unmerged draft read as tokenless, which also fails closed.

Unchanged: reconciling with LM-1's contract (schema 1 and the shared ConnectionRef) waits for #397. No UI or execution binding. Evidence is fixture-only; real Ollama and LM Studio metadata is still a gate.

Checks (on 954cd5b, base 203a350; merges cleanly with 70123b9 and with #397)

  • Targeted local-model-* tests: 25/25.
  • pnpm build && pnpm test: exit 0. Worktree 117/117, core 16/16, desktop 1861 passed with 16 skipped, native 21/21, site 10/10, Store 16/16.
  • pnpm typecheck: exit 0.
  • e2e/local-models-ipc.spec.ts: 1/1.

Every commit is SSH-signed. Details are in docs/reviews/2026-10-22-lm2-connections-discovery.md#review-fixes-2026-10-23.

🤖 Generated with Claude Code

BunsDev and others added 9 commits October 23, 2026 18:48
Same-machine HTTP(S) origins only; localhost resolutions re-checked at
connect; redirects, credentials-in-URL, queries and unexpected paths
refused; deadline, byte cap and cancellation; fixed error text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Profiles live in app/local-connections.json without secrets; optional
tokens use the existing SecretStore under local_connection:<id>. The
renderer view carries presence only. Revisions move when runtime,
address or token change; a token never follows a changed address;
stale edits are refused; deletion leaves a non-resolving tombstone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ollama (tags/ps/capped show), LM Studio (/api/v0/models, /v1 fallback)
and Responses-compatible (/v1/models) metadata reads only. Exact IDs,
installed/loaded/kind/advertised states or unknown, cloud-routed and
embedding models unselectable, manual IDs kept on failure. Size, count
and time bounds; superseded, edited or deleted reads return stale.
The resolver test seam is always wrapped by the loopback check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
local-models:command validates request shape strictly and is registered
localOnly; edits and deletes invalidate in-flight discovery. Store
desktop's offline demo refuses it. Adds a production-IPC Electron spec,
the dated review receipt and the status entry; completion stays blocked
on #377.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al (#378)

Each saved token now gets its own versioned secret entry, and the profile
names the entry it uses. Edits write any new token first, then the profile,
and remove the superseded entry only after the profile is durable; a failed
write drops the new entry instead. Failure-injection tests cover rotation,
clear, endpoint moves, create and delete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A local server that echoes its bearer token into a model ID no longer gets
it into IPC: the listing is rejected whole as `reflected-credential`, never
redacted into a different model identity, and manual IDs holding the token
are left out. Exact and embedded fixtures cover Responses, LM Studio and
Ollama listings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 24, 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 24, 2026 12:09am UTC

Request Review

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 70123b9 lm2-fixes 954cd5b +/-
65% 65% 0%
View coverage of the 8 most impacted files.
File main 70123b9 lm2-fixes 954cd5b +/-
apps/store-desk...rc/main/demo.ts 95% 95% 0%
apps/desktop/sr...gine/secrets.ts 100% 100% 0%
apps/desktop/sr...shared/types.ts 100% 100% 0%
apps/desktop/sr...dels/service.ts 0% 95% +95%
apps/desktop/sr.../connections.ts 0% 100% +100%
apps/desktop/sr...ls/discovery.ts 0% 100% +100%
apps/desktop/sr...point-policy.ts 0% 100% +100%
apps/desktop/sr...-connections.ts 0% 100% +100%

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

BunsDev added a commit that referenced this pull request Oct 24, 2026
…378)

Val accepted Gate A narrowly on 2026-10-24 for main at bb0e1a4: the
LM-1 contract (#397, #400) and the recorded Strata combination only (see
the acceptance comment on #377). local-models.md, both status bullets
and the LM-2 receipt now say so instead of "not accepted", and list
what remains open: native Ollama/LM Studio metadata reads, the AGENTS.md
network wording, the #386/#398 choice and the landing order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BunsDev added a commit that referenced this pull request Oct 24, 2026
BunsDev added a commit that referenced this pull request Oct 24, 2026
#405 recorded Val's Gate A acceptance and approval of the AGENTS.md
metadata boundary, plus a CLI inventory with no local generative model.

Resolutions:
- docs/local-models.md keeps main's status line. The adoption paragraph
  now says #403 adopted the contract and that #386 and #398 are
  superseded.
- docs/status.md keeps main's LM-1 entry, which now says LM-2 consumes
  it through #403. The LM-2 entry records the approved boundary and
  says LM-2's discovery has not yet run against a real runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BunsDev

BunsDev commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Superseded: this work landed on main through #403 as e17aebd2fd4a2c691ee4e8946b5c2ef767aa023a, a single squash of #398's commits, #402's hardening and the LM-1 adoption. Closing so it isn't merged separately. The branch and its worktree are left as they are, and the PR can be reopened if needed.

@BunsDev BunsDev closed this Oct 24, 2026

This branch was successfully deployed

1 active deployment
Preview — 954cd5b7 Deployed Oct 24, 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