Repository navigation
Description
Outcome and dependencies
Accept the smallest connection/model contract and prove the installed Codex app-server can use it before building the complete interface.
Parent: #376. Completion dependencies: none. Delivery group: Local models v1 / Gate A. Priority: P1. Consume the architecture, privacy invariants and shared execution contract in #376. This is the first implementation issue; parent closure is not a prerequisite.
Context and source entry points
Publication baseline: ec7be578765f9ce54976882853e57ca190252361; refresh current main and open PRs before work. Reuse #273's accepted conversation contracts and the already-landed #373 iPhone broker integration; do not recreate them.
Existing: AGENTS.md, apps/desktop/src/shared/types.ts, apps/desktop/src/main/engine/backends/{types,codex}.ts.
Proposed: apps/desktop/src/shared/local-models.ts, docs/local-models.md, apps/desktop/test/local-model-contract.test.ts. Proposed paths are additions, not claims of existing modules.
Produces: reviewed connection/model/run-provenance types, migration semantics, compatibility-evidence contract, exact native configuration/source map and a reproducible native feasibility receipt. Downstream issues consume those accepted artifacts, not invented parallel contracts.
Implementation steps
- Read current main, scoped instructions, open PRs, [Tracker] Native conversation fidelity: execution → transcript → recovery → Notes #273 and the native backend schemas. Record the exact source map, CLI version and supported configuration mechanism. Reconcile changed source rather than treating the historical audit SHA as the required base.
- Separate harness (
codex/claude), connection, opaque exact model identifier, credential reference and run provenance. PreserveBackendIdas the execution harness. Specify versioned connection/model references and additive thread migration; do not turn every inference server into a tool executor. - Define independent connection-health and compatibility states. Capabilities use supported/unsupported/unknown plus evidence and tested configuration. Record effective context separately from advertised maximum. Tool use, images, structured outputs, reasoning, resume and cancellation are distinct capabilities. Changing relevant model/runtime/template/configuration invalidates prior qualification.
- Perform an explicitly authorized native app-server probe against an already installed local model: initialize, select model, run a harmless read/tool round trip in a disposable fixture, interrupt, and continue safely. Test arbitrary model IDs and actual catalogue requirements. A terminal
--ossdemonstration or synthetic greeting alone is insufficient. - Inspect version-specific provider wire and native tool requirements using the official references in [Tracker][LM] Integrate local models through native harnesses with verified compatibility #376. Capture actual request/response shapes, not assumed Chat Completions compatibility. Record unsupported controls and the safe unavailable behavior.
- Document the narrow policy boundary: bounded metadata discovery HTTP belongs in main; coding inference stays inside native CLIs. Preserve the no-direct-coding-inference rule. Record local app/account admission behavior without bypassing existing account or managed-safety policy.
Acceptance criteria
- AC1: the accepted contract identifies connection and revision independently of model name/cloud account; legacy thread fixtures retain their original meaning.
- AC2: a real app-server probe records exact version/configuration, observed tool result, interruption and safe continuation evidence, or Gate A remains explicitly blocked with a reproducible reason.
- AC3: no model-brand allowlist, direct coding-inference client, second agent loop or tool executor is introduced.
- AC4: capabilities distinguish metadata assertions from observed tests; greeting success is not coding qualification.
- AC5: the source/interface map is sufficient for discovery, execution, UI and policy consumers without duplicate identity models. Existing account/safety constraints remain intact.
Verification and handoff
Use failing-first contract/migration tests and fresh repository-required checks (pnpm build && pnpm test; UI changes also pnpm test:e2e). Native probes use explicit authorization and disposable data, never unapproved downloads or production edits. Record mock versus native evidence separately with full SHA, CLI/runtime/model/configuration versions, exact commands/results and remaining gates. Update docs/status.md and a dated docs/reviews/ receipt. No merge/release.
Long-running goal prompt
Implement LM-1 in TypeSafeAI/modex under #376. Read this issue, the tracker architecture/shared execution contract, current AGENTS.md, source and open PRs. Verify current main and an owned worktree. Establish the minimal connection/model/run-provenance and qualification contracts. Inspect the installed app-server schema and existing launch seam, then prove a harmless local tool round trip, Stop and safe continuation before downstream work assumes support. Keep legacy threads, account policy and native-only execution intact. Work one acceptance slice at a time with failing-first tests. Run targeted and required checks, update status/evidence and prepare signed reviewable commits. Checkpoint full SHAs, exact results, native/runtime/model versions, unresolved gates and one next step. No merge, release, global configuration changes or unapproved downloads.
Follow-up / resume prompt
Resume LM-1 from the live issue/PR and checkpoint. Verify worktree ownership and inspect the actual diff. Recheck whether the installed CLI schema, native probe or connection contract changed. Reproduce the smallest native feasibility test and resolve only the remaining contract ambiguity. Do not substitute terminal documentation, mocks or a greeting for app-server/tool evidence. Rerun relevant smoke and required checks, separate native evidence from fixtures and update each acceptance receipt. Leave unverified gates open with an exact next action. Do not merge, publish or widen scope.
Activity
BunsDev commentedon Oct 23, 2026
Refreshed goal prompts — 2026-10-23 (
mainat203a350)On
mainalready:apps/desktop/src/shared/local-models.tsanddocs/local-models.mddo not exist onmain, anddocs/status.mdhas no local-model entry;collaborationMode.settingsmodel takes precedence over the turn-level model, so LM-3 must pin both.Still open:
048d1e8, on the locallm1-contractbranch. It has not been pushed and has no PR. It addsshared/local-models.ts, seven contract tests,docs/local-models.md, a dated receipt (docs/reviews/2026-10-22-lm1-feasibility.mdplus probe scripts and filtered JSON) and a status entry. It is based onec7be57, so it needs a rebase onto currentmain.codex app-server(codex-cli 0.163.0) run against the user's installed Strata 0.1.47 runtime withqwen3.8-flash-next-iq3_s. It covered selecting an unlisted model ID with fallback off, a sentinel read, an interruptedsleep, explicit background-terminal cleanup and continuation on the same thread. Nobody has accepted it on this issue. An unpublished review in thelm-foundationworktree recommends accepting it for narrow consumption and asks for a sanitized runtime launch config in the handoff.thread/resume, native Plan mode, edit/test, images, structured output, offline/network-denied runs, Electron or companion UI.shared/local-connections.tstypes. Its model refs lackschema: 1. Its runtimes (ollama,lmstudio,responses) do not map one-to-one to LM-1's profiles (ollama,lmstudio,llamacpp,vllm,custom). The accepted contract has to settle one shared identity.Leftover local worktrees:
lm1-contract(unpushed048d1e8),lm2-discovery(PR #386),lm3-isolation(unpushed docs checkpoint665c095),lm-foundation(untracked review and design docs only) andlm6-runtimes(clean atmain). Raw LM-1 probe artifacts are outside the repo under~/Documents/Codex/artifacts/modex-lm1/2026-10-22/.Long-running goal prompt
Follow-up / resume prompt
BunsDev commentedon Oct 24, 2026
LM-1 checkpoint: the original producer landed through #397 as
ffb9e1dba5d8f214d91a2514fccb0e26b8153372. PR #400 now targets main at signed headcb7ca6c30a3aa68012187aaf508cc552c84445d3, incorporating main6c40547ab05eff9fd6095da8e570affcd331cf51and resolving the parent squash conflicts. Owned branch/worktree:lm1-handoff. Its eight-file diff contains the canonical identity/runtime mapping, schema-1 model factory, tested LM-2 consumer patch, sanitized Strata launch configuration and explicitly unapproved network-policy proposal.Fresh local
pnpm build && pnpm testandpnpm typecheckpassed: 2,038 passed, 16 skipped, zero failures; focused LM-1 tests passed 9/9. Hosted CI/E2E, iPhone and Windows/Linux checks passed on prior head8b3b35ed16c76c39b70c56fb2128417576ae8445; the current head has separate new checks. The recorded native receipt remains Codex 0.164.0, Strata 0.1.47,qwen3.8-flash-next-iq3_s, context 32768, ordinary tool read/Stop/terminal cleanup/same-thread continuation. This finish work ran no new inference and changed no global configuration or models.Val: please accept or reject narrow Gate A and record the exact accepted producer SHA here, and decide the AGENTS metadata proposal in #400. LM-2 adoption remains gated on that acceptance. Ollama/LM Studio probing still requires your separate explicit authorization. Plan, fresh-process resume, offline and broader runtime qualification remain open. No merge of #400 is authorized or performed; the next action is the acceptance decision.
BunsDev commentedon Oct 24, 2026
Gate A: accepted (narrow), 2026-10-24
Val approved Gate A in an LM-2 Claude Code session on 2026-10-24 ("i approve"). This comment records that decision.
Accepted producer:
mainatbb0e1a42ac7bb3e11ccfee05a40d8a02f1dc10c4, specifically the LM-1 contract inapps/desktop/src/shared/local-models.tsfrom #397 (ffb9e1dba5d8f214d91a2514fccb0e26b8153372) plus #400's identity reconciliation (ConnectionRef, schema-1LocalModelRef,localModelRef, and theLocalConnectionProfile↔LocalMetadataRuntimemapping).Accepted native evidence, for this combination only:
codex app-server(codex-cli 0.163.0, refreshed on 0.164.0) with Strata engine 0.1.47,qwen3.8-flash-next-iq3_s, effective context 32768, loopback, fallback disabled. It covers an unlisted exact model ID, a native tool read of a sentinel, an interrupted command with explicit background-terminal cleanup, and continuation on the same thread. Seedocs/reviews/2026-10-22-lm1-feasibility.md.Not covered by this acceptance:
Downstream: LM-2's adoption of this contract is draft #403. Its LM-1 files are identical to
bb0e1a4, and it is stacked on #402, which is stacked on #398. LM-3 (#379) may now consume the accepted contract within the scope above.docs: record Gate A acceptance for the contract LM-2 consumes (#377, #…
BunsDev commentedon Oct 24, 2026
Val separately approved the #400 AGENTS.md loopback-metadata boundary in this LM-1 task on 2026-10-24. The approved scope is the existing proposed wording: bounded main-owned loopback metadata reads using only the configured connection's credential, with no prompts/files/cloud credentials, proxy/redirect routing, inference, model lifecycle operations or tool execution. The narrow Gate A acceptance at
bb0e1a42ac7bb3e11ccfee05a40d8a02f1dc10c4remains as already recorded; #378/#379 can consume that accepted producer and the approved metadata boundary within their own gates.Val also authorized an installed-model probe, then explicitly selected “Defer until a local coding model exists” after inventory: Ollama 0.40.10 has no models; LM Studio has only an embedding model on this Mac, while its LLM entries belong to a linked device. No inference was attempted, and no weights were downloaded/imported. Ollama/LM Studio coding qualification remains deferred. This records approval and deferral decisions, not downstream merge authority; the documentation follow-up is being verified in owned
lm1-native-approval.BunsDev commentedon Oct 26, 2026
Completion audit against main
d717bb0861378718783513ae34895bfd50ae09c8: closing LM-1 for the narrow Gate A scope Val already accepted. The accepted producerbb0e1a42ac7bb3e11ccfee05a40d8a02f1dc10c4and approval-documentation mergee5252ea6a66a3d38ca76975211adaf8e0b55af96are ancestors of current main. The shared contract and its tests are byte-identical to the accepted producer.shared/local-models.ts; LM-2 consumes that identity.docs/local-models.mdsupplies the consumer/source map, native configuration precedence and account/safety boundaries. The approved metadata exception and exact acceptance/deferral decisions are preserved indocs/reviews/2026-10-24-lm1-acceptance.md.The optional Ollama/LM Studio coding probe was explicitly deferred by Val until an eligible local coding model exists. Closing this producer does not qualify Plan, fresh-process resume, edit/test, account/profile isolation, UI, other runtimes or network-denied operation. Those gates remain with #378–#383 and tracker #376; #417's outstanding review findings are unaffected. Source worktrees remain protected by their owners and the pruning guards.