Repository navigation
feat(task-service): support sharded policies and policy model tokens - #561
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
AI Code Review (gemini /
|
AI assistance
Antigravity AI assistant was used to implement, test, and verify this change.
What changed
cloudflare/task-service/src/policies.mjs(loadProjectPolicies) supporting optionalPROJECT_POLICY_DEFAULTS, shardedPROJECT_POLICIES_<N>JSON bindings (decoupling Cloudflare's 5.1 kB per-binding limit), fail-closed duplicate-key checks, andmodels[provider]: "policy"expansion from bundledconfig/api-tier-models.json.loadProjectPoliciesintostate.mjs,projects.mjs, andcompletion-webhooks.mjs."policy"and"policy:<simple|standard|complex>"model token support in directmode: "api"submissions (task-admission.mjs+api.mjs), resolving the newest live provider model viaselectAPIModeland storing the resolved concretemodelandcomplexity.How verified
node --test test/routing.mjs: 32/32 passed (including unit tests forloadProjectPoliciesdefaults/sharding/policy expansion andresolveTaskSubmissionlivepolicy:standardresolution).PYTHONPATH=src /usr/local/bin/python3.13 -m unittest discover -s tests/task_service -q: 322/322 passed.QuantAIService V2 CI,CodeQL,Engineering governance,Documentation check,GitGuardian) and Codex review (chatgpt-codex-connector) passed on head commitf94944f14a.Why
Cloudflare Workers text/JSON env bindings have a 5.1 kB limit that made adding new projects to
PROJECT_POLICIESfragile, and direct API callers (such asDrift Check) had to hardcode model IDs that break when providers retire models.Risk
R2 — worker admission and policy loading only. Fully backward-compatible with existing unsharded
PROJECT_POLICIESand pinnedrequest.modelcallers. Rollback is a single-commit revert.