Skip to content

Bound governed authoring reads and resumable retrieval work - #11

Merged
FlyOverCoderKY merged 2 commits into
mainfrom
claude/kb014-free-read-context
Nov 9, 2026
Merged

FlyOverCoderKY merged 2 commits into
mainfrom
claude/kb014-free-read-context

Conversation

@FlyOverCoderKY

@FlyOverCoderKY FlyOverCoderKY commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Governed authoring currently repeats complete article, policy and evidence reads across one request, while index repair can spend several transaction attempts inline. Add an operation-local authoring observation/confirmation pair and a body-free report query, prepare complete immutable read waves before I/O, and allow retrieval repair to resume with an explicit transaction-attempt budget.

The observations are opaque, application/actor-bound and single-use. Current permission and A/C/V head checks still fence reads and writes; complete admitted proof history and exact replay acknowledgements remain intact. The optional report/context path preserves the existing five MCP tools, three scopes, wire schemas and legacy factory behavior. Explicit repair bounds preserve durable partial progress and current-authority checks; omitted bounds retain existing behavior.

All four synchronized packages are the unpublished 0.1.4 candidate. Review, trusted publication, exact registry verification and host acceptance remain separate gates. Provider batching and bounded attempts do not establish universal Workers Free query, CPU or traffic acceptance.

Validation for R2:

  • Actual Node 24.18.0 formatting/types and all 93 query tests passed on real Memory/Azurite/D1, including 48 new races for ledger reset, current principal revocation and resource/report changes.
  • R1 Linux CI passed all six declared commands on both Node 22 and 24: 887 runtime tests and 128 release tests, zero skips. Those are historical R1 results; fresh complete R2 CI is required.
  • Independent review of the seven R2 files is clean. No new scope/tool/cache or resolver/read count was added. Full final review, current security checks, publication and host acceptance remain required.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 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-09T06:26:25.638030Z e046afd Manual request
🔒 Security Review ✅ Completed 2026-11-09T06:29:17.623780Z e046afd 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. Bravo.

Reviewed commit: c7d521b6c5

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

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

Reviewed commit: c7d521b6c5

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.

@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: c7d521b6c5571f2813a6508495da5d599a49a97d
Judge: openai/gpt-5.6-luna
Cost: $0.7593 (lanes $0.7564 + judge $0.0029)

Lanes

  • openai/gpt-6.1-sol: ok (4 finding(s), 132.6s, 818334+5948 tokens (711890 cached), 8 tool round(s), via Azure, $0.44)
  • z-ai/glm-5.3-flash: ok (3 finding(s), 561.0s, 7623774+86309 tokens (7223104 cached), 50 tool round(s), via Together, $0.32)

Findings

🔴 Issue 1 — Ledger reset missed during context confirmation

packages/application/src/evidence-reports.ts:1314 · bug · identified by openai/gpt-6.1-sol

A report query can return an old-epoch receipt after a reset completes during confirmAuthoringContext. Reset changes only the ledger head initially, leaving the old report row intact, so the final report-version comparison succeeds and the query returns the previously observed active ledger and retired receipt.

query performs its last headVersion check before context confirmation. Unlike the dispatcher's legacy path, its final owner-status read does not invoke status, which performs another active check. Recheck the ledger epoch/status after context confirmation and before the final status observation.

I checked reset, status, the legacy dispatcher sequence, and tests/report-query.test.ts. The existing reset race test resets at the second ledger read, not during the subsequent context confirmation. This finding does not require an atomic cross-collection snapshot: the reset completes before the query's final report observation.

🟠 Issue 2 — Principal revocation missed during final query work

packages/application/src/evidence-reports.ts:1303 · risk · identified by openai/gpt-6.1-sol

A direct factory caller can receive requirements and owner-only report status after its principal loses the required permissions during context confirmation or the fallback context read. The query's second current resolution has already completed, and the remaining work never resolves current principal authority again.

confirmContext checks the application's captured AccessContext, not resolvePrincipal; consequently, revoking the principal in the resolver during that await does not invalidate confirmation. Add a fresh same-principal authority check after the context work, before releasing query data.

I checked current, confirmContext, confirmAuthoringContext, and the query revocation tests. Those tests revoke at the second principal resolution, before this gap. A correctly composed HTTP/MCP host's final credential fence can prevent transport disclosure, but direct consumers of the exported report factory still encounter this risk; the application observation is explicitly not a credential-freshness check.

🔵 Issue 3 — Conflicting report-read authentication guidance

docs/EVIDENCE_REPORTS.md:55 · nit · identified by openai/gpt-6.1-sol

A host following the evidence-report guide must still refresh credentials before and after every report-port read, even though the updated agent API and workflow explicitly permit a request-local read group. This leaves consumers with contradictory composition requirements and can preserve the redundant authority I/O this change is intended to avoid.

The introductory paragraph still says wrappers must revalidate around every awaited report-port call. Update it to distinguish the permitted read-group alternative from the mandatory fresh write guards, preferably by linking to the exact boundary requirements in AGENT_API.md.

I compared this paragraph with the changed authentication sections in docs/AGENT_API.md, docs/AGENT_WORKFLOW.md, and packages/mcp/README.md; those documents consistently permit grouped pure reads.

🔵 Issue 4 — Stale release-summary date and receipt link

README.md:8 · nit · identified by openai/gpt-6.1-sol

Readers checking the README's release history are given a summary dated before the release it now claims, and the 0.1.2 verification link lands at the section whose first receipt is now 0.1.3.

The status block remains dated 2026-11-08, while the added 0.1.3 receipt in docs/BOOTSTRAP.md records qualification on 2026-11-09. Its existing 0.1.2 link also still uses #verified-knowledge-base-release rather than the new historical 0.1.2 heading or retained compatibility anchor. Refresh the date and pin that historical claim to its own receipt.

I checked the new Bootstrap headings and explicit current-verified-012-release compatibility anchor; the appropriate historical destinations exist.

🟠 Issue 5 — Application README retargets the retrieval contract link to unpublished main and keeps a stale v0.1.2 claim

packages/application/README.md:213 · risk · identified by z-ai/glm-5.3-flash

A host composing the verified release follows packages/application/README.md's retrieval pointer and implements candidate-only behavior against released packages.

  • Line ~213 was changed from the tag-pinned https://github.com/pegma-dev/knowledge-base/blob/v0.1.2/docs/RETRIEVAL.md to https://github.com/pegma-dev/knowledge-base/blob/main/docs/RETRIEVAL.md, presented as "the exact API, limits, authority/reference fences, and evaluation boundary". The main RETRIEVAL.md this PR edits now documents the unpublished 0.1.4 maxBatches parameter; a host building against the verified 0.1.3 artifacts and passing maxBatches per that linked contract gets their repairArticleIndex/repairRetrievalPage calls rejected (objectInput throws TypeError on the unknown field in the released code).
  • The same file still opens the section with "Existing versioned documentation links below describe the verified v0.1.2 release" (line 17) while the very next sentence (added by this PR) states the verified release is v0.1.3 and the top-of-file link (line 12) still pins RETRIEVAL.md at v0.1.2. The file now contradicts itself: one sentence names 0.1.2 as verified, the next names 0.1.3, and the two retrieval links in the file point to different refs (one tag-pinned, one moving main).

This sits directly against the file's own rule two paragraphs later: "The versioned contract references remain tag-pinned; the DEVELOPMENT link is a source-reader fallback" — the changed link is presented as the normative reference, not the fallback. Evidence: the diff hunk at packages/application/README.md lines 208-215 changed exactly this URL; the surrounding sentences quoted above are in the current checkout. Fix by pinning the line-213 link to v0.1.3 (or explicitly marking it as the DEVELOPMENT fallback) and updating the line-17 sentence to 0.1.3.

🔵 Issue 6 — Garbled "D1 Free50" term in the MCP README performance disclaimer

packages/mcp/README.md:115 · nit · identified by z-ai/glm-5.3-flash

packages/mcp/README.md line 115 reads "Fewer repeated reads do not establish a D1 Free50, CPU, physical-row or latency guarantee". Everywhere else this PR and the repo express the same disclaimer as "Workers Free 50-query" (README.md line 57, docs/EVIDENCE_REPORTS.md line 118, docs/HOST_COMPOSITION.md line 220) or "D1 query". "D1 Free50" is not a term defined anywhere in the repo; a reader cannot tell whether it means the 50-query/day Workers Free allowance, a D1-specific quota, or a typo. Cost: the README's central no-acceptance-claim disclaimer uses an undefined term, weakening the precise gating language this repo otherwise maintains. Fix: "a Workers Free 50-query / D1" or matching the phrasing used in docs/AGENT_API.md ("a D1 query, CPU, physical-row or wall-clock allowance").

🔵 Issue 7 — Missing spaces in two new test failure messages

tests/free-retrieval-step.test.ts:81 · nit · identified by z-ai/glm-5.3-flash

tests/free-retrieval-step.test.ts introduces two failure diagnostics with words run together: "Bounded synthetic article repair made no convergence within48 steps" (in converge, ~line 81) and "Repair barrier exceeded10seconds" (in reached, ~line 98). These strings surface verbatim when the bounded-repair convergence loop or the 10-second barrier guard fails, making the actual step count / timeout harder to read in CI logs. Cost is limited to diagnostics readability. Fix: "within 48 steps" and "exceeded 10 seconds".

Workflow run

Comment thread packages/application/README.md Resolved
Comment thread packages/mcp/README.md Resolved
Comment thread tests/free-retrieval-step.test.ts Resolved
@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

r1-3: Addressed in e046afd7310d23f6bda4347d0c04df60a49d9251. The evidence-report guide now consistently permits either per-port pure-read checks or the documented request-local read group, with full original-credential authority before the first read and after the actual dispatcher invocation. It explicitly keeps the final MCP fence inside the awaited callback, fresh before/after write guards, and restricted caller permissions; ledger principal resolution is still not a host credential verifier. See updated composition guidance.

r1-4: Addressed in e046afd7310d23f6bda4347d0c04df60a49d9251. The summary date is now 2026-11-09, and the 0.1.2 verification claim points to its historical receipt heading rather than the general section that now begins with 0.1.3. See summary date and historical 0.1.2 reference. The historical release receipts are preserved, and 0.1.4 remains explicitly unpublished.

Actual Node 24.18.0 types and all 93 report-query tests passed against real Memory, Azurite and D1, including all 48 new race cases. Formatting passed. Fresh full current-head Node 22/24 CI remains required before merge.

@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: e046afd731

ℹ️ 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: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: e046afd7310d23f6bda4347d0c04df60a49d9251
Judge: openai/gpt-5.6-luna
Cost: $0.1167 (lanes $0.1165 + judge $0.0001)

Lanes

  • openai/gpt-6.1-sol: ok (0 finding(s), 29.6s, 116430+1115 tokens (92402 cached), 5 tool round(s), via Azure, $0.0885)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 271.5s, 552109+25974 tokens (468747 cached), 17 tool round(s), via OpenInference, $0.0280)

Round 2 resolution

  • ✅ r1-1 fixed correctly — Ledger reset missed during context confirmation: The query now rereads the ledger head and selected report after optimized confirmation or legacy context work, rejecting epoch/status changes and head-version drift before returning. New tests exercise reset with retained old report rows, completed reset/drain, and head-only changes across both paths and all store factories.
  • ✅ r1-2 fixed correctly — Principal revocation missed during final query work: The query now calls current(access, evidenceSubmit) after its final awaited resource observations. current checks the same principal and every permission in the original restricted context against fresh authority, including draftRead, without replacing that context with owner authority. New tests cover principal suspension and permission revocation during both optimized and legacy final cont…
  • ✅ r1-5 fixed correctly — Application README retargets the retrieval contract link to unpublished main and keeps a stale v0.1.2 claim: The retrieval contract pointer is now pinned to verified v0.1.3 rather than moving main. The introduction explicitly identifies remaining v0.1.2 links as historical contracts and distinguishes the unpublished 0.1.4 context/query guide from released documentation.
  • 4 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: e046afd731

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.

@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: full-pr (full-pr)
Mode: verify
Commit: e046afd7310d23f6bda4347d0c04df60a49d9251
Judge: openai/gpt-5.6-luna
Cost: $0.6286 (lanes $0.6285 + judge $0.0001)

Lanes

  • openai/gpt-6.1-sol: ok (0 finding(s), 51.0s, 434968+2301 tokens (332791 cached), 4 tool round(s), via Azure, $0.34)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 383.8s, 7028553+54369 tokens (6584832 cached), 50 tool round(s), via Together, $0.29)

Round 3 resolution

  • No prior findings were open.
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY merged commit 541e8c9 into main Nov 9, 2026
9 checks passed
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