Skip to content

Add issue event history to issue_read behind a feature flag - #3178

Open
louim wants to merge 1 commit into
github:mainfrom
louim:issue-events-timeline
Open

louim wants to merge 1 commit into
github:mainfrom
louim:issue-events-timeline

Conversation

@louim

@louim louim commented Aug 28, 2026 •

Copy link
Copy Markdown

Summary

Adds three methods to issue_read behind a new issue_events feature flag: get_events, get_timeline and get_event.

Why

Agents can read an issue's current state but not its history: who requested reviews, which labels changed, what the title used to be, which commits referenced it. This rebuilds @artemsaveliev's #211 on current main. #211 predates the go-sdk migration and the merge of the issue read tools into issue_read, so the methods now live in issue_read.

@SamMorrowDrums this grew larger than #211 because the repo changed a lot since. Happy to adjust anything.

Closes #211
Closes #985
Refs #984

What changed

  • get_events lists the issue's events. get_timeline lists the timeline, which adds comments, commits, reviews and cross-references. get_event fetches one event by event_id and takes no issue_number.
  • New output types MinimalIssueEvent and MinimalTimelineItem. Bodies, commit messages and the dismissal message use sanitize.Content. Titles use sanitize.PlainText. This matches get_comments and get.
  • IssueRead and IssueReadWithEvents are two variants of the tool, and the flag picks one. This follows the pattern from Expose Copilot review thread resolution reasons #3123.

MCP impact

  • Tool schema or behavior changed

The schema changes only with the flag on. Without it, issue_read.snap is unchanged and the handler returns "unknown method" for the three new methods.

Prompts tested (tool changes only)

Run against the live API on github/github-mcp-server, cli/cli, golang/go and a private repo.

  • "Who was asked to review this PR, and did anyone review it without being asked?" (get_timeline)
  • "What's the event history of this issue?" (get_events)
  • "What happened on this pull request?" (get_timeline, including cross-repo references)
  • "Look up issue event 17200362448." (get_event)

Also tested: pagination, renamed, milestone, lock_reason, requested_team versus requested_reviewer, and the lockdown paths below.

Security / limits

  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Lockdown follows the existing rules. get_events and get_timeline drop entries whose author lacks push access, and get_event returns an error, as issue_read:get does. I checked this against the existing get_comments path. commented and reviewed entries name their author in User instead of Actor, so both are checked. committed entries carry only a commit name and email, so lockdown drops them.

The flag is there because of size: the timeline of #211 (71 entries) is 172KB raw and 27KB trimmed.

Open question for a maintainer: go-github's Timeline type has no minimized field, so a comment hidden as spam or abuse looks like any other comment. The type also lacks html_url, author_association, updated_at, reactions and lock_reason, so get_timeline shows less about a comment than get_comments does.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint (0 issues)
  • Tested locally with ./script/test (clean, including -race)

script/generate-docs produces no changes. The only new toolsnap is issue_read_ff_issue_events.snap.

Docs

  • Updated (README / docs / examples)

🤖 Generated with Claude Code

@louim
louim requested a review from a team as a code owner August 28, 2026 22:54
@louim

louim commented Sep 8, 2026

Copy link
Copy Markdown
Author

@SamMorrowDrums gentle ping here. Would love to get this in!

@SamMorrowDrums SamMorrowDrums added go Pull requests that update go code tool-proposal labels Sep 9, 2026

@dawNotPoi dawNotPoi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a Markdown fidelity regression in the new timeline converter; details inline.

Comment thread pkg/github/minimal_types.go Outdated
@louim
louim force-pushed the issue-events-timeline branch from 026c405 to 207fe79 Compare October 2, 2026 13:12
With the issue_events feature flag on, issue_read gets three more
methods:

- get_events lists the issue's events: labeled, assigned, closed,
  renamed and so on.
- get_timeline lists the timeline, which adds comments, commits,
  reviews and cross-references to the events.
- get_event fetches one event by event_id.

The flag keeps the extra methods out of the default issue_read schema.
Responses are converted to MinimalIssueEvent and MinimalTimelineItem.
The timeline of github#211 (71 entries) goes from 172KB raw to 27KB.

Beyond the basic event fields, the minimal types keep:

- The issue, as a MinimalIssueRef, on get_event. The caller passes only
  an event id, so this is the one place the response names the issue.
- commit_repository on timeline entries, parsed from commit_url.
  Referenced and force-push entries often point at a commit in a fork
  or another repo, and the SHA alone does not say which.
- The commit author and committer on committed entries, which have no
  actor or user.
- The review's state, id, dismissal message and commit on
  review_dismissed events.

Commit parents are dropped.

Bodies, commit messages and the dismissal message use sanitize.Content.
Titles use sanitize.PlainText. This matches get_comments and get.

Without the flag, issue_read keeps its current schema (issue_read.snap
is unchanged) and returns "unknown method" for the three new methods.
With the flag, issue_number leaves the schema's required list because
get_event does not take one. The handler still requires it for the
other methods.

In lockdown mode, get_events and get_timeline drop entries whose author
lacks push access, and get_event returns an error, as issue_read:get
does. commented and reviewed entries name their author in User instead
of Actor, so both are checked. committed entries carry only a name and
email, so lockdown drops them.

Refs github#984, github#985
Closes github#211

Co-authored-by: Artem Saveliev <artemsaveliev@github.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@louim
louim force-pushed the issue-events-timeline branch from 207fe79 to 409db99 Compare October 2, 2026 14:10
@louim

louim commented Oct 2, 2026

Copy link
Copy Markdown
Author

@SamMorrowDrums this has been re-aligned with the main branch changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code tool-proposal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tool to get_issue_timeline

3 participants