feat(#354): prefetch PR context in pre-retro.sh#409
feat(#354): prefetch PR context in pre-retro.sh#409fullsend-ai-coder[bot] wants to merge 3 commits into
Conversation
Add a prefetch_context() function to pre-retro.sh that runs on the host before sandbox launch. Fetches PR metadata, comments, reviews, and workflow runs via gh CLI and writes pr-context.json. This makes the retro agent resilient to in-sandbox GH_TOKEN failures — the pattern already exists for the review agent (pre-fetch-prior-review.sh) but was missing for retro. The prefetch is non-blocking: if GH_TOKEN is missing or API calls fail, the script emits a warning and continues. A 5 MB size limit prevents oversized payloads. Changes: - scripts/pre-retro.sh: add prefetch_context() function - harness/retro.yaml: mount pr-context.json into sandbox (optional) - agents/retro.md: document pr-context.json as agent input - skills/retro-analysis/SKILL.md: add prefetched context section - scripts/pre-retro-test.sh: 7 test cases covering prefetch logic - Makefile: register pre-retro-test.sh in script-test target Closes #354 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
E2E tests did not runE2E tests run automatically for org/repo members and collaborators on pull requests. For other contributors, a maintainer must add the See E2E testing guide for details. |
|
🤖 Finished Review · ✅ Success · Started 9:01 AM UTC · Completed 9:14 AM UTC |
Review — approveVerdict: Approve ✅ This PR adds prefetch functionality to What was reviewed
Correctness
Security
No blocking findingsThe change is additive, backward-compatible (optional file with live-API fallback), follows the established Previous runReviewVerdict: Approve The PR adds a well-structured What was verified
Low-severity observations (non-blocking)
Previous run (2)ReviewFindingsMedium
Low
Previous run (3)ReviewFindingsMedium
Low
Previous run (4)ReviewFindingsHigh
Medium
Low
Labels: PR modifies retro agent dispatch infrastructure (pre-script, harness config, agent definition). |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 9:34 AM UTC · Completed 9:44 AM UTC |
Superseded by updated review
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 9:53 AM UTC · Completed 10:04 AM UTC |
- Document hybrid model (prefetch + runtime creds) as intentional deviation from ADR 0017's full-isolation default - Add REPO_FULL_NAME format validation consistent with other pre-scripts - Add branch filter to workflow_runs query using headRefName Addresses review feedback on #409
🔧 Fix agent — iteration 1 (human-triggered)Addressed all 3 review findings: documented hybrid credential model as intentional ADR 0017 deviation, added branch filter to workflow_runs query, added REPO_FULL_NAME format validation. All 7 pre-retro tests pass. Fixed (3):
Tests: passed Updated by fullsend fix agent |
|
🤖 Finished Review · ✅ Success · Started 10:05 AM UTC · Completed 10:20 AM UTC |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 1:08 PM UTC · Completed 1:19 PM UTC |
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 1:42 PM UTC · Completed 1:58 PM UTC |
- Mask GH_TOKEN with ::add-mask:: in pre-retro.sh for consistency with post-retro.sh (secrets-handling) - Add test for partial API failure: gh pr view succeeds but gh api calls fail, verifying per-endpoint fallback to empty arrays (test-gap) - Add test for 5 MB size-limit enforcement: mock wc reports oversized payload, verifying file removal guard path (test-gap) Addresses review feedback on #409
🔧 Fix agent — iteration 2 (human-triggered)Addressed 3 of 4 low-severity review observations. Added GH_TOKEN masking for log safety, partial API failure test, and size-limit guard test. Disagreed with 1 (pre-existing Makefile docs gap, out of scope). All 9 tests pass. Fixed (3):
Disagreed (1):
Tests: passed Updated by fullsend fix agent |
|
🤖 Finished Review · ✅ Success · Started 2:03 PM UTC · Completed 2:09 PM UTC |
Add a data-prefetch section to pre-retro.sh that runs on the host before sandbox launch. The script fetches PR metadata, comments, reviews, and workflow run data via the gh CLI, then writes a pr-context.json file that is mounted into the sandbox via host_files in retro.yaml.
This makes the retro agent resilient to in-sandbox GH_TOKEN failures by providing prefetched context. The agent reads pr-context.json first and falls back to live API calls only for data not included in the prefetch.
The prefetch is non-blocking: if GH_TOKEN is missing or API calls fail, the script emits a warning and continues. A 5 MB size limit prevents oversized payloads from bloating the sandbox.
Changes:
Note: pre-commit shellcheck could not run (shellcheck-py install failed due to sandbox Python 3.14 incompatibility). The post-script runs an authoritative pre-commit check on the runner.
Closes #354
Post-script verification
agent/354-prefetch-retro-context)