[codex] harden model control apply runtime and config validation#133
Merged
[codex] harden model control apply runtime and config validation#133
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR hardens the model-control apply path by replacing webhook fan-out with direct provider adapters, validating apply config strictly, and adding targeted runtime tests.
Issue and User Impact
/api/admin/model-controls/applyand related production operations were brittle due to:MODEL_CONTROL_APPLY_CONFIG_JSONrisk (especially trailing literal\\nartifacts),Impact: admins could hit apply failures/500s, and operations were harder to reason about and maintain.
Root Cause
Why This Solves Root Cause
runApplyService) and validates config before execution.vercelandrailwayobjects.Changes by Surface
API
src/app/api/admin/model-controls/apply/route.tsinvalid_apply_configuration).getApplyServices()+runApplyService()and preserves audit logging.Control Plane Runtime
src/lib/agents/control-plane/apply-config.ts\\n/\\rartifacts.src/lib/agents/control-plane/apply-runtime.tsTests
src/lib/agents/control-plane/apply-config.test.tssrc/lib/agents/control-plane/apply-runtime.test.tsBackward Compatibility
ok.internalTokenfield remains tolerated in config parsing for compatibility with previously written payloads.Validation
npm test -- src/lib/agents/control-plane/apply-config.test.ts src/lib/agents/control-plane/apply-runtime.test.ts --runInBand✅npm run typecheck:app && npm run typecheck:agent✅npx biome lint src/app/api/admin/model-controls/apply/route.ts src/lib/agents/control-plane/apply-config.ts src/lib/agents/control-plane/apply-runtime.ts src/lib/agents/control-plane/apply-config.test.ts src/lib/agents/control-plane/apply-runtime.test.ts✅Reviewer Passes
Accepted Risks / Follow-ups
apply-runtimestill contains single-project production fallback defaults. This is intentional for current unreleased single-project scope, but should be revisited if multi-env reuse expands.UI Evidence
/Users/bsteinher/.codex/worktrees/0e60/PRESENT/artifacts/webm/model-controls-showcase-2026-02-26T04-00-18-414Z.webm/Users/bsteinher/.codex/worktrees/0e60/PRESENT/artifacts/screenshots/model-controls-before.png/Users/bsteinher/.codex/worktrees/0e60/PRESENT/artifacts/screenshots/model-controls-after.png