Repository navigation
Description
Outcome and dependencies
Connect local selections to the existing native Codex backend while isolating connection configuration, process lifetime and session authority.
Parent: #376. Blocked for completion by: #377 (LM-1 contract/native feasibility) and #378 (LM-2 validated connection/credential/discovery service). Delivery group: Local models v1 / Gate B. Priority: P1. Follow the shared execution contract in #376. Dependencies mean accepted artifacts, not unrelated issue closure.
Context and source entry points
Refresh main, scoped AGENTS.md and open PRs. Publication baseline: ec7be578765f9ce54976882853e57ca190252361; retain newer native lifecycle and companion fixes. Existing: apps/desktop/src/main/engine/{runner,store}.ts, apps/desktop/src/main/engine/backends/{codex,types,health}.ts, apps/desktop/src/shared/types.ts. Proposed: apps/desktop/src/main/engine/local-models/{codex-profile,backend-pool}.ts, apps/desktop/test/local-codex.test.ts. Extract only focused code needed for profile selection; no broad runner rewrite.
Consumes: accepted target/provenance contract and validated private connection snapshot. Produces: connection-scoped native backend acquisition, effective configuration, safe session binding and lifecycle observations consumed by policy/UI/qualification work. One integrator owns shared runner/backend changes.
Implementation steps
- Generate validated per-child Codex configuration through the existing constructor args/env/redaction seam. Use nonreserved provider identifiers where custom definitions are required. Gate configuration against the installed CLI schema; never shell-interpolate model IDs, credentials or URLs.
- Keep coding execution in
codex app-server. Modex may discover bounded metadata but must not POST coding prompts directly to an inference server. Use a local model catalogue mechanism only when the installed app-server needs it; capture that requirement in evidence. - Replace singleton assumptions only where necessary with lazy native instances scoped by connection revision, credential/account generation and effective process-level configuration. Include model settings in the instance key when the CLI cannot vary them safely per thread. Expose normalized service identity for shared capacity accounting; do not introduce a general scheduler here.
- Bind each turn and resume handle to immutable connection/model/runtime provenance. Old cloud threads retain cloud identity. Endpoint, credential or profile-generation changes cannot silently resume against another provider. Require an explicit new native session while preserving historical UI content; never automatically replay a prior prompt/tool after uncertainty.
- Audit inherited configuration, managed policies, auth, redirects and proxy/environment precedence. Verify the effective native inference destination, including loopback proxy bypass and redirect handling. Metadata endpoint validation alone does not constrain native requests. Never edit
~/.codex/config.tomlor shell startup files and never evade managed policy through an isolated home. Unsupported policy/configuration must fail with an actionable reason. - Preserve native approvals, sandbox modes, observations, tool results, Stop and request delivery. Normal Stop stays turn-scoped. Force-stop is limited to its native instance with affected threads disclosed; never terminate the user's inference daemon or an unrelated cloud/local instance.
- Send effort, reasoning-summary, fast-tier, vision and tool settings only when supported. Coordinate native-plan/collaboration presets so they cannot override the selected local target. Local readiness must not require paid cloud-model login; failed local targets must never select cloud models.
Acceptance criteria
- AC1: a selected local model completes a real tool/edit/test fixture through the existing app-server adapter without cloud-model authentication.
- AC2: simultaneous cloud/local profiles share neither credentials nor resume handles/effective provider configuration; stopping one does not terminate an unrelated instance.
- AC3: profile edits, credential rotation and process restart cannot rebind a saved session silently or replay an uncertain action.
- AC4: existing cloud/native regression tests pass and global user configuration bytes remain unchanged.
- AC5: unsupported options are omitted or explicitly rejected; tool success and interrupted/unknown states come from native observations rather than assistant prose.
- AC6: inherited config, proxy/redirect and native-plan override cases either retain the validated local target or refuse safely. No managed-policy bypass or secret leakage enters logs/renderer state.
Verification and handoff
Start with failing configuration/isolation/session tests; use real app-server acceptance separately from fixtures. Run current focused tests plus pnpm build && pnpm test; UI changes also pnpm test:e2e. Capture full SHA, native/runtime/model/configuration versions, request/process counts and side-effect evidence. Keep original failure logs redacted, update status and dated review evidence. No unapproved download, merge or release.
Long-running goal prompt
Implement LM-3 for TypeSafeAI/modex under #376 using #377/#378's accepted artifacts. Read current AGENTS.md, source and open PRs; verify main and your owned worktree. Begin with configuration, instance-isolation and resume-binding tests, then the smallest real local turn. Use the existing Codex configuration seam and ThreadRunner. Keep cloud instances unchanged, scope process lifetime correctly, audit native config/proxy/redirect precedence and prevent presets from overriding the local target. Preserve approvals, sandbox policy, events and Stop. Refuse unsupported configurations instead of adding an API executor. Work one acceptance slice at a time, run targeted/full checks, update status/evidence and make signed reviewable commits. Checkpoint SHAs, versions, actual results, remaining gates and one next step. No merge, release, global settings changes or unapproved downloads.
Follow-up / resume prompt
Resume LM-3 from live issue/PR evidence and its checkpoint. Verify ownership and actual diff; recheck #377/#378 contracts, connection revisions, actual process keys and saved-session provenance. Test cloud/local concurrency, connection edits, credential rotation, native-plan settings and Stop before continuing. Diagnose failures without relaxing sandbox policy or repeating uncertain tool actions. Preserve native event mappings and global user settings. Rerun smoke/full checks, record exact versions and fresh criterion-level evidence, and leave unrun native/human gates explicit. No merge, publication or architecture expansion.
Activity
BunsDev commentedon Oct 23, 2026
Refreshed goal prompts — 2026-10-23 (
mainat203a350)On
mainalready:collaborationMode.settingsmodel overrides the turn-level model, so a local run has to pin both and must refuse when no local model is selected.Still open:
lm3-isolationbranch holds one unpushed docs commit,665c095onec7be57. It is a prerequisite audit (docs/reviews/2026-10-22-lm3-prerequisite-audit.md) and a status line. The audit maps the seams inbackends/codex.ts,backends/health.ts,backends/account-codex.ts,runner.tsandshared/types.ts, and records 107 existing Codex, account and runner tests passing. It claims nothing about local execution.048d1e8onlm1-contract. LM-2 ([P1][LM-2] Add secure local connections and bounded model discovery #378) is draft PR LM-2: secure local connections and bounded model discovery (#378) #386 with two review defects open. The audit notes that LM-2'sresolvedoes not prove the native destination, immutable resume binding or credential generation. LM-3 has to test those itself.lm3-isolationas claimed by another session. Thelm-foundationsession wants to do the shared runner and backend integration too. [Tracker][LM] Integrate local models through native harnesses with verified compatibility #376 asks for one integrator for those files, and nobody has settled who it is.Leftover local worktrees:
lm3-isolation(unpushed665c095) andlm-foundation(untracked review and design docs only).Long-running goal prompt
Follow-up / resume prompt
BunsDev commentedon Oct 26, 2026
Checkpoint 2026-10-26 — PR #417, branch
lm3-codexfrom maindeb373a; commits2460ec5(implementation and tests) and7ca83db(docs), SSH-signed.LocalExecution(isolated child per thread), theCodexBackendlocal seam (pinned provider/model, native confirmation, no foreign resume, no stale-auth retry), runner admission and target switching, wiring inindex.ts. No UI.MODEX_LM3_LIVE=1 MODEX_LM3_URL=… MODEX_LM3_MODEL=… node --test dist/test/local-codex-native.test.js, needs Val's server and model); redirect handling and managed-policy precedence (LM-5); runtime qualification (LM-6); interface (LM-4).LM-3: run a thread's local target through its own Codex child (#379)
LM-3: close product admission and drop reasoning summaries for local …
BunsDev commentedon Oct 27, 2026
Checkpoint 2026-10-27: #417 (
lm3-codex) is rebased onmain6c9000fat9159edawith the two review findings repaired (product admission closed until AC6 is qualified; no reasoning-summary option for a local child). #419 (lm5-policy, stacked on #417) qualifies the AC6 remainder: effective-configuration admission through Codex's ownconfig/read/configRequirements/readwith managed, project and dirty-home layers refused by name, amodel/reroutedrefusal, and real-CLI redirect evidence (body follows a 307, token never does; recorded, not preventable). Evidence:docs/reviews/2026-10-26-lm3-local-codex.md#review-repair-2026-10-27anddocs/reviews/2026-10-27-lm5-destination-policy.md. Still open: AC1 live turn (Val), a live managed-policy run, and the decision to wireLocalExecutioninto main.Prove global Codex config bytes and token records; redact tokens acro…
Prove global Codex config bytes and token records; redact tokens acro…
BunsDev commentedon Nov 12, 2026
AC1 and AC4 now have applicable evidence on protected main
5f1f1fe8bfa93ee971de7b443f794335ae9c414e. Its tree is exactly the native-tested2bd27e068003bc7306645f56dab368ab66399594from head7d2d6c89de5a262d08876777a907568acd4a4405; the source diff is empty. The earlier receipts are no longer branch-only.AC1’s real native-adapter fixture used Codex 0.167.0 and the already authorized local Qwen coding model through the existing
codex app-serveradapter. It recorded three matching native tool starts/succeeded outcomes: a read, an explicitly approved edit and an explicitly approved independent check. Retained literal files contain the expected edit bytes and exactly one successful check effect. The private child excludes cloud authentication. The same kernel boundary applies to client and owned server, with external-network/outside-write denial controls. Native receipt and limits.For AC4, protected queue run 43127440657 passed 2,471 units with 36 skips, 514 desktop E2E cases with eight skips, and seven site cases, with zero failures/cancellations. The native workflow records identical personal configuration SHA-256 and modification time before/after, plus unchanged synthetic configuration bytes/tree. Independent review and a fresh root recheck verified all 14 original evidence hashes and all 13 non-controller archive files. The archive’s controller is the documented pre-finalization snapshot; the external canonical terminal receipt supplies final state. Raw CLI session files were removed by normal disposal and are not claimed as retained evidence.
Only AC1 and AC4 are being ticked. AC6 remains open: the retained native 307 fixture forwards the coding body to another endpoint while withholding the token, which does not meet selected-destination retention or safe refusal; live managed-policy acceptance is also unrun. Existing simultaneous cloud/local isolation claims retain their fixture scope. Normal product execution remains unadmitted, and this update grants no activation or broader compatibility approval. Issue #379 stays open.
BunsDev commentedon Nov 12, 2026
Current-version AC6 diagnostic: the installed Codex 0.167.0 still follows a 307 from the configured loopback endpoint to a second endpoint with the coding body. The existing canonical redirect fixture was run once normally and once under the existing loopback-only kernel policy; these were separate boundary cases, with synthetic servers, prompt and token, no model and no inference. Each diagnostic passed because it asserts the observed forwarding behavior; that result records an unmet selected-target invariant.
Under the kernel boundary, server A and server B each received a POST to
/v1/responsescarrying 29,109 bytes and the synthetic prompt. Only A received bearer authorization. The 302 case reached B as a bodyless GET. Both native turns completed using B’s answer. Before the test, worker 8839 recordedEPERMfor the external-TCP and outside-write controls. The policy permitslocalhost:*, so those denial controls do not bind inference to the selected loopback endpoint.Independent review and root rehash verified the retained request, boundary, source and terminal artifacts. Personal configuration SHA-256 and modification time were unchanged within this run. All five sampled processes later returned
ESRCH, and all four fixture ports returnedECONNREFUSED; this is sampled cleanup evidence, not exhaustive descendant discovery. The native CLI inherited the outer policy; only the actually emitted Node worker receipt is claimed.AC6 remains open, and production execution stays unadmitted. Any repair must address the validated target itself rather than relying on external-TCP denial or token withholding alone. The current official provider configuration reference does not document a per-provider redirect switch; that documentation check alone does not prove the absence of every native capability. No product source, activation or acceptance checkbox changed for this diagnostic.
BunsDev commentedon Nov 13, 2026
Current LM-3 diagnostic checkpoint on macOS 27.2.1 arm64 with actual Codex CLI 0.167.2: the destination guard is still unqualified, and AC6 remains open. No product admission, activation or checkbox change follows from these probes.
A localhost port-only Seatbelt rule does not pin the address family: a native 307 redirect can send the same request body from selected IPv4 loopback to IPv6 loopback on the same port. An IPv6-only socket-family rule also permits an IPv4-mapped loopback redirect. Byte digests and server-side connection/received-byte observations are retained; these are not packet-capture claims. Literal numeric-IP syntax was refused by the sandbox compiler rather than treated as a working guard.
An IPv4 socket-family outbound rule blocks the tested same-port IPv6 redirect and permits a narrow native read after explicit single-command approval. However, that read did not establish native workspace-sandbox compatibility. The subsequent controlled comparison preserves native workspaceWrite policy and declines every approval/escalation: the unwrapped native fixture edit succeeds, while the same edit beneath the outer Seatbelt fence returns native tool exit code 71 with
sandbox-exec: sandbox_apply: Operation not permitted. The fixture remains unchanged. The scripted assistant can still complete its reply after that tool failure, so turn completion is explicitly not counted as a successful edit. Read-approval denial was independently preserved both with and without the fence.The first mode-control attempt timed out during unwrapped app-server startup before any request; that first failure is retained and unexplained. A bounded startup-capture follow-up reached all four comparisons, and a further two-case output capture isolated the native tool error above. Real CLI configuration bytes/mtime remained unchanged; originals and byte-verified copies are retained. All six recorded native children from the captured comparisons were sampled absent afterward, and all twelve corresponding IPv4/IPv6 address probes refused connections.
The existing offline qualification boundary explicitly supplies a declared host boundary for its private canary. That is a separate scope. It does not justify labeling a network-only product wrapper as a native-equivalent filesystem sandbox. No externalSandbox override was added to these comparisons, no native approval was relaxed, and no proxy/API inference executor, paid inference, real model/server or managed-policy change was used. The next implementation must prove supported destination binding together with the required native mode/filesystem/approval behavior; managed-policy, runtime/offline-server, Stop/resume and admission gates remain open.
BunsDev commentedon Nov 13, 2026
LM-3 native boundary follow-up: the trusted OS-helper experiment repairs the earlier Agent-mode
sandbox_applyfailure, but it cannot be admitted as the product solution. An independent review identified a Full Access path around its executable-wide exemption; a bounded actual Codex 0.167.2 control confirmed it. With the parent fence alone, a synthetic tool attempting to replace its sandbox fails with exit 71 and the unselected loopback endpoint receives zero connections/bytes. With the helper exemption, the same Full Access tool supplies a permissive profile and POSTs the 33-byte owned sentinel to the owned same-port IPv6 endpoint, without bearer credentials. This is a Full Access counterexample, not an unapproved default Agent escape or evidence of the inference client redirecting.The broad helper exemption is rejected for product use. Supported native modes and approval/escalation semantics remain requirements; they are not removed to make the experiment pass. AC6 remains unticked. The earlier invalid Python control is retained and excluded, and the prior eight-case packet's missing pre-execution generated-module identity remains a provenance limitation. The new counterexample records 443 generated-file hashes before/after at clean source
249154d57f7f4f849b79f87ea0fd259768ce6a86; these do not retroactively bind the earlier packet.This used only synthetic private fixtures and loopback responders, with no real model, paid inference, personal credential, external endpoint, product wiring or admission. Both sampled native PIDs were absent and all four post-run address probes refused connections; personal Codex configuration bytes/mtime stayed unchanged. The full mode, approval/permission, managed policy, identity/race, Stop/process-tree, runtime and genuine offline qualification gates remain open. The next implementation needs an enforceable destination boundary that preserves the native execution contract.