Skip to content

Integrate LM-2 discovery, credential repairs and accepted LM-1 contracts - #401

Closed
BunsDev wants to merge 39 commits into
mainfrom
lm2-land
Closed

BunsDev wants to merge 39 commits into
mainfrom
lm2-land

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

This integrates LM-2 profiles and bounded loopback metadata discovery with the accepted LM-1 identity contract. Configured credentials fail closed when unavailable, token copies are rejected across profile edits and rotation, and late or superseded discovery cannot expose stale results. Metadata uses the canonical model factory, runtime alias and capability vocabulary; it does not enable UI or coding execution.

The candidate includes #398 at 954cd5b7d0627333835db41f9b0dfb477b72176f, #402 at a5da8292b87b89b142854c8c0dba31e692ef2d63, #403 at 2956c1a011fe3a54ed8839d87544056fbad0bd57, and #405 at 36466b2425e086891ac3f9957542b9aeec635543, reconciled with main e3527f457842c6eff9c793f8efe7883013954d93. Source branches remain untouched and their PRs stay open until this replacement is delivered.

Narrow Gate A acceptance and metadata approval and probe deferral are recorded on #377. The approved boundary and receipt are included from #405. Additional Ollama/LM Studio coding probes remain deferred until an installed local coding model exists. No real runtime, inference, download or global configuration change was performed by this integration.

Validation of signed implementation 34a5ad437bcf29bfbdc42047eb4f0f82a82173a9: focused local-model tests 48/48; full build passed; unit tests 2,123 passed, 22 skipped, zero failures; typecheck passed; targeted Electron IPC 1/1. Independent review approved the integration and confirmed credential protections and current-main behavior were preserved. Published head 59bb12b399f843fc2e4ba4fd30afab97e3764bcf adds documentation only. No renderer behavior changed.

The integration receipt preserves failing-first regressions and earlier checkpoints. Prior hosted run 40080044753 passed on the older head a0aff49; fresh hosted checks and protected delivery are still required for this head. Fixture evidence does not qualify native inference, offline operation, broader runtimes or human acceptance. Refs #378 and #376.

BunsDev and others added 19 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]>
The installed CLI moved from 0.163.0 to 0.164.0, which invalidates the
earlier receipt. Same Strata build (all ten runtime hashes match), same
probes: schema selection and real read -> Stop -> continuation passed again.
Records the schema delta and keeps every earlier boundary.

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

Failing-first regressions, each confirmed against 954cd5b before the fix:

- An unreadable, wrongly shaped or newer-version local-connections.json
  read as empty and the next save replaced it, losing every profile and
  tombstone (AC6 history). Only a missing file reads as empty now; list
  and every edit throw a fixed message and leave the file byte-for-byte,
  and resolve/provenance return null. Entries this build can't validate
  are written back exactly as found and are never listed or resolved.
- A saved token pasted into the label or a manual model ID was written to
  the plain-text profiles file and returned in views (AC3). Create and
  update refuse it, including when a new token is already inside a saved
  name or ID. An address change still drops the token, so nothing saved
  can repeat it.
- Token entries left by a crash between saving a token and its profile,
  or by a failed clear on delete, stayed in secrets.json. After every
  successful save, local_connection entries no profile (live or foreign)
  names are removed; other secrets are never touched. SecretStore gains
  names(), which lists entry names only.
- resolve() reports credentialUnavailable when a saved token can't be
  decrypted, for discovery to act on in the next commit.

The token-reflection fixture no longer saves a manual ID holding the
token, since that is now refused at save time.

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

Failing-first regressions, each confirmed against 954cd5b before the fix:

- When a profile's saved token couldn't be decrypted (keychain locked or
  unavailable), discovery sent the metadata reads without it and could
  report "ready" from an unauthenticated answer. It now returns
  "unavailable" with the new fixed reason credential-unavailable, keeps
  manual IDs, and makes zero requests (AC3, AC1).
- Each read had a deadline but a whole discovery did not: 32 Ollama
  /api/show reads just under the per-request deadline, four at a time,
  held the answer for ~7.2 s at a 1 s deadline (~40 s at the default).
  A discovery now ends within three per-request deadlines: listings use
  at most two, and per-model reads share what remains. Detail still
  unread at the deadline stays "unknown", not a failure; a real cancel or
  supersede still returns stale.

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

Regression coverage only; both passed on first run against 954cd5b, so
neither found a defect.

- Through LocalModelsService (the path local-models:command takes), a
  slow read is stale after a label-only, manual-IDs-only, address or
  token edit, and after deletion; an untouched profile still reads. The
  existing stale test drove the store and invalidate() directly.
- Endpoint policy: octal and trailing-dot IPv4 and fullwidth "localhost"
  normalize to loopback origins; IPv4-compatible, NAT64 and other
  embeddings of 127.0.0.1, "localhost." and port 65536 are refused.

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 10:49am UTC

Request Review

BunsDev and others added 9 commits October 24, 2026 01:16
Receipt section "Hardening, 2026-10-24": each defect, the failing
assertion it began with on 954cd5b, the regression-only coverage that
found nothing, request counts, and exact command results on b12483c.
Status names the hardening on lm2-integrate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Applies the LM-1 session's consumer patch
(docs/reviews/2026-10-24-lm1/lm2-identity.patch, written against
954cd5b) on top of the hardening commits; it applied without conflicts.

- shared/local-connections.ts no longer declares its own ConnectionRef.
  It imports and re-exports ConnectionRef and schema-1 LocalModelRef from
  shared/local-models.ts, and LocalRuntime is an alias for
  LocalMetadataRuntime.
- Discovered and manual descriptors build their model with
  localModelRef(connection, exactId), so each carries schema: 1 and a
  copied revision. IDs are not normalized.

Failing first: the Ollama fixture's model assertion, updated by the
patch to expect schema: 1, failed against the merged tree before the
source half was applied. No other behaviour changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The network-boundary wording LM-1 proposes for AGENTS.md says discovery
refuses proxy routing. Node 24 can route http.request through
HTTP_PROXY when NODE_USE_ENV_PROXY or --use-env-proxy is set, and the
bearer token would reach that proxy before the loopback check on the
response. A child process with each setting and a recording proxy shows
the read and its token go straight to the loopback target; the proxy
sees nothing.

Regression only: it passed first on Node v24.22.0, because each request
uses its own agent (agent: false). Removing that from the compiled
policy makes the test fail, so it would catch a change that reached the
global agent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Descriptors reported advertised tools/vision/reasoning, a second
capability vocabulary beside #377's Capability (tools, images,
structuredOutputs, reasoning, resume, cancellation). advertised is now
Record<Capability, Advertised>:

- vision becomes images, from the same runtime facts (Ollama "vision",
  LM Studio type "vlm"/"llm").
- structuredOutputs, resume and cancellation are always "unknown",
  because none of these listings advertise them.

The values are still runtime metadata, never qualification. Failing
first: the Ollama, LM Studio and Responses fixtures, updated to the
six-key shape, failed against the old three-key descriptors.

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

Receipt section "LM-1 adoption, 2026-10-24": the merge of LM-1's
reconciliation (91deb28, not yet on #397), the identity patch, the
capability keying, the proxy regression, what was deliberately not
adopted, and exact results on 1211708. docs/local-models.md now says the
consumer patch is applied on lm2-adopt instead of "not yet adopted";
status names lm2-adopt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reconciliation this branch merged as local 91deb28 is published in
#400 (lm1-handoff at cb7ca6c, same contract files), and #397 merged to
main as ffb9e1d. The receipt records the #400 merge and the results on
its merged head 1cf5ca2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BunsDev and others added 2 commits October 24, 2026 04:00
…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]>
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main bb0e1a4 lm2-land a0aff49 +/-
65% 65% 0%
View coverage of the 8 most impacted files.
File main bb0e1a4 lm2-land a0aff49 +/-
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 BunsDev changed the title fix(local-models): integrate identity and credential review repairs Integrate LM-2 discovery, credential repairs and accepted LM-1 contracts Oct 24, 2026
@BunsDev
BunsDev marked this pull request as ready for review October 24, 2026 10:50
@BunsDev

BunsDev commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing: LM-2 landed on main as e17aebd through #403, which carried this branch's connection store, discovery and credential work plus the accepted LM-1 identities. This branch is now behind main (it still reads version 0.3.0 and drops files main has), so nothing here remains to land. LM-3 continues from main on lm3-codex (#379).

This branch was successfully deployed

1 active deployment
Preview — 59bb12b3 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