Repository navigation
Enable controlled Knowledge authoring qualification - #64
Conversation
|
OpenRouter review posted ( |
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 security review |
|
Codex Review: Didn't find any major issues. 🎉 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". |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 171562319fc7232f04eee01699df32429e2bea1d
Judge: openai/gpt-5.6-luna
Cost: $0.4056 (lanes $0.4019 + judge $0.0038)
Lanes
openai/gpt-6.1-sol: ok (1 finding(s), 56.0s, 488988+1941 tokens (415375 cached), 7 tool round(s), via Azure, $0.27)z-ai/glm-5.3-flash: ok (6 finding(s), 217.0s, 3596403+28838 tokens (3465984 cached), 48 tool round(s), via BaseTen, $0.13)
Warning
z-ai/glm-5.3-flash: coverage claims 1 finding(s) in 'worker/src/support-browser-commands.d1.test.ts' but 0 were reported
Warning
z-ai/glm-5.3-flash: coverage claims 2 finding(s) in 'worker/wrangler.jsonc' but 1 were reported
Findings
🔵 Issue 1 — Stale disabled-state claim in the source-bridge documentation
docs/KNOWLEDGE_COMPOSITION.md:343 · nit · identified by openai/gpt-6.1-sol
An operator reading the Support learning boundary is told that the root request composition still keeps Knowledge disabled, although deploying this PR enables it. This contradicts the activation section and can mislead qualification or rollback decisions.
Lines 343–344 retain keeps Knowledge disabled. The missing private-source verifier is still accurate, but it disables source-dependent operations rather than the entire Knowledge host. Update this paragraph to distinguish enabled ordinary authoring from unavailable private-source workflows.
I checked worker/wrangler.jsonc, handleKnowledgeRequest in worker/src/knowledge-host.ts, and the revised source-bridge explanation later in this document. The configuration now supplies PEGMA_KNOWLEDGE_ENABLED=true, and the request handler permits initialization with that value without supplying a private-source verifier.
🟠 Issue 2 — Docs and PR say deployment "remains pending" while CI auto-deploys the enabled profile on merge to main
docs/KNOWLEDGE_COMPOSITION.md:111 · risk · identified by z-ai/glm-5.3-flash
An operator following this PR's own narrative would believe the Knowledge profile is not yet live after merging. .github/workflows/deploy.yml runs on push to main and executes pnpm run worker:deploy (deploy.yml lines 4-5, 56), and docs/KNOWLEDGE_COMPOSITION.md itself states "pushes to main deploy these schedules" — so merging this PR deploys PEGMA_KNOWLEDGE_ENABLED="true" plus the three public client registrations to production immediately, with no separate deployment step. Yet the new doc text says "Deployment of this profile and completed client flows remain pending" (docs/KNOWLEDGE_COMPOSITION.md ~line 111) and "once the reviewed Worker configuration is deployed" (~line 5). The concrete cost: the checked-in state contradicts the documented gate, and no post-deploy verification step (e.g. confirming /.well-known/oauth-authorization-server returns 200 rather than 503 agent_access_not_configured) is recorded anywhere in the runbook before staff begin acceptance testing against a possibly silently-broken issuer.
Evidence: deploy.yml on.push.branches: [main] → pnpm run worker:deploy against worker/wrangler.jsonc, which this PR flips to enabled; the doc's "pending" wording is in the same PR. Counterevidence checked: I found no deploy-gate workflow or manual-approval environment that would hold the Worker deploy back from main pushes.
🟠 Issue 3 — The three new client registrations are validated only at runtime; any rejection silently 503s the entire OAuth issuer
worker/wrangler.jsonc:27 · risk · identified by z-ai/glm-5.3-flash
If @pegma/agent-access@0.1.1 rejects any of the three new registration shapes, the failure mode is not a partial degradation: knowledge-host.ts wraps createAgentAccessRuntime in a catch that logs only agent_access.configuration_unavailable (error name only) and then returns 503 agent_access_not_configured for every metadata and agent-access endpoint — disabling all three clients at once, discovered only during manual acceptance. The shapes checked in here are exactly the ones no repo test exercises:
pg-kb-device-accept-v1hasredirectUris: []with onlydevice_code—readAgentClientsaccepts an empty array (strings([], 8, 2048)returns[]), but every existing test ofcreateAgentAccessRuntimeuses non-emptyhttps://redirect URIs (agent-access-runtime.test.ts:37,knowledge-agent-freshness.test.ts:49,knowledge-query-budget.d1.test.ts:333); whether the published package tolerates zero redirect URIs is unverified.- Both authorization-code clients register plain-
httploopback URIs (http://127.0.0.1/callback,http://localhost:48772/callback); the package demonstrably validates redirect URIs eagerly at construction (agent-access-runtime.test.ts:255-258shows a wildcard URI throwing), so anhttp-scheme orlocalhost-hostname rejection would throw at deploy time. - The scope strings
knowledge.article.draft.read/write/evidence.submitare hand-typed into the JSON while the code compares them againstAGENT_KNOWLEDGE_PERMISSIONSimported from the published contracts package; a mismatch throwsInvalid agent client scopesand again 503s the whole issuer.
No test parses the checked-in wrangler.jsonc literal through readAgentClients/createAgentAccessRuntime (the only wrangler.jsonc-reading test, maintenance-schedule.test.ts:145, covers only crons). A single registration-shaped test against the deployed literal would close this gap.
🔵 Issue 4 — Stale "Knowledge is disabled" claims remain in KNOWLEDGE_COMPOSITION.md
docs/KNOWLEDGE_COMPOSITION.md:344 · nit · identified by z-ai/glm-5.3-flash
The PR updates most disabled-state prose but leaves at least two statements asserting Knowledge is disabled, which is now false against the same PR's wrangler.jsonc flip:
docs/KNOWLEDGE_COMPOSITION.md:344: "The root request composition supplies no private-source verifier and keeps Knowledge disabled; source-enabled production wiring is not implied by the factory seam." — the root request composition no longer keeps Knowledge disabled; the profile enables it.docs/KNOWLEDGE_COMPOSITION.md:394-395: "pushes tomaindeploy these schedules even while Knowledge is disabled." — Knowledge is no longer disabled on main after this PR.
The cost is concrete: a reader auditing the activation state from the doc (as the document invites) gets contradictory answers about whether the deployed host is live. Both sentences should be reworded to say what is actually still true (no private-source verifier supplied; schedules deploy regardless of the flag). I checked the rest of the doc's disabled-state mentions; lines 109/146/477 were updated, these two were not.
🔵 Issue 5 — "The port remains unreserved" overclaims for a fixed callback port inside the Linux ephemeral range
docs/KNOWLEDGE_COMPOSITION.md:130 · nit · identified by z-ai/glm-5.3-flash
docs/KNOWLEDGE_COMPOSITION.md:130-131 asserts port 48772 "was available on both IPv4 and IPv6 loopback during the local 2026-11-11 availability check. The port remains unreserved." The present-tense standing claim cannot be guaranteed: 48772 falls inside Linux's default ephemeral range (net.ipv4.ip_local_port_range 32768–60999), so any concurrent outbound connection or listener on the test machine can occupy it, making the Claude Code callback (http://localhost:48772/callback) fail or connect to the wrong local listener during acceptance. The doc already instructs recording the actual callback per test, which partially mitigates; the "remains unreserved" sentence should be dropped or scoped to the check date, or a collision-recheck/re-pick step added to the procedure.
🔵 Issue 6 — Generated runtime types now run ahead of the Native D1 test pool's runtime
worker/worker-configuration.d.ts:2 · nit · identified by z-ai/glm-5.3-flash
Before this PR, worker-configuration.d.ts was generated by Wrangler 4.114.0 with workerd@1.20260722.1 — the same runtime generation the Native D1 pool (@cloudflare/vitest-pool-workers@0.18.8 / Miniflare 4.20260722.0) actually executes, so the type gate and the tested runtime were aligned. Regenerating with Wrangler 4.128.0 moves the declarations to workerd@1.20260831.1 (worker-configuration.d.ts line 2), ahead of the pool's runtime. Concrete gap: a future worker change can now type-check against runtime APIs the new declarations expose (e.g. ExecutionContext.abort, Span.setAttributes, ContainerStartupOptions's new discriminated shape) that the D1 tests never execute and the deployed compatibility date (2026-07-28) may not enable, so the failure surfaces only at deploy. The README documents the retained older pool but frames the drift as pre-existing; this PR is what moves the generated side forward. Today no worker code uses the new APIs (the profile "preserves existing runtime API usage"), so this is latent rather than immediate.
🔵 Issue 7 — Disabled-path overrides via bare Object.defineProperty depend on env carrying the var as a configurable property
worker/src/support-human-control.d1.test.ts:166 · nit · identified by z-ai/glm-5.3-flash
All four D1 test fixtures now set the disabled flag with Object.defineProperty(configuration, 'PEGMA_KNOWLEDGE_ENABLED', { value: 'false' }) (and previously-existing PEGMA_AGENT_CLIENTS_JSON overrides use the same shape). Because the descriptor omits writable/enumerable/configurable, the outcome depends on whether the spread from env (cloudflare:workers) already contains the key: if it does, the existing configurable property keeps its writable/enumerable attributes and only the value changes; if a future config change removes the var from wrangler.jsonc (or the pool stops exposing it), defineProperty creates a non-enumerable, non-writable, non-configurable property instead. The concrete failure scenario in support-human-control.d1.test.ts:169 is Object.assign(configuration, extra) immediately after the override: with a non-writable newly-created property, any future caller passing PEGMA_KNOWLEDGE_ENABLED in extra makes Object.assign throw in strict mode, and a non-enumerable flag would be dropped by any env enumeration/spread in fixtures. Passing the full descriptor (writable: true, enumerable: true, configurable: true) or a typed post-spread assignment would make the fixtures independent of the source property's attributes.
Evidence: I verified the current callers pass no such key in extra (support-human-control.d1.test.ts:489,539 pass only PEGMA_SUPPORT_BOOTSTRAP_PRINCIPALS) and that env currently includes the var via the wrangler config, so the tests pass today; the gap is the unhandled future state, which I could not rule out because the pool's binding-property attributes are not pinned by any test.
| @@ -1,12 +1,12 @@ | |||
| /* eslint-disable */ | |||
| // Generated by Wrangler by running `wrangler types --config=worker/wrangler.jsonc worker/worker-configuration.d.ts` (hash: 70e83c2cdd509101b5441bbc4d72b275) | |||
| // Runtime types generated with workerd@1.20260722.1 2026-07-28 nodejs_compat | |||
| // Generated by Wrangler by running `wrangler types --config=worker/wrangler.jsonc worker/worker-configuration.d.ts` (hash: 8fa6956b4f94dd9c45eaa17f2a294bf2) | |||
There was a problem hiding this comment.
🔵 Generated runtime types now run ahead of the Native D1 test pool's runtime (nit)
Before this PR, worker-configuration.d.ts was generated by Wrangler 4.114.0 with workerd@1.20260722.1 — the same runtime generation the Native D1 pool (@cloudflare/vitest-pool-workers@0.18.8 / Miniflare 4.20260722.0) actually executes, so the type gate and the tested runtime were aligned. Regenerating with Wrangler 4.128.0 moves the declarations to workerd@1.20260831.1 (worker-configuration.d.ts line 2), ahead of the pool's runtime. Concrete gap: a future worker change can now type-check against runtime APIs the new declarations expose (e.g. ExecutionContext.abort, Span.setAttributes, ContainerStartupOptions's new discriminated shape) that the D1 tests never execute and the deployed compatibility date (2026-07-28) may not enable, so the failure surfaces only at deploy. The README documents the retained older pool but frames the drift as pre-existing; this PR is what moves the generated side forward. Today no worker code uses the new APIs (the profile "preserves existing runtime API usage"), so this is latent rather than immediate.
There was a problem hiding this comment.
The profile intentionally regenerates declarations through pinned direct Wrangler 4.128.0 and workerd 1.20260831.1. The README now explicitly records that this advances the earlier generated declarations. The Native pool has its independently pinned runtime, and the deployed compatibility date is 2026-07-28. This change uses the existing runtime APIs. Current type, packaging and actual D1 gates passed, including all 1,177 tests. Future runtime API additions require compatibility checks against the selected deployment date and test runtime. The requested toolchain alignment remains a disputed requirement for this configuration change.
🛡️ Codex Security ReviewSecurity 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. |
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
|
Fixed r1-1 and r1-4 in ed72845. The Knowledge handbook now describes the configured ordinary authoring profile, the missing private-source verifier and independent schedule deployment. The final local gate passed all 1,177 tests with zero skips, check, both Worker dry runs and the build. Current-head CI and review are running. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: ed72845bec7b49394bd398bfa331601580a5d7aa
Judge: openai/gpt-5.6-luna
Cost: $0.0839 (lanes $0.0837 + judge $0.0001)
Lanes
openai/gpt-6.1-sol: ok (0 finding(s), 22.3s, 50107+774 tokens (31522 cached), 3 tool round(s), via Azure, $0.0631)z-ai/glm-5.3-flash: ok (0 finding(s), 285.2s, 353305+13570 tokens (279040 cached), 14 tool round(s), via Reka, $0.0207)
Round 2 resolution
- ✅
r1-2fixed correctly — Docs and PR say deployment "remains pending" while CI auto-deploys the enabled profile on merge to main: The handbook now explicitly states that pushing tomaindeploys the enabled profile through the existing workflow, with the Worker deployed before Pages. It requires successful deployment confirmation and HTTPS metadata readbacks before client tests, and reserves “pending” for native-client acceptance and broader rollout. This matches.github/workflows/deploy.yml. - ✅
r1-3fixed correctly — The three new client registrations are validated only at runtime; any rejection silently 503s the entire OAuth issuer: The new Node regression reads the actual Wrangler configuration and constructs all three registrations throughreadAgentClientsandcreateAgentAccessRuntime, which invokes published Agent Access validation. It checks both discovery documents, PKCE login handoffs, device authorization with an empty redirect list, and callback/scope/grant refusals. The D1 regression also checks discovery through… - 5 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 0 (0 bug-severity).
No structured findings from the successful lane(s).
🛡️ Codex Security ReviewSecurity 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. |
Changes
Validation
Native-client acceptance remains at zero. This profile permits the controlled existing-login, consent, PKCE/device, scoped operations and revocation tests. Hosted Grok Bot and T3 Code registration, deployed CPU/load qualification, broader rollout and the supervised pilot remain pending.