Skip to content

fix(desktop): export agent NIP-OA attestation to git credential helper - #3205

Open
alu042 wants to merge 1 commit into
block:mainfrom
alu042:fix/desktop-merge-agent-auth-tag
Open

fix(desktop): export agent NIP-OA attestation to git credential helper#3205
alu042 wants to merge 1 commit into
block:mainfrom
alu042:fix/desktop-merge-agent-auth-tag

Conversation

@alu042

@alu042 alu042 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Merging a pull request in an agent-owned repo fails on membership-enforcing relays. The desktop authenticates git as the managed agent but does not pass its NIP-OA owner attestation to git-credential-nostr, so the merge's initial clone is rejected with 403 restricted: not a relay member — even though the agent's own pushes to the same repo work (the ACP harness injects BUZZ_AUTH_TAG for agent subprocesses, and #2120 taught the helper and relay to carry the attestation inside the NIP-98 event).

This passes the auth tag through GitAuthConfig and exports it as BUZZ_AUTH_TAG for credentialed git commands. Agents created before auth tags were persisted resolve one through the existing stored-or-computed fallback from the message path, which also covers the PR status event submissions made under the same identity. NOSTR_PRIVATE_KEY, BUZZ_AUTH_TAG and BUZZ_PRIVATE_KEY are now cleared before every git command so ambient values can't be inherited accidentally.

Viewer-owned operations continue to authenticate without an owner attestation. Missing-helper diagnostics and a friendlier merge error message are left for follow-ups.

Related issue

N/A — no duplicate found in open or closed issues and PRs; the diagnosis is above rather than in a separate issue. Two related but distinct reports: #2316 is a different failure earlier in the same git-auth path (the helper yields no credentials at all, needs git >= 2.46), and #2345 touches project_git_exec.rs for helper diagnostics, so there is a small overlap if it lands first.

Testing

  • cargo test --manifest-path desktop/src-tauri/Cargo.toml
  • just desktop-tauri-fmt-check
  • just desktop-tauri-clippy
  • just desktop-check

Unit tests cover auth-tag propagation from the owner identity into the git environment, environment scrubbing for credentialed, local and missing-helper commands, and stored-vs-computed attestation selection for legacy records.

I also ran a live integration test of the git/auth path against a locally built relay with BUZZ_REQUIRE_RELAY_MEMBERSHIP=true and BUZZ_ALLOW_NIP_OA_AUTH=true, driving the patched run_git/configure_git_auth with a repo owned by a non-member agent whose owner is a member. Without the attestation the merge's first clone fails with remote: restricted: not a relay member and HTTP 403, matching the reported failure; with it, the merge sequence (clone, fetch, merge, push) succeeds and a fresh clone contained the merged content on the target branch. The original failure was separately observed on v0.4.26 against a hosted community.

No UI change.

Agent-owned PR merges authenticate git as the managed agent, but the
desktop did not pass the agent's NIP-OA auth tag to git-credential-nostr,
so relays that enforce membership rejected the merge's initial clone.

Pass the tag through GitAuthConfig, resolve the owner identity with the
existing stored-or-computed fallback so legacy agent records work, and
clear inherited identity env vars before running git.

Tests: cargo test --manifest-path desktop/src-tauri/Cargo.toml
Signed-off-by: Alexander Lundervold <alexander.lundervold@gmail.com>
@alu042
alu042 requested a review from a team as a code owner July 27, 2026 20:35
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