Skip to content

feat: preserve full cloud context and migrate provider policies - #625

Merged
Ooooze merged 1 commit into
mainfrom
codex/cloud-model-context
Oct 8, 2026
Merged

Ooooze merged 1 commit into
mainfrom
codex/cloud-model-context

Conversation

@Ooooze

@Ooooze Ooooze commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Cloud providers currently inherit the context limits intended for small local models: selected instructions and tool output can be clipped, and older results can be rewritten after a reply. This change gives cloud models a full, persistent message history so later requests reuse unchanged earlier content.

  • Add provider-level modelMode: local|cloud, exact per-model overrides, and /llm model-mode switching. Keep one policy snapshot per turn and propagate the actual provider's policy through Fusion and fallback.
  • In cloud mode, preserve complete selected instructions, loaded skills and obtained tool output; append state changes to a persisted journal with stable call IDs. Native and flat requests use the same history. Keep local packing, truncation and result aging unchanged.
  • Account for the complete request and output reserve against the provider window. Compact near capacity while retaining active instructions; do not silently clip cloud content when compaction fails. Explicit tool retrieval ranges and dispatch safety limits still apply.
  • Select cloud mode automatically for new recognized cloud connections. Migrate configs below v75 once: recognized cloud providers without a saved mode receive cloud; explicit provider/model settings and local or unknown endpoints remain intact. Manual local and inherit choices survive subsequent loads.
  • Document the shipped behavior and remaining research, Fusion and memory policy work.

Validation:

  • npm test: 1,122 files passed; 13,608 tests passed, 4 skipped.
  • npm run lint, npm run typecheck:tests, npm run imports:check, npm run docs:check, and git diff --check passed. No new test-type diagnostic allowances.
  • Coverage includes full cloud content, history stability and resume, local-mode compatibility, cancellation, fallback, compaction, migration persistence and manual override precedence.

These are offline correctness checks; live provider cache hit rates, quality, latency and cost have not been measured. Previously clipped local history cannot be reconstructed. The existing context-compaction implementation is already in main via #618 and is not reintroduced by this PR.

@Ooooze
Ooooze merged commit 606ef73 into main Oct 8, 2026
2 checks passed
sosidudku1 added a commit that referenced this pull request Oct 12, 2026
Brings in #621 (queued local model switching), #625 (modelMode, config
v75) and #618 (compaction).

Conflict resolution:
- local-models-orchestrator: #621's ModelOperationQueue now owns
  serialization and supersession of starts, stops and selections, so the
  branch's startGeneration counter is dropped. setActive keeps #621's
  queued request; the Core engine and its signal are passed through to the
  chat and embedding starts. Core loads are still tracked so Stop and
  shutdown can cancel a non-replacing embedding start the queue would not
  abort; the queue signal and the Stop signal are combined. stopGeneration
  and captureStopGuard stay for composer route changes. chooseEngine runs
  through the queue so an engine change supersedes a waiting start.
- daemon-lifecycle: keep both engine and healthTimeoutMs/signal options.
- models start: runLocalModelsStart takes { interactive, signal }.

The engine setting is an additive optional field defaulting to
llama-server, so no config migration is needed after v75.
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