feat(mcp): add metadata param to edit_note for frontmatter updates#1090
feat(mcp): add metadata param to edit_note for frontmatter updates#1090phernandez wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e45ba820a8
ℹ️ 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".
Local validationCI didn't auto-run on this branch (bot-token push + The one failure is a test-assertion bug, not a feature bug. The
Fix: expect the project-prefixed permalink. |
Anthropic's OIDC exchange is broken for the pull_request_target event (401 'Invalid OIDC token'; anthropics/claude-code-action#713). The workflow invoked that path whenever a PR body contained '@claude' — and bot-authored PR descriptions carry attribution text ('Generated by the @claude workflow'), so opening #1088/#1089/#1090/#1091 self-triggered the broken path and each failed its 'claude' check with a 401. A normal issue_comment run succeeded with the same secret in between, so the OAuth token is valid and needs no rotation. Remove the pull_request_target trigger and its PR-body '@claude' clause, so attribution text can never be read as a command and no event routes into the broken OIDC path. Explicit '@claude' mentions in issues, issue comments, PR reviews, and PR review comments remain the trigger. Also drop the now-dead pull_request.author_association gate clauses (reviewer identity is covered by sender.author_association) and the pull_request_target-only checkout ref. If automatic PR-open review is wanted later, it should be a dedicated workflow with a fixed prompt, not a PR-body mention. Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86d8093d73
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1adec0b040
ℹ️ 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".
Rebuilt against main after the note-preparation extraction: the metadata merge now lives in services/note_preparation.py and threads through the entity-service wrapper, the accepted-note write/mutation runners, the EditEntityRequest schema, and the edit_note MCP tool. Addresses all three review findings: - Frontmatter-only rewrites no longer reflow the note body. The merge extracts the body with the new remove_frontmatter(strip=False) and drops exactly one separator newline, so leading blank lines, trailing hard-break spaces, and a missing final newline round-trip byte-exact. - Null metadata values are rejected with a ValueError (surfaced as a bad request) instead of silently dropping the field after the normalize step filtered the YAML null out of indexed metadata. - The documented metadata-only pattern (empty append/prepend plus metadata) skips the content operation entirely, so it no longer appends "\n" to bodies without a trailing newline. Issue #1011. Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A2bgrGfWiL4izcjj66u9R8 Signed-off-by: phernandez <paul@basicmachines.co>
1adec0b to
74b12a5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74b12a55b7
ℹ️ 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".
|
|
||
| post = frontmatter.Post(body) | ||
| post.metadata.update(merged_metadata) | ||
| return dump_frontmatter(post) |
There was a problem hiding this comment.
Preserve separatorless frontmatter bodies
Fresh evidence after the prior body-preservation fix: for notes whose closing frontmatter fence is followed immediately by content, e.g. ---\nstatus: draft\n---\nBody, body is "Body" here but dump_frontmatter() always serializes frontmatter as ---\n\n{post.content}. A metadata-only edit therefore inserts a blank line before the existing body even though the new contract says unrelated frontmatter and the note body are left untouched; preserve whether the original body had that separator instead of always using the canonical dumper output for this path.
Useful? React with 👍 / 👎.
Implements #1011. Generated by the
@claudeworkflow; opened for review — not yet verified by a human (the run intentionally did not execute the test suite; CI does — see note below).Summary
Adds an optional
metadata: dictparam toedit_notethat merges into a note's YAML frontmatter independent ofoperation, so an agent can update structured fields (e.g.status,closed_at) without a fragilefind_replaceon an exact frontmatter line. Mirrorswrite_note's existingmetadataparam.title/type/permalink) are dropped from the merge (they have dedicated resolution paths).EditEntityRequest→ the accepted-note-mutation pipeline →EntityService.Review checklist
metadataNote
This branch was produced without running
just/pytestlocally —just/uvaren't installed on the Actions runner, and the first run timed out trying to install them. Rely on this PR's CI run for verification. (Follow-up: add auv/justsetup step toclaude.ymlso future runs can self-verify.)Closes #1011
🤖 Generated with Claude Code