Skip to content

fix(config): reject object router model refs#187

Open
MicroMilo wants to merge 1 commit into
OpenBMB:mainfrom
MicroMilo:codex/reject-object-router-model-refs
Open

fix(config): reject object router model refs#187
MicroMilo wants to merge 1 commit into
OpenBMB:mainfrom
MicroMilo:codex/reject-object-router-model-refs

Conversation

@MicroMilo

Copy link
Copy Markdown

Summary

  • reject non-string router model references during config validation
  • keep router.scenarios.default synced as the runtime-supported provider/model string
  • add regression coverage for object-shaped router refs and sync behavior

Verification

  • npm --workspace ui exec vitest run server/services/pilotdeckConfig.router-model-ref.test.js
  • npm exec -- tsc --noEmit -p tsconfig.json

Notes

This is a real UI/runtime contract mismatch: the runtime accepts provider/model strings, while the previous UI validator silently ignored object-shaped refs.

@MicroMilo

Copy link
Copy Markdown
Author

Validation note:

This PR closes a concrete router config serialization drift.

The runtime-supported router model reference contract is a provider/model string, for example:

"main/gpt-test"

Before this change, UI/server validation did not reject object-shaped router refs. In addition, syncAgentModelWithRouter preserved the object-shaped form when the existing default router scenario was already an object, producing a value like:

{ id: "main/gpt-test", provider: "main", model: "gpt-test" }

That object shape is not the runtime contract for router scenario model refs.

The regression test covers both sides of the fix:

object-shaped router.scenarios.default is rejected by validatePilotDeckConfig;
syncAgentModelWithRouter writes back the canonical string form, main/gpt-test.
Validation commands used by this PR:

npm --workspace ui exec vitest run server/services/pilotdeckConfig.router-model-ref.test.js
npm exec -- tsc --noEmit -p tsconfig.json

This is a good contract-level fix because it prevents invalid input and also prevents the UI sync path from generating the invalid shape again.

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