Add issue event history to issue_read behind a feature flag - #3178
Open
louim wants to merge 1 commit into
Open
Conversation
Adds three read methods to issue_read, gated behind the new issue_events
feature flag:
- get_events - the issue's event feed (labeled, assigned, closed, ...)
- get_timeline - the full timeline, a superset that also carries comments,
commits, reviews and cross-references
- get_event - a single event addressed by its own event_id
Behind the flag because the REST payloads are large and the added schema is
not free: a single timeline page measured 157KB raw. Both feeds are trimmed
to minimal types (MinimalIssueEvent, MinimalTimelineItem) that keep the event
semantics and sanitize every user-authored field, in line with the surrounding
issue reads, bringing that page down to 21KB.
Trimming keeps the fields that carry event identity rather than everything the
upstream types can hold:
- The issue is kept as a compact MinimalIssueRef. Only get_event sends one,
and since it is addressed by event id that ref is the only thing naming the
issue an event belongs to.
- Timeline entries carry commit_repository, derived from the upstream
commit_url. A referenced or force-push entry frequently points at a commit
outside the issue's own repo (a fork branch, or an unrelated repo whose
commit message mentioned the issue), so a bare commit_id cannot be resolved.
- committed entries carry the commit's author and committer. Those entries have
no actor and no user, so without them the commit history is anonymous. They
are the commit object's name/email rather than GitHub logins, which is why
lockdown still cannot verify them.
- review_dismissed events carry the dismissed review's state, id, dismissal
message and commit, which the event name alone does not convey.
- Commit ancestry (Timeline.Parents) is dropped: a timeline is read to follow
the issue, not to walk commit history.
The ungated issue_read is untouched: same schema (issue_read.snap is
unchanged), and the handler rejects the three methods as unknown when the
flag is off. issue_number leaves the schema-level required list on the gated
variant only, since get_event has no issue number to supply; the handler
enforces it per method.
Lockdown mode follows the existing split: get_events and get_timeline filter
out entries whose author lacks push access, while get_event refuses the read
outright, as issue_read:get does. Attribution consults both Actor and User,
since commented and reviewed entries name their author in User and leave
Actor empty.
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>
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
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 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
Adds three read methods to
issue_read(get_events,get_timeline,get_event) exposing an issue's event history, behind a newissue_eventsfeature flag.Why
Agents can read an issue's state but not how it got there: review requests, label changes, previous titles, referencing commits. Rebuild of @artemsaveliev's #211 on current
main, folded intoissue_readsince that PR predates the go-sdk move and the issue-read consolidation.@SamMorrowDrums sorry, this PR became much more involved in the current state of the repo. Hopefully it covers everything. Happy to tweak anything you find relevant!
Closes #211
Closes #985
Refs #984
What changed
FeatureFlagIssueEvents.get_timelineis a superset ofget_eventsthat also carries comments, commits, reviews and cross-references;get_eventtakesevent_idinstead ofissue_number.IssueRead/IssueReadWithEventsfollow the flag-variant pattern from Expose Copilot review thread resolution reasons #3123.MCP impact
Schema changes only when the flag is on. Ungated
issue_readis untouched:issue_read.snapunchanged, and the handler rejects the three methods as unknown when the flag is off.Prompts tested (tool changes only)
Run against the live API on
github/github-mcp-server,cli/cli,golang/goand a private repo.get_timeline)get_events)get_timeline, including cross-repo references)get_event)Also exercised: pagination,
renamed,milestone,lock_reason,requested_teamagainstrequested_reviewer, and the lockdown paths below.安全 / limits
Lockdown follows the existing split:
get_eventsandget_timelinefilter entries whose author lacks push access,get_eventrefuses the read outright (asissue_read:getdoes). Verified identical to the pre-existingget_commentspath. Attribution reads bothActorandUser, sincecommentedandreviewedentries populate onlyUser.Size is why this is flagged: one 69-entry timeline page is 157KB raw, 26KB trimmed.
Known gap worth a maintainer's opinion: go-github's
Timelinetype does not modelminimized, so a comment hidden as spam or abuse is indistinguishable from a normal one. Same ceiling hideshtml_url,author_association,updated_at,reactionsandlock_reasonfromget_timeline, making its view of a comment poorer thanget_comments.Tool renaming
Lint & tests
./script/lint(0 issues)./script/test(clean, including-race)No toolsnap drift;
script/generate-docsleavesREADME.mdunchanged.Docs