feat(acp): inject requester git email into [Context] for commit trailers#1308
Open
wpfleger96 wants to merge 3 commits into
Open
feat(acp): inject requester git email into [Context] for commit trailers#1308wpfleger96 wants to merge 3 commits into
wpfleger96 wants to merge 3 commits into
Conversation
Agents currently fall back to `git config user.email` for commit trailers, which resolves to the repo owner's identity — not the human who triggered the turn. NIP-01 kind:0 already has a standard `email` field; this change stores it and surfaces it in every prompt so agents can use the correct identity. - Add nullable `git_email` column to `users` table (migration 0004) - Parse the NIP-01 `email` field from kind:0 events in `handle_kind0_profile` and store it via `update_user_profile` - Add `git_email` to `PromptProfile`; parse it in `parse_kind0_profile_lookup` - Emit `Requester-Git-Email: Name <email>` in `[Context]` when the triggering event's author has a git_email set; omit the line entirely when absent - Update `nest_agents.md`: prefer `Requester-Git-Email:` from `[Context]` over `git config user.email`; fall back to git config when absent Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
6336503 to
7d3d759
Compare
Address Thufir review findings: - side_effects.rs: document that empty string for git_email is intentional and that empty_to_none in the DB layer owns the "" → NULL conversion, consistent with display_name, avatar_url, about. Prevents future readers from adding a redundant filter. - nest_agents.md: replace "verified" with "self-reported" for the Requester-Git-Email identity description — the email is user-asserted, not cryptographically verified. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
The function inherently needs all 8 parameters — each maps to a distinct context dimension. Refactoring into a struct would add abstraction without reducing complexity. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agents currently fall back to
git config user.emailfor commit trailers, which resolves to the repo owner's identity — not the human who triggered the turn. NIP-01 kind:0 already has a standardemailfield; this change stores it and surfaces it in every prompt so agents can use the correct identity.Changes
DB migration
migrations/0004_user_git_email.sql: adds nullablegit_email TEXTcolumn touserstablebuzz-db
UserProfilegains agit_email: Option<String>fieldupdate_user_profileaccepts an additionalgit_email: Option<&str>parameter; the dynamic SQL builder handles it the same way as other nullable profile fields (empty string → NULL)get_userandget_user_by_nip05SELECT the new columnDb::update_user_profilewrapper updated to matchbuzz-relay
handle_kind0_profileparses the NIP-01 standardemailfield from kind:0 content and passes it toupdate_user_profile; no domain validation (unlike NIP-05) — the user is responsible for setting a valid git emailgit_emailso it is written even when the NIP-05 handle is contestedbuzz-acp
PromptProfilegainsgit_email: Option<String>parse_kind0_profile_lookupextracts theemailfield (empty strings filtered toNone)format_context_hintsacceptssender_pubkeyandprofile_lookup; emitsRequester-Git-Email: Name <email>when the triggering event's author has agit_emailset, omits the line entirely when absentnest_agents.md
Requester-Git-Email:from[Context]when present; fall back togit config user.emailwhen absentTests
test_parse_kind0_profile_lookup_extracts_email— email field parsed intogit_emailtest_parse_kind0_profile_lookup_ignores_empty_email— empty string treated as absenttest_format_context_hints_emits_requester_git_email_when_present— line appears in[Context]test_format_context_hints_omits_requester_git_email_when_absent— line absent when no emailtest_format_context_hints_requester_git_email_uses_nip05_as_name_fallback— name falls back to nip05_handleembedded_migrator_contains_all_schema_migrationsupdated for migration 4Notes
Profile UI for setting
emailis out of scope for this PR. Users can set it in any Nostr client via kind:0; the relay syncs it on receipt. A profile settings field can be a follow-up.