Skip to content

Serve the signed hold list read-only for the kb-gate verifier - #217

Merged
tzhouam merged 1 commit into
mainfrom
kb/holds-endpoint
Sep 28, 2026
Merged

tzhouam merged 1 commit into
mainfrom
kb/holds-endpoint

Conversation

@tzhouam

@tzhouam tzhouam commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

Knowledge-service redesign follow-up: the public hold-list endpoint the kb-gate verifier reads. Until now nothing served public/holds.json, so every knowledge segment would fail closed.

  • kb holds-server serves exactly GET/HEAD /holds.json with Cache-Control: no-store.
  • Every other path returns 404: no directory listing, no path following, no writes.
  • A missing list returns 503, which the gate treats as unreachable and fails closed.
  • It binds 127.0.0.1 by default. The bot host's reverse proxy adds TLS, and that URL goes into holds_url in .github/kb-gate/config.json (the feature doc has a Caddy example).
  • Tests fetch and verify the list with the verifier's own fetch_holds/verify_holds, and probe that the ledger and other paths are unreachable.

Commit hook approved; full suite and SPEC freshness pass locally.

🤖 Generated with Claude Code

The kb-gate verifier fails every knowledge segment whose hold list it cannot
fetch, but nothing served the service's public/holds.json.

- holds_server (kb holds-server [--host] [--port]) serves exactly one file,
  <state_dir>/public/holds.json, at GET/HEAD /holds.json with Cache-Control:
  no-store. Every other path is 404: no directory listing, no path
  following, no writes. A missing list is 503, which the gate treats as
  unreachable and fails closed. It binds 127.0.0.1 by default; the bot
  host's reverse proxy adds TLS, and that URL becomes holds_url in
  .github/kb-gate/config.json (feature doc shows a Caddy route).
- The tests fetch and verify the list with the verifier's own fetch_holds /
  verify_holds, and probe that the ledger and other paths are unreachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T16:15:34.753969Z 88b354d PR opened
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88b354d24d

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

self.send_error(HTTPStatus.NOT_FOUND)
return
try:
data = holds_path.read_bytes()[:MAX_BYTES]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject oversized hold files instead of truncating them

When holds.json exceeds 1 MiB, this reads the entire file into memory and then silently returns only its first MiB with HTTP 200. The truncated JSON cannot pass fetch_holds, so every knowledge gate fails closed; moreover, concurrent requests to an unexpectedly large or corrupted file can allocate the full file repeatedly despite the apparent size cap. Read at most MAX_BYTES + 1 bytes and return an error when the extra byte is present.

Useful? React with 👍 / 👎.

@tzhouam
tzhouam merged commit 2d8b990 into main Sep 28, 2026
5 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