Write git notes on Artifacts publish - #509
Conversation
Attach JSON harness notes to published commits via refs/notes/commits when repo sessions publish, bootstrap source repos, or reconcile external pushes. Notes capture publish provenance, session/conversation ids, and check results without moving metadata out of D1. Also teach package_get_git_remote setup commands to fetch notes refs so local clones can read publish context. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
📝 WalkthroughWalkthroughAdds versioned publish git notes: core library to build/write/read notes, an MCP capability to query notes by source/package identity, tests for new behaviors, and integration that attaches notes during bootstrap, session publish, and external publish flows; also updates git-remote setup to fetch notes refs. ChangesPublish Git Notes Recording and Querying
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Expose read path for Kody publish harness git notes on Artifacts commits. Supports source_id or package identity lookup, parses v1 JSON notes, and returns raw note text plus structured fields. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🔎 Preview deployed: https://kody-pr-509.kentcdodds.workers.dev Worker: Mocks:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/worker/src/repo/publish-git-notes.ts`:
- Around line 493-500: The current catch-all converts any exception into a "note
not found" result (returning found: false), hiding auth/network/git failures;
change the catch to catch the error (e.g., catch (err)) and only return
{found:false, commit: input.commitOid, rawNote: null, note: null} for the
specific case that the note truly does not exist (detectable by a specific error
code/message from the git library or by checking the absence of the note
response), but rethrow or propagate all other errors (auth/token/network/git) so
callers can observe operational failures; locate the try/catch around the
read/fetch call that uses input.commitOid and adjust to inspect the thrown error
before deciding to return versus throw.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1e991387-1702-4300-9847-e5f71164e104
📒 Files selected for processing (8)
packages/worker/src/mcp/capabilities/packages/get-git-remote.tspackages/worker/src/mcp/capabilities/repo/domain.tspackages/worker/src/mcp/capabilities/repo/index.tspackages/worker/src/mcp/capabilities/repo/repo-show-publish-note.node.test.tspackages/worker/src/mcp/capabilities/repo/repo-show-publish-note.tspackages/worker/src/repo/publish-git-notes.node.test.tspackages/worker/src/repo/publish-git-notes.tspackages/worker/src/repo/repo-session-do.ts
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Only treat missing notes ref / note as found:false. Propagate auth, network, and other git failures to callers instead of hiding them as false negatives. Also fix GitStat directory fallback mode typo (16_384 / 0o40000). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
Actionable comments posted: 0 |
Subsequent publishes were silently failing when the local workspace lacked the remote notes history. Fetch refs/notes/commits best-effort, then push with force so note writes succeed after the first publish. Also defer source write token creation until external publish succeeds. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Only treat NotFoundError or notes-ref-specific messages as missing-note cases so errors like Repository not found propagate. Preserve explicit previousPublishedCommit: null for bootstrap notes. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1ef923c. Configure here.
Wrap write-token creation and note attachment in try/catch so a token failure after finalizePublishedEntitySource does not fail the publish response. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
Actionable comments posted: 0 |

Summary
Writes structured Kody publish metadata as git notes on
refs/notes/commitswhen repo sessions publish, bootstrap source repos, or reconcile external pushes. Addsrepo_show_publish_noteMCP capability to read those notes.Review fixes
refs/notes/commitsbeforeaddNote, thenforce: truepushGitStatdirectory mode typo; respect explicitpreviousPublishedCommit: nullValidation
Summary by CodeRabbit
New Features
Tests