Skip to content

fix: preserve CLI model override across config loads - #814

Merged
tomdps merged 4 commits into
mainfrom
codex/migrate-pr-792-to-main
Jul 28, 2026
Merged

fix: preserve CLI model override across config loads#814
tomdps merged 4 commits into
mainfrom
codex/migrate-pr-792-to-main

Conversation

@tomdps

@tomdps tomdps commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Main-trunk migration

Replaces #792 after the trunk cutover. Both isolated commits now start from the new main; original authorship and the contributor’s implementation are preserved.

Original PR body

Summary

Preserve a validated CLI model override when a conductor dynamically loads another cluster config. Existing agent configs now drop only their runtime-materialized model projection before operation-chain validation, while newly authored raw model fields remain subject to the repository's modelLevel policy.

Related Issues

Addresses #718

Changes Made

  • Clone and normalize already-persisted agent configs before validating a proposed dynamic config.
  • Make same-ID proposal replacement match runtime replacement semantics, keeping add/load/update payloads visible to validation.
  • Reject authored raw model fields even when their value equals the active override.
  • Cover the conductor load_config path in-process and through a real detached CLI daemon.
  • Route validation, execution, and topology simulation through one config-reference resolver.
  • Reject path-like static config and base-template names before filesystem access.

Scope Boundary

This PR fixes successful CLI model-override propagation through conductor load_config. It does not change the generic failureInfo persistence or agent task/PID reconciliation behavior also described in #718; those lifecycle-hardening items remain follow-up work.

Testing

  • node tests/run-tests.js tests/model-override.test.js (11 passing)
  • node tests/run-tests.js tests/e2e/cluster-lifecycle.test.js (2 passing)
  • npm run lint
  • npm run typecheck
  • npm test (1708 passing, 18 pending)
  • npm run test:e2e (25 passing)
  • npm run test:slow
  • npm run dupcheck
  • npm audit --audit-level=moderate --omit=dev
  • Targeted Prettier and git diff --check origin/dev...HEAD

npm run format:check still reports the same 15 pre-existing files on unmodified dev at ef5ed29; none overlaps this change, and all changed files pass targeted Prettier.

Checklist

  • Tests pass (npm test)
  • Documentation updated (not needed; behavior-only fix)
  • Follows commit guidelines

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown

Greptile Summary

Preserves CLI model overrides while validating dynamically loaded cluster configurations.

  • Normalizes persisted agent configurations before operation-chain validation while retaining authored model-policy checks.
  • Aligns same-ID proposal replacement with runtime operation behavior.
  • Centralizes static and parameterized config loading behind a path-safe resolver.
  • Adds unit, integration, security-boundary, and detached-daemon coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/orchestrator.js Normalizes persisted agent models for validation, aligns same-ID proposal replacement, and shares config resolution between validation and execution.
src/template-resolver.js Adds centralized named-config resolution with identifier validation and canonical containment checks.
src/template-validation/simulate-random-topology.js Routes simulated load_config operations through the same resolver used at runtime.
tests/model-override.test.js Covers override propagation and enforcement of authored raw-model restrictions.
tests/load-config-path-security.test.js Exercises traversal and path-like input rejection across validation and execution.

Sequence Diagram

sequenceDiagram
    participant CLI
    participant Orchestrator
    participant Validator
    participant Resolver as TemplateResolver
    participant Runtime
    CLI->>Orchestrator: Start cluster with modelOverride
    Orchestrator->>Orchestrator: Persist override and materialize agent models
    Runtime->>Orchestrator: load_config operation
    Orchestrator->>Orchestrator: Clone existing configs and remove runtime model projections
    Orchestrator->>Resolver: resolveConfigReference(config)
    Resolver-->>Orchestrator: Loaded agent configuration
    Orchestrator->>Validator: Validate proposed operation-chain state
    Validator-->>Orchestrator: Valid
    Orchestrator->>Runtime: Execute load_config
    Runtime->>Runtime: Apply persisted modelOverride to loaded agents
Loading

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@tomdps
tomdps added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 4d8ccf3 Jul 28, 2026
10 checks passed
@tomdps
tomdps deleted the codex/migrate-pr-792-to-main branch July 28, 2026 21:52
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.8.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants