Skip to content

fix(weekly-digest): truncate activity payload to stay within gpt-4.1-mini's 8000-token limit - #47

Merged
alexlovelltroy merged 2 commits into
mainfrom
copilot/fix-weekly-digest-job
Jul 28, 2026
Merged

fix(weekly-digest): truncate activity payload to stay within gpt-4.1-mini's 8000-token limit#47
alexlovelltroy merged 2 commits into
mainfrom
copilot/fix-weekly-digest-job

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

The weekly_digest job was failing with HTTP 413 because gh search returns full nested objects for repository and author, and collects unbounded results — pushing the JSON payload over gpt-4.1-mini's 8000-token request body limit.

Changes

  • Flatten nested objects: extract .repository.nameWithOwner and .author.login as plain strings instead of embedding the full gh-search objects (which include id, isPrivate, isFork, etc.)
  • Cap result counts: limit issues and PRs to 15 items each, releases to 10
  • Drop the events key: was already hardcoded to []; removed entirely
- issues: [.issues[] | {title, number, repository, author, state, url}],
- prs:    [.prs[]    | {title, number, repository, author, state, url}],
- releases: [.releases[] | {name, tag_name, repository, html_url}],
- events: []
+ issues:   [.issues[]   | {title, number, repository: (.repository.nameWithOwner // .repository), author: (.author.login // .author), state, url}] | .[0:15],
+ prs:      [.prs[]      | {title, number, repository: (.repository.nameWithOwner // .repository), author: (.author.login // .author), state, url}] | .[0:15],
+ releases: [.releases[] | {name, tag_name, repository, html_url}] | .[0:10]

The weekly_digest job was failing with HTTP 413 "Request Entity Too Large"
because the activity JSON sent to gpt-4.1-mini exceeded its 8000-token
request-body limit.

Fix the jq filter in the "Generate digest" step to:
- Extract plain strings from nested objects: repository.nameWithOwner and
  author.login (instead of embedding the full objects)
- Cap counts: issues ≤15, PRs ≤15, releases ≤10
- Drop the events key entirely (was already empty [])
Copilot AI changed the title [WIP] Fix failing GitHub Actions job weekly_digest fix(weekly-digest): truncate activity payload to stay within gpt-4.1-mini's 8000-token limit Jul 28, 2026
Copilot AI requested a review from alexlovelltroy July 28, 2026 12:11
@alexlovelltroy
alexlovelltroy marked this pull request as ready for review July 28, 2026 14:37
@alexlovelltroy
alexlovelltroy merged commit 062a2fb into main Jul 28, 2026
2 checks passed
@alexlovelltroy
alexlovelltroy deleted the copilot/fix-weekly-digest-job branch July 28, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants