Skip to content

Enable controlled Knowledge authoring qualification - #64

Merged
FlyOverCoderKY merged 2 commits into
mainfrom
codex/knowledge-authoring-qualification-20261111
Nov 11, 2026
Merged

FlyOverCoderKY merged 2 commits into
mainfrom
codex/knowledge-authoring-qualification-20261111

Conversation

@FlyOverCoderKY

@FlyOverCoderKY FlyOverCoderKY commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • Enable the existing Knowledge host for controlled signed-in staff qualification with closed test collections and fictional product guides.
  • Register three public clients with draft-read, draft-write and evidence-submit scopes. Codex CLI uses its IP-loopback PKCE callback, Claude Code uses a fixed localhost callback, and a separate registration exercises the device-code flow.
  • Preserve existing Admin-only linking, collection permissions, human evidence review and publication approval. Customer AI, learning reviews and engineering export remain off.
  • Generate Worker types through the normal Wrangler 4.128.0 command. Four disabled-path test fixtures retain their intentional false runtime value against the generated deployment literals.
  • Record callback constraints, rollback through grant revocation and configuration, and the deployed request-URL redaction observation from PR Redact request query strings in Worker telemetry #63.

Validation

  • Frozen registry install, normal type generation, check, both Worker dry runs and the 21-page build passed.
  • All 1,177 tests passed with zero skips, including 1,046 Node tests, 129 real Native D1 tests and two Bench tests.
  • Normal CI now covers the actual three registrations through the host factory and published Agent Access, discovery, PKCE/device handoffs, callback/scope/grant refusals, and the real disabled-fixture override precedence.
  • The handbook describes automatic main deployment and required readbacks. A later prose-only wording pass leaves the tested runtime, configuration, generated types and test bytes intact.

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.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

OpenRouter review posted (clean). #64 (review)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T19:01:28.934763Z ed72845 Manual request
🔒 Security Review ✅ Completed 2026-11-11T19:04:54.882809Z ed72845 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 171562319f

ℹ️ 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".

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-v1 has redirectUris: [] with only device_code — readAgentClients accepts an empty array (strings([], 8, 2048) returns []), but every existing test of createAgentAccessRuntime uses non-empty https:// 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-http loopback 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-258 shows a wildcard URI throwing), so an http-scheme or localhost-hostname rejection would throw at deploy time.
  • The scope strings knowledge.article.draft.read/write/evidence.submit are hand-typed into the JSON while the code compares them against AGENT_KNOWLEDGE_PERMISSIONS imported from the published contracts package; a mismatch throws Invalid agent client scopes and 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 to main deploy 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.

Workflow run

Comment thread docs/KNOWLEDGE_COMPOSITION.md Resolved
Comment thread worker/wrangler.jsonc Resolved
Comment thread docs/KNOWLEDGE_COMPOSITION.md Resolved
@@ -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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 171562319f

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: ed72845bec

ℹ️ 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".

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-2 fixed 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 to main deploys 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-3 fixed 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 through readAgentClients and createAgentAccessRuntime, 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).

Workflow run

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: ed72845bec

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@FlyOverCoderKY
FlyOverCoderKY merged commit 44b0eea into main Nov 11, 2026
2 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the codex/knowledge-authoring-qualification-20261111 branch November 11, 2026 19:32
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