Skip to content

[P1][LM-4] Expose local connections and capability-aware models in the Modex interface #381

Open

Description

@BunsDev

Outcome and dependencies

Make connection setup, model choice, compatibility testing and the active inference destination understandable inside the existing Modex interface, without an app redesign.

Parent: #376. Fixture/start prerequisite: accepted #377 (LM-1) contract. Completion dependencies: #378 (LM-2 discovery), #379 (LM-3 native execution), #380 (LM-5 local policy). Delivery group: Local models v1 / Gate B. Priority: P1. Follow the shared execution contract in #376. Fixture work may proceed in parallel, but completion needs actual integration with all three producers.

Context and source entry points

Refresh main, scoped AGENTS.md, current Settings/IPC owners and open PRs. Publication baseline is ec7be578765f9ce54976882853e57ca190252361; do not revert later work. Existing: apps/desktop/src/renderer/components/{Composer,ModelMenu}.tsx, existing Settings host, main/preload/shared IPC and thread/paired-client serializers. Reuse existing themes, components, draft ownership and #273's conversation UI. Proposed: apps/desktop/src/renderer/components/LocalModelsSettings.tsx, apps/desktop/e2e/local-models.spec.ts. No new navigation framework or separate chat store.

Consumes: non-secret profile/model descriptors, qualification evidence, native run identity and main-owned policy. Produces: existing-interface local settings/selection/status flow and safe display/controls for supported paired clients. Renderer capability flags never grant authority.

Implementation steps

  • Add Settings → Local models: connect, refresh, inspect connection/model status, remove, and explicitly test a selected model. Refuse removal while a live run depends on the connection until safe. All validation/admission remains in main. Opening settings/refreshing must not start inference, install software or download weights.
  • Extend the current model menu with connection grouping, search and exact model identifiers; retain explicitly entered custom IDs. Preserve drafts, attachments, selection and keyboard focus through delayed refreshes. Show endpoint reachability separately from model qualification.
  • Render unverified, tested-for-recorded-configuration and unsupported states with concrete reasons. A user-started compatibility test uses the accepted native path and clearly disclosed disposable scope. Do not convert a successful greeting or advertised tools into a coding-ready badge.
  • Display inference location separately from the existing Local/Worktree workspace choice and native harness identity. Label a connection to this machine accurately; only claim local execution/offline verification at its actual evidence level. Loopback alone is not a privacy guarantee.
  • Enable images, reasoning, structured controls and other options only when supported by the actual combination. Block incompatible attachments before send; do not silently discard bytes. Local sessions are explicitly pinned in v1; cloud Auto cannot select or replace their target.
  • Retain existing themes, minimum-window behavior, accessible labels, focus, keyboard navigation and reduced motion. Capture loading/ready/unavailable/unsupported/cancelled states with deterministic fixtures; do not hide failed qualification behind a neutral empty state.
  • Paired desktops/phones display the host doing inference rather than implying on-phone execution. Reuse the delivered companion/request broker and main-owned policy. Older clients receive safe readable/non-actionable fallbacks for unsupported target-changing controls. Full mobile Settings parity is out of scope.

Acceptance criteria

  • AC1: through actual controls, a user adds a connection, discovers/selects/tests a model, runs a local task, sees truthful destination/qualification and reconnects without losing the target.
  • AC2: unsupported actions have explanations; failed tests, unreachable servers and unknown locality cannot appear ready or offline-verified.
  • AC3: switching threads/profiles during delayed refresh preserves drafts/attachments and cannot silently swap model/endpoint.
  • AC4: keyboard/minimum-window flows work in real Electron; screenshots and behavioral tests cover loading, ready, unavailable, unsupported and cancelled states. Human screen-reader checks remain separately recorded.
  • AC5: desktop and supported paired clients agree on host/model provenance while credentials stay in main. Forged/stale controls cannot bypass producer policy.
  • AC6: existing cloud model selection, Local/Worktree controls and conversation behavior remain intact; no unrelated navigation redesign is introduced.

Verification and handoff

Start with failing model-picker/settings/race tests through existing Electron fixtures and actual main/IPC. Run focused UI tests, then pnpm build && pnpm test and pnpm test:e2e. Inspect screenshots rather than accepting goldens blindly. Record SHA, viewport/theme, exact results, separate mock/native/human gates and accepted producer versions. Update status and dated review evidence. No merge/release/default activation.

Long-running goal prompt

Implement LM-4 in TypeSafeAI/modex under #376 using #377's contract and #378/#379/#380 producers. Read current AGENTS.md, source and open PRs; verify main and owned worktree. Fixture work may start after #377, but do not claim completion without live producer integration. Extend existing Settings, Composer and ModelMenu. Keep connection health, tested compatibility, workspace location, inference host and harness distinct. Preserve drafts, attachments, focus, themes and main-owned authority. Use failing-first UI/race tests, inspect real Electron states, run targeted/full checks and prepare signed reviewable commits with status/evidence updates. Checkpoint exact SHAs, results, versions, remaining native/human gates and one next action. No merge, release, global settings changes, downloads or unrelated redesign.

Follow-up / resume prompt

Resume LM-4 from current issue/PR and checkpoint. Verify ownership, actual diff and accepted producer contracts. Walk the actual connection-to-task flow, then delay refresh while switching threads/profiles. Check draft/attachment preservation, unsupported options, local-versus-worktree wording, inference evidence, keyboard access and older-client fallback. Fix one acceptance gap without redesigning navigation or duplicating main policy. Rerun smoke/full checks and inspect screenshots; distinguish fixtures from native/human evidence. Update criterion receipts and leave unrun gates open. No merge, publication or scope expansion.

Activity

  1. BunsDev commented on Oct 23, 2026

    @BunsDev
    ContributorAuthor

    Refreshed goal prompts — 2026-10-23 (main at 203a350)

    On main already:

    Still open:

    Local worktrees lm1-contract, lm2-discovery, lm3-isolation and lm-foundation are claimed by other sessions. Don't adopt or edit them. lm-foundation holds uncommitted LM review and design notes.

    Long-running goal prompt

    Implement LM-4 (#381) in TypeSafeAI/modex under tracker #376. Read AGENTS.md, #376's shared execution contract, #377–#380, draft PR #386, docs/status.md and, once it lands, docs/local-models.md; then verify main's SHA. Create your own worktree with scripts/worktree.sh new and check; never edit the primary checkout or another session's worktree. Gate: start fixture work only after #377's contract is accepted, and claim completion only after integrating with #378, #379 and #380 as they actually landed. Slice 1, Settings → Local models inside the existing SettingsDialog: connect, refresh, inspect, remove and explicitly test a model through #386's main-owned channel. Opening or refreshing never starts inference, installs software or downloads weights, and removal is refused while a live run depends on the connection. Slice 2, ModelMenu: group by connection, add search, show exact model IDs, keep manual IDs, and show endpoint reachability separately from qualification. Drafts, attachments, selection and focus survive a delayed refresh or a thread switch, with no silent model or endpoint swap. Slice 3, status: unverified, tested-for-this-configuration and unsupported states with reasons; inference host shown apart from Local/Worktree and the harness; loopback is not called private or offline; options and attachments enabled only when the combination supports them, and blocked before send otherwise. Local threads stay pinned, and Auto can't replace them. Slice 4, paired clients: show which host runs inference, reuse the companion broker and main policy, and give older clients a readable fallback they can't act on. Coding turns run only through the codex and claude CLIs; add no API client. Write failing tests first, including races. Run pnpm build && pnpm test && pnpm test:e2e, and inspect screenshots in both themes at minimum window size. Update docs/local-models.md, docs/status.md and a dated docs/reviews/ receipt. Keep fixture, native and human evidence separate. Open signed PRs and wait for Val's go-ahead to merge.
    

    Follow-up / resume prompt

    Resume LM-4 (#381). Confirm you own the worktree, fetch main, and read the latest comments here, on #376–#380 and on #386. Check whether #377 is accepted and whether #378, #379 and #380 have landed; if a producer changed its interface, adapt to it rather than duplicating its policy. Re-run the local-model UI and race tests. Walk connection → model → test → local task, then switch threads during a delayed refresh. Fix one acceptance gap at a time. Post a checkpoint: SHA, results, producer versions consumed, what's left for a human (screen reader), and one next action.
    
  2. BunsDev commented on Nov 12, 2026

    @BunsDev
    ContributorAuthor

    Reconciled two independent requirements against protected main 0f43631dec22db5ca9390e35613a139ae61bff07: implementation step S4 and AC6. This advances #381 to two of 13 boxes; the issue and the other eleven boxes remain open.

    • S4, inference/workspace/harness distinction: Composer separately displays Codex, the configured endpoint and connection revision, with an explicit warning that a local address does not verify offline operation. Its checkout/Worktree controls remain separate. The model menu identifies the model/connection and warns that the server can route messages elsewhere. The Electron fixture asserts the rendered destination label. This is a display/control result, not proof of native inference, offline privacy or ordinary product admission.
    • AC6, existing behavior and navigation: existing cloud model/effort and workspace controls remain in their current components. Cloud-return handling confirms the exact selected cloud model while preserving transcript content. The actual Electron fixture checks stale revision refusal, cancelled cloud return and confirmed return to the named cloud model. Protected Integrate local-model workflow and native recovery with closeout evidence #498/Preserve manual local-model IDs after metadata failure #499 regression runs passed 514/518 desktop cases respectively, each with eight explicit skips, plus seven site cases. Skipped native/human cases are not credited.

    Independent full-criterion audit found concrete remaining implementation work: the model menu has no search; Settings/main have no user-started native compatibility-test command, qualification evidence store or tested/failed-state consumer; the phone thread serializer lacks model and inference-host provenance. Delayed metadata-refresh/thread/profile/attachment/focus coverage, the complete local-model keyboard/minimum-window/state matrix, older-client presentation and human acceptance also remain incomplete. Normal product execution remains unadmitted; scripted transport and disposable native bootstrap evidence do not complete AC1. These gaps are implementation and acceptance work, not waived requirements.

  3. BunsDev commented on Nov 12, 2026

    @BunsDev
    ContributorAuthor

    S2 and AC3 literal-clause reconciliation: both UI/race criteria are now supported on signed main 558b54f8fa0cb3679852c6ece2b07e23a3b10ffb, tree 3ba66a4, after protected #499, #502 and #503 delivery. An independent audit checked the full text against production wiring, canonical tests, actual queue logs and retained receipts. This supports only these two boxes; it does not complete #381 or admit local execution.

    Clause On-main evidence
    Grouping, search, exact and custom IDs ModelMenu.tsx filters connection labels/origins/model IDs while rendering original opaque IDs and connection groups. Production-main/IPC model-search.spec.ts covers mixed-case exact IDs, groups, delayed results, no-match and keyboard query editing. local-models.spec.ts and manual-visibility units retain explicit custom IDs after metadata failure without admitting execution; unreadable-credential and rejected-IPC cases instead prevent descriptor reconstruction.
    Drafts, attachments, selection and focus through delayed refresh Queue-passed local-model-preservation.spec.ts holds Alpha metadata while switching between cloud and Beta threads, then verifies both exact multiline drafts, unchanged staged PNG bytes, composer selection 1–5, search selection 0–4 and search focus, empty transcripts and zero sampled coding/send/retry calls. local-model-profile-revision.spec.ts verifies unsaved name/custom-ID fields and name selection 0–3 survive positively delivered metadata. The normal production picker case separately preserves query/focus/raw draft while unadmitted.
    Reachability is separate from qualification Settings shows metadata Answered/Unavailable with concrete reasons, separately from coding capability’s unverified status. A metadata-ready group does not become a coding-ready badge: normal production selection is refused because product execution is unavailable, and no target is persisted.
    Profile/endpoint changes cannot silently rebind the target The canonical profile case edits the endpoint through Settings to revision 2 and positively receives new metadata. Its exact captured old request completes stale; the existing Beta thread remains pinned to revision 1 and the original model/raw draft, with truthful unavailable-server provenance. Discovery/store generation and revision checks do not write thread targets. Production discovery IPC separately proves stale old-request/new-endpoint handling without the admitted fixture bootstrap.

    Search delivery #502, preservation delivery #503, and actual queue run. The latter passed attempt 1 with 2,478 unit passes/36 skips, 522 desktop passes/eight skips and seven site passes, zero failures/cancellations or observed retries. Both canonical preservation receipts name actual checkout 558b54f8, return from app close and report all four sampled coding/send/retry counters as zero. Independent full-clause audit SHA-256: 2ad4118f4a68b125d109c234ca03d9fec18c6edc2fb39e4f4c2ec5967030fd55.

    Limits remain explicit: the admitted target setup in the two preservation fixtures is synthetic; it is not production admission or native inference. Endpoint supersession cancels the old HTTP response before its exact main request completes stale, so it does not prove rejection of a delivered late body. The preserved selection failure also reproduced before metadata delivery and was corrected by establishing the intended initial range, without weakening the before/after assertions. Compatibility-test/qualification controls, tested-state persistence, full keyboard/minimum-window matrix, paired host/model provenance, producer integration and human/native/device acceptance retain their own requirements. Only S2 and AC3 are checked; all other issue states remain unchanged.

  4. BunsDev commented on Nov 12, 2026

    @BunsDev
    ContributorAuthor

    S5 literal safety acceptance

    The complete S5 safety requirement is supported on protected main 5a580d4f98f5b1c62c5801db4400d5b533634082. Unsupported features remain restricted; this clause does not require positively qualifying image, reasoning, Plan or structured-output support.

    • Composer blocks local image submission before dispatch and preserves staged bytes. The independent main/runtime guards also reject incompatible images, Plan/pages/knowledge before spawn; test(local-models): preserve drafts and selection across metadata races #503's canonical queue case verifies exact staged PNG bytes and raw drafts survive refresh and thread switching.
    • Existing PlusMenu disables Plan, Auto and backend changes with reasons; the local model menu omits reasoning controls. The native adapter strips unsupported effort/fast flags and disables unqualified image/web/subagent options. Main validates the effective configuration and refuses forged or mismatched target/option mutations.
    • Local targets are explicitly pinned: local means Auto is false, reroutes interrupt rather than silently rebind, live target changes are refused and no cloud fallback can replace the local target. The intervening Conserve low coding credits across Auto routes and retries #505 quota/runner changes retain these guards; no broad Conserve low coding credits across Auto routes and retries #505 review is claimed.

    Evidence: production Composer, native option/refusal tests, runner pinning/forgery tests, and protected preservation queue. Independent remaining-clause audit SHA-256: 416d35f9c32eeb5dfbae4dbe827fa192c64abccf4856d9a45d6b6ae2f454e62e.

    Only S5 advances, from four to five of 13 boxes. Compatibility-test/result UI, ordinary producer integration/admission, full qualification/state/theme/keyboard/minimum-window coverage and paired host/model provenance remain open. Fixture/native-adapter guards do not activate production local inference or qualify any actual model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:local-modelsenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions