Repository navigation
fix: comments work again on Cloudflare; read_drop returns content when comments can't be read - #106
Conversation
…s content when comments can't be read ViteHub's Comments plugin probed D1 when the Worker started, before any request brought the binding, and left Comments without a Database. Every comments call answered 503. Patched from vite-hub/vitehub#3222.
Latest result Pull request merged. Final answersSession Pull request merged. Session Waiting for GitHub merge request 9591e114-9073-4d51-a5d3-75e202d5346e. Session Pushed 422f9ad fixing Doctor TS0008 with an explicit return type and no assertion. Doctor, focused vp lint, vp fmt --check, and both comments-unavailable tests passed using local binaries. Emitted JavaScript is unchanged. Both supplied reviews reported no findings. Dependency setup encountered pnpmfileChecksum and protected Git metadata errors; installed tools completed validation. Awaiting CI. Pushed 422f9ad fixing Doctor TS0008 with an explicit return type and no assertion. Doctor, focused vp lint, vp fmt --check, and both comments-unavailable tests passed using local binaries. Emitted JavaScript is unchanged. Both supplied reviews reported no findings. Dependency setup encountered pnpmfileChecksum and protected Git metadata errors; installed tools completed validation. Awaiting CI. Session Waiting for review checks before the next pass. Session Waiting for review checks before the next pass. Session Waiting for review checks before the next pass. Session Waiting for review checks before the next pass. Session Waiting for review checks before the next pass. |
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes covering the Cloudflare Comments database-selection fix and the read_drop degradation path when comment reads are unavailable.
- Cloudflare database selection — patches the generated Comments plugin to retain a configured request-scoped D1 proxy while still recognizing an intentionally disabled default Database.
- MCP partial availability — returns drop/site content and metadata when comment listing returns a 503, while explicitly marking comments as unavailable rather than reporting none.
- Regression coverage — adds an uninstalled-Comments harness mode and MCP tests for both document and site reads.
gpt-5.6-sol | 𝕏

What broke
Since #64/#105 (the move to ViteHub Comments on 0.1.0) were deployed, every comments call on drop.vitehub.dev answers 503: "The Comments runtime has no Database yet". That covers the viewer's comments, posting, and MCP
read_drop. Workers Observability shows everyCOMMENTS_NOT_INSTALLEDcoming from one Worker version,108f48a6, which is the current deploy.Why
The plugin that ViteHub generates for
server/comments.tspicks the Database when the Worker starts. It readsdatabases.default.db.selectto check that a default Database exists. On Cloudflare that runs before any request, so there is no D1 binding yet, and the read throws. A barecatch {}took that for "no Database", so Comments was never installed. The warning prints at global scope, which Workers Logs doesn't keep. This isn't a binding or config problem:DBis bound, andpublishandlist_dropsuse it.Change
patches/@vite-hub__comments@0.1.0.patch: in the generated plugin, onlyDATABASE_DISABLED(no default Database) counts as "none". Any other error keeps the D1 db, which connects per query. Upstream fix: fix(comments): install Comments on Cloudflare D1, which connects only when a request arrives vitehub#3222. Remove the patch when that ships.read_dropstill returns the drop's content, versions, answers and files when comments can't be read (a 503 from Comments), for docs and sites. Where the comments would go, it says they couldn't be read and that the drop may have open comments, so an agent doesn't take an empty list for "no comments".structuredContentgetscommentsUnavailable.Verified
nuxt build) and ran it underwrangler devwith a local D1. I signed up, published a doc, posted a comment, and listed the comments. With the patch, both calls return 200 and the comment. With the oldcatch {}put back into the built chunk, both return the prod 503, and the Worker logsComments has no Databaseat startup.test/mcp/comments-unavailable.test.mjsrunsread_dropwith Comments left uninstalled. It fails on main with the prod error and passes here.test/mcp,test/quiz/answers, andtest/review/reviewpass (81 tests). Lint and format are clean on the changed files.To deploy
Merging and deploying the Worker is enough: no binding, secret or migration changes. Quiver (Node + SQLite on GKE, still on 7c33833 from before #64) doesn't have this bug: libSQL connects at startup there. When Quiver moves past #64, it gets this patch along with it.
🤖 Generated with Claude Code