Repository navigation
Conversation
Functional tests did not runFunctional tests run automatically for pull requests authored by users with write access or higher. For other contributors, a maintainer with write access must add the |
PR Summary by QodoStop the code agent when a GitHub issue has moved
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Transferred issues receive no guidance
|
| if [[ ! "${target_number}" =~ ^[1-9][0-9]*$ ]]; then | ||
| target_number="${ISSUE_NUMBER}" | ||
| fi | ||
| printf '%s\t%s\t%s\t%s\n' "${target_repo}" "${target_number}" "${target_repo}" "${target_number}" |
There was a problem hiding this comment.
2. Transferred issues receive no guidance 🔗 Cross-repo conflict ≡ Correctness
check_for_moved_issue selects the destination repository for native transfers, but forge_post_issue_comment_at tries to post there using the run's source-repository token. Fullsend's code workflow mints that token for only the source repository, so a transfer to another repository leaves the guidance comment unauthorized while the pre-script suppresses the error and reports a successful skip.
Agent Prompt
## Issue description
Native-transfer guidance targets a repository outside the Fullsend code workflow's default token scope, and comment failures are ignored.
## Fix Focus Areas
- scripts/pre-code.src.sh[76-83]
- scripts/pre-code.src.sh[153-164]
- .github/workflows/reusable-dispatch.yml[856-865]
## Recommended Fix
Coordinate with fullsend-ai/fullsend to obtain a token authorized for the discovered destination before posting guidance, or use an authorized source-side notification mechanism. Handle comment failure explicitly rather than reporting guidance as posted.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
97b9106 to
d5b504b
Compare
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: three MEDIUM findings inline.
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: one MEDIUM finding inline.
| issue_status="$(printf '%s\n' "${issue_response}" | sed -nE \ | ||
| 's/^HTTP\/[0-9.]+[[:space:]]+([0-9]{3}).*/\1/p' | head -1 | tr -d '\r')" | ||
| case "${issue_status}" in | ||
| 301) |
There was a problem hiding this comment.
MEDIUM: The 301 transfer branch never runs: gh api follows redirects, and its Location parser would misread the real redirect URL
forge_get_issue_movement_details (scripts/lib/github-code-ops.lib.sh:294) runs gh api --include and expects to see a 301 status and a Location header. gh follows redirects, so that never happens. Checked live: gh api --include repos/zeit/next.js/issues/1 prints HTTP/2.0 200 OK, while curl -I on the same URL returns HTTP/2 301 with location: https://api.github.com/repositories/70107786/issues/1.
In production a native transfer therefore comes back either as a 200 with the destination body, which the repository_url comparison at lines 125-139 already handles, or as a 404, which the code treats as indeterminate. The 301) case at lines 80-94 is dead code. The tests native-transfer-redirect-skips-code-agent and native-transfer-redirect-without-location-skips-safely (scripts/pre-code-test.sh:999-1022) pass only because the mock emits a 301 that real gh never produces.
If the branch were ever reached, extract_native_transfer_location (line 65) would also misparse the real Location. GitHub sends the repository-ID form /repositories/<id>/issues/<n>, and with (repos/)? optional the owner/repo group matches repositories/70107786. The script would then post guidance with --repo repositories/70107786 and write reason=issue moved to repositories/70107786#1. The test fixtures use /repos/org/new-repo/issues/123, which is not the format GitHub sends.
docs/code.md:62 says "The movement lookup preserves GitHub's response status so a transfer redirect can provide the destination", which is also wrong. (This path came from my earlier suggestion in the line-65 thread to use gh api -i and inspect the status; that premise does not hold, sorry for the detour.)
Suggestion: Remove the 301 branch, extract_native_transfer_location and the two redirect tests, and change docs/code.md to say native transfers are detected from the followed-redirect body (repository_url/html_url) or treated as indeterminate on 404. Make the mock emit HTTP/2.0 <code> <text> as real gh does. If the raw status is truly needed, make a request that does not follow redirects, and resolve /repositories/<id> through gh api repositories/<id> --jq .full_name (or return 2) instead of accepting it as owner/repo.
Signed-off-by: David Turecek <daturece@redhat.com>
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: four MEDIUM findings inline.
| local issue_number="$2" | ||
| local body="$3" | ||
| printf '%s' "${body}" | gh issue comment "${issue_number}" \ | ||
| --repo "${repo}" --body-file - 2>/dev/null |
There was a problem hiding this comment.
MEDIUM: Shared forge_post_issue_comment now discards stderr, which stops forge_retry_transient from retrying
On main, forge_post_issue_comment ran gh issue comment ... --body-file - with stderr intact. The PR sends it through the new forge_post_issue_comment_at, which adds 2>/dev/null. Existing callers wrap this helper in forge_retry_transient: post-code.src.sh:419 (no-op comment), pre-code.src.sh:330 and :357 (skip comments), and validate-code-output.sh:615. The same change is regenerated into the post-code.sh and pre-code-jira.sh bundles. forge_retry_transient (forge-transient-retry.lib.sh) captures stdout and stderr and passes the text to forge_is_transient_error. gh writes 5xx and timeout text only to stderr, so a 502/503 or timeout now counts as a permanent failure. The comment is not retried, and the warning has no gh error text. The PR changes existing post-code and validation behaviour without saying so.
Suggestion: Remove 2>/dev/null from forge_post_issue_comment_at. Redirect stderr only at the one call that needs to be quiet (the move-guidance post at pre-code.src.sh:220). Add a regression test where gh fails once with HTTP 502 and then succeeds, and check that forge_retry_transient forge_post_issue_comment retries.
| exit 0 | ||
| fi | ||
| echo "::error::Unable to verify whether issue ${ISSUE_NUMBER} was moved; refusing to start the code agent." | ||
| exit 1 |
There was a problem hiding this comment.
MEDIUM: Move lookup has no transient retry, so one GitHub 5xx fails every /fs-code run, --force included
forge_get_issue_movement_details runs gh api --include ... 2>/dev/null || true once. forge_get_issue_comments_strict also makes a single attempt. check_for_moved_issue returns 1 for any status other than 200 or 404: 5xx, 429 or 403 secondary rate limits, an empty response after a network error, or 410 Gone for a deleted issue. It also returns 1 when the comment fetch fails. The caller then runs exit 1 with 'refusing to start the code agent'. This happens before the best-effort existing-PR and sub-issue checks and is not bypassed by --force, so a single API hiccup now fails a code run that used to go ahead. A 410 (deleted issue) is misreported as 'Unable to verify whether issue N was moved'. The earlier threads covered a missing GH_TOKEN and source-token 404s, not transient retry.
Suggestion: Retry the issue and comment lookups on 5xx, 429 and 403 rate-limit responses. Either parse the --include status line in a small loop, or wrap the gh call in forge_retry_transient before stderr is discarded. Handle 410 explicitly with a 'deleted' message and the skip protocol.
| # handler must keep the destination in the comment text using the form shown | ||
| # below so a later /fs-code run can guide the issue to its new location. | ||
| FULLSEND_MOVE_MARKER='<!-- fullsend:move-agent -->' | ||
| FULLSEND_MOVE_AGENT_LOGIN="${FULLSEND_APP_SET:-fullsend-ai}-triage[bot]" |
There was a problem hiding this comment.
MEDIUM: FULLSEND_APP_SET never reaches the code pre-script, so custom app-set move-marker detection is unreachable
The earlier hardcoded-login thread was addressed by setting FULLSEND_MOVE_AGENT_LOGIN="${FULLSEND_APP_SET:-fullsend-ai}-triage[bot]", and docs/code.md:57 now promises <prefix>-triage[bot] support. Neither layer supplies the variable. harness/code.yaml has no FULLSEND_APP_SET in env.runner (harness/review.yaml does). In fullsend main, the reusable-dispatch.yml 'Run code agent' step does not set FULLSEND_APP_SET; only the route, review, fix and harness-run jobs do. The pre-script inherits os.Environ() plus the harness runner env, so the variable is always unset in code runs and the login is always fullsend-ai-triage[bot]. With a custom app set, the marker comment's author does not match, check_for_moved_issue returns 0, and the agent runs on the moved issue.
Suggestion: Add FULLSEND_APP_SET: "${FULLSEND_APP_SET}" to harness/code.yaml env.runner, and have the fullsend code job export FULLSEND_APP_SET: ${{ vars.FULLSEND_APP_SET || 'fullsend-ai' }}, as review and fix do. Otherwise, narrow the docs claim until both changes land.
| ' 2>/dev/null || true)" | ||
| [[ -n "${move_comment}" ]] || return 0 | ||
|
|
||
| move_location="$(extract_move_location "${move_comment}")" |
There was a problem hiding this comment.
MEDIUM: A trusted move marker with an unparseable destination fails open and starts the agent
Once a comment from the trusted triage bot that starts with FULLSEND_MOVE_MARKER is found, the issue is known to be moved. If extract_move_location finds no 'moved to owner/repo#N' (other wording, or a Jira key from the planned AISDLC-318 producer), the regex test at lines 137-141 fails silently. The function then returns 0 with empty output, and the caller starts the code agent on the closed original issue, the outcome this PR is meant to prevent. No warning is printed and no test covers the case. The producer contract is deferred to AISDLC-318, so a format mismatch is likely.
Suggestion: When the marker is present but no destination parses, print ::warning:: and skip the agent through the prescript protocol (skipped=true, reason 'issue moved; destination unavailable'). Add a test for a marker comment without a parseable destination.
Summary
/fs-code.Implementation
Native transfers are detected when the issue’s
repository_urldiffers fromREPO_FULL_NAME.Close-and-recreate moves are detected when the issue is closed and contains the Fullsend move provenance marker.
Normally closed issues without that marker continue through the existing flow.
Validation
make check-bundlepasses.Part of AISDLC-308.