Repository navigation
feat(config): add opt-in revision-aware configuration sync - #35
Conversation
Commit a revision counter with every model override, catalog, key-control and grant write, poll revisions through the control-state scheduler and reload only on newer revisions, behind CONFIG_REVISION_SYNC_ENABLED, default off. Security config fails closed when it cannot be verified within its TTL. Adds the static Flask gateway registrar and migration 0017.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
multillm-proxy | c4b22a9 | Oct 08 2026, 10:29 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4b22a93ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export async function handleRevisionedAutoRoutes(request, env, { handleAutoRoutesRequest, boundedBody }) { | ||
| if (!revisionSyncSettings(env).enabled) return handleAutoRoutesRequest(request, env); |
There was a problem hiding this comment.
Route auto-route RPCs through the revision wrapper
When revision sync is enabled but snapshots are not, this wrapper is the only code that converts a normal put into revisionedSave; however, the production dispatcher in worker/intelligence-outbound.mjs still calls handleAutoRoutesRequest directly, while only the test fixture invokes this function. Consequently, dashboard auto-route saves update D1 without advancing config_snapshot_revisions, so running Containers continue serving their cached routes indefinitely. Wire this wrapper into the /v1/auto-routes production dispatch.
Useful? React with 👍 / 👎.
| "media_jobs", "media_job_items", "shadow_eval_samples", "shadow_eval_results", | ||
| "shadow_eval_config", "shadow_eval_policy_backups", "prompt_templates", | ||
| "config_snapshot_revisions", "config_snapshots", "config_snapshot_applications"]); | ||
| "config_snapshot_revisions", "config_snapshots", "config_snapshot_applications", "control_revisions"]); |
There was a problem hiding this comment.
Keep the opt-in table out of unconditional readiness
If this code is deployed before migration 0017 while CONFIG_REVISION_SYNC_ENABLED remains false, /ready now reports control_revisions missing and returns 503 because d1Readiness checks every entry in this unconditional list. That breaks the promised disabled-mode rollout and can prevent otherwise healthy Containers from becoming ready even though no enabled operation needs the table. Make this table required only when revision sync is enabled, or preserve readiness compatibility until the migration is applied.
Useful? React with 👍 / 👎.
| @login_required | ||
| def admin_status(): | ||
| if not (AuthService.get_current_user() or {}).get("is_admin"): | ||
| return jsonify({"error": "admin_required"}), 403 | ||
| return jsonify(app.extensions["config_revision_sync"].status()), 200, {"Cache-Control": "no-store"} |
There was a problem hiding this comment.
Authenticate status without requiring the failed authority
During a D1 authority outage, even an administrator with an existing dashboard session cannot reach this diagnostic endpoint: login_required calls AuthService.get_current_user(), which re-reads the account from D1 and clears the session when that read fails. Thus the newly added revision status route redirects to login precisely when operators need to inspect stale domains, despite the extension otherwise exempting admin status from the freshness guard. Provide an outage-safe administrator authentication path for this status endpoint.
Useful? React with 👍 / 👎.
Summary
Adds revision-aware live configuration sync behind
CONFIG_REVISION_SYNC_ENABLED, which defaults to false. While the flag is off, no poller or freshness guard is registered, existing reads, saves, authentication and catalog refresh timing are unchanged, and nothing reads or writescontrol_revisions.worker/control-users-d1.mjsbump both security counters atomically, with CAS for concurrent writers.CONFIG_SYNC_TTL_SECONDS=30;CONFIG_SECURITY_TTL_SECONDS=5, capped at 5.config_security_stalewhile key controls, model grants or overrides can't be verified within the security TTL.GET /admin/config/revisions(dashboard admin, 404 when disabled) shows domain revisions, ages and stale flags. It shows no keys, model lists or content.INTELLIGENCE_STORAGE_BACKEND=d1andAUTH_STORAGE_BACKEND=d1). In standalone SQLite mode it logs one warning and stays off.services/gateway_extensions.pyis the single static Flask registrar that the Wave 3 integration uses to mount the other Flask hooks in a fixed order.Details are in
docs/config-revision-sync.md.Deployment
Apply migrations 0016 and 0017 before enabling the flag. A push to main does not apply D1 migrations:
Stacking and integration
This PR is stacked on #34 (prompt cache buckets) because its migration
0017follows0016. Review only the top commit.The Wave 3 integration PR mounts the revisioned auto-route handler on the private outbound dispatcher, and adds the native Worker freshness guard and polling.
Shared registrations
tests/test_config_revision_sync_worker.mjstotest:workerandtests/test_config_revision_sync_integration.mjstotest:integration.CONFIG_REVISION_SYNC_ENABLED,CONFIG_SYNC_TTL_SECONDSandCONFIG_SECURITY_TTL_SECONDSto the Container env keys.control_revisionsto the D1 readiness tables.worker/config-revision.mjsto the secret firewall inventory.Tests
tests/test_config_revision_sync.pyandtests/test_config_revision_sync_worker.mjs: new.tests/test_config_revision_sync_integration.mjs(intest:integration, which installs the Python dependencies): a key revoked through the real D1 writer is rejected by the registered Flask auth path before its memo expires.npm run test:integration: 7 passed.npm run test:worker: 1,249 passed.cf:migrations:checkreports 17 contiguous, additive migrations.test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.tests/test_frontend_build.mjsfails locally because@tailwindcss/cliis not installed. It fails the same way on main.This is part of Wave 3, and the Wave 3 integration PR adds the README line.