Skip to content

feat: attach a published session to a pull request - #6

Open
mvanhorn wants to merge 1 commit into
spacefast:mainfrom
mvanhorn:fix/push-session-attach-to-pr
Open

mvanhorn wants to merge 1 commit into
spacefast:mainfrom
mvanhorn:fix/push-session-attach-to-pr

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 16, 2026 •

Copy link
Copy Markdown

Summary

npx push-session <agent> --pr publishes the session and adds an "Agent session" comment with the share link to the open pull request for the current branch, or to a PR passed by number or URL. Running it again updates that same comment, so a PR never collects duplicates. --format markdown prints the same block for any other review tool.

Why this matters

When an agent writes a change, the diff alone doesn't show how it got there: what was asked, what it ran, what it tried and dropped. push-session already turns that history into a scoped, read-only link. This puts the link where review happens, in one command and without copy-paste.

Demo

Simulated demo (HyperFrames) of a run against a private test repository:

demo

Changes

  • src/pr.js resolves the PR and upserts the comment. It uses gh when it is installed (gh pr view, gh api) and otherwise GITHUB_TOKEN with the REST API. The comment carries a hidden <!-- push-session:<sessionId> --> marker, and the upsert looks for it to decide between PATCH and POST.
  • Posting is best-effort. If the PR can't be resolved or the comment fails, the session is still published, a warning explains why, and the markdown block is printed for pasting by hand. Error messages never echo the comment body or link.
  • Public repositories: anyone who can read the PR could open the link, so it asks interactively, and non-interactive runs need --yes.
  • --format markdown|text|json replaces the boolean, and --json stays as an alias. Text output adds a PR comment (created|updated) line with the comment URL.

Testing

  • npm run check passes 82 tests. The new test/pr.test.js covers branch-to-PR resolution, the gh and token paths, create then update by marker, comment pagination, the fallback with neither gh nor a token, the public-repo confirmation, and the text output line.
  • Live run on a private repository with one open PR: the first run reported created and the second updated. The PR still had exactly one comment, and its link opened the published transcript.

Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

--pr publishes the session and adds one "Agent session" comment to the open
PR for the current branch, or to the PR passed by number or URL. Re-running
updates that comment instead of adding another. Uses gh when installed,
GITHUB_TOKEN otherwise, and falls back to printing the markdown when neither
works. Posting to a public repository asks first, or needs --yes.

--format markdown prints the same block for any other review tool.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c25ddf5a-1bc6-4a44-bcb9-6d119df36d5a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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