Skip to content

fix(AISDLC-317): stop agents on moved issues - #1689

Open
msu8 wants to merge 1 commit into
fullsend-ai:mainfrom
msu8:AISDLC-317
Open

msu8 wants to merge 1 commit into
fullsend-ai:mainfrom
msu8:AISDLC-317

Conversation

@msu8

@msu8 msu8 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Detect GitHub issues moved to another repository before running /fs-code.
  • Support both native GitHub transfers and close-and-recreate moves.
  • Post guidance pointing to the issue’s new location.
  • Emit the pre-script skip protocol so the code agent is not started.
  • Add tests for moved and normally closed issues.
  • Regenerate affected script bundles.

Implementation

Native transfers are detected when the issue’s repository_url differs from REPO_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

  • Move-specific source and bundled pre-code tests pass.
  • make check-bundle passes.
  • Targeted pre-commit checks and ShellCheck pass.

Part of AISDLC-308.

@msu8
msu8 requested a review from a team October 15, 2026 14:50
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Functional tests did not run

Functional 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 ok-to-test label after the latest push.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Stop the code agent when a GitHub issue has moved

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Detect native transfers and marked close-and-recreate moves before code-agent setup.
• Direct users to the destination and signal the pre-script to skip the agent.
• Test moved and normally closed issues; regenerate affected script bundles.
Diagram

graph TD
  P["Pre-code input"] --> I["GitHub issue"] --> T{"Repository changed?"} -- No --> K{"Closed with marker?"} -- No --> N["Existing workflow"]
  T -- Yes --> M["Resolve destination"] --> C["Post guidance"] --> S["Skip agent"]
  K -- Yes --> M
Loading
High-Level Assessment

Keep the early, GitHub-specific pre-script check: it prevents downstream agent setup and reuses the move provenance marker. Inferring close-and-recreate moves from broader GitHub history would require more API work without improving this explicit handoff.

Files changed (6) +349 / -14

Bug fix (3) +176 / -6
github-code-ops.lib.shAdd issue lookup and location-aware commenting +13/-3

Add issue lookup and location-aware commenting

• Adds a REST issue lookup for transfer metadata and a comment helper that accepts a repository and issue number. The existing comment helper delegates to it.

scripts/lib/github-code-ops.lib.sh

pre-code.shBundle early moved-issue detection into pre-code +88/-3

Bundle early moved-issue detection into pre-code

• Includes the new forge helpers and moved-issue check in the executable bundle. Moved GitHub issues receive guidance and a skip signal before existing pre-code checks proceed.

scripts/pre-code.sh

pre-code.src.shSkip code-agent setup for moved GitHub issues +75/-0

Skip code-agent setup for moved GitHub issues

• Detects native transfers from repository metadata and close-and-recreate moves from marked comments. It posts destination guidance, writes the pre-script skip reason, and leaves unmarked closed issues on the existing path.

scripts/pre-code.src.sh

Tests (1) +147 / -2
pre-code-test.shTest move detection and pre-script skip behavior +147/-2

Test move detection and pre-script skip behavior

• Extends the GitHub mock to return issue metadata and comments, then verifies guidance targets, skip protocol output, and normal handling of an unmarked closed issue.

scripts/pre-code-test.sh

Other (2) +26 / -6
post-code.shRegenerate post-code bundle with GitHub helpers +13/-3

Regenerate post-code bundle with GitHub helpers

• Includes the updated GitHub issue lookup and comment helpers from the shared library.

scripts/post-code.sh

pre-code-jira.shRegenerate Jira pre-code bundle with shared helpers +13/-3

Regenerate Jira pre-code bundle with shared helpers

• Includes the updated GitHub forge helpers through bundle regeneration; it does not add the moved-issue check to Jira.

scripts/pre-code-jira.sh

@qodo-code-review

qodo-code-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (1) 📜 Skill insights (1)

Grey Divider


Action required

1. Transferred issues receive no guidance 🔗 Cross-repo conflict ≡ Correctness
Description
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.
Code

scripts/pre-code.src.sh[82]

+    printf '%s\t%s\t%s\t%s\n' "${target_repo}" "${target_number}" "${target_repo}" "${target_number}"
Relevance

●●● Strong

Permission failures affecting required comments are accepted when tokens may lack target-repository
write access.

PR-#38

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR directs native-transfer comments to the destination and ignores posting failures. Fullsend
requests a token for the workflow's source repository, and its mint implementation restricts the
installation token to the requested repositories.

agents -> fullsend
scripts/pre-code.src.sh[75-83]
scripts/pre-code.src.sh[153-164]
scripts/lib/github-code-ops.lib.sh[75-80]
External repo: fullsend-ai/fullsend, .github/workflows/reusable-dispatch.yml [849-865]
External repo: fullsend-ai/fullsend, internal/mintcore/github.go [965-971]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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

Dismiss ↗ | View ↗


2. Issue commenters can block code runs ✓ Resolved
Description
check_for_moved_issue trusts any comment whose body starts with the move marker and contains a
syntactically valid destination, without checking who posted it. On a closed issue, an unrelated
commenter can plant that text before an authorized /fs-code run, causing the script to post false
guidance and emit skipped=true.
Code

scripts/pre-code.src.sh[R91-93]

+  move_comment="$(printf '%s' "${comments}" | jq -r --arg marker "${FULLSEND_MOVE_MARKER}" '
+    [.[] | select((.body // "") | startswith($marker)) | .body] | last // empty
+  ' 2>/dev/null || true)"
Relevance

●●● Strong

Recent security precedents accept authentication and authorization checks preventing untrusted
metadata from controlling workflow decisions.

PR-#1490

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comments endpoint supplies comment JSON, but the new filter retains only matching bodies. The
destination then directly controls the guidance and skip decision; command authorization does not
authenticate historical comments.

scripts/lib/github-code-ops.lib.sh[275-287]
scripts/pre-code.src.sh[89-100]
scripts/pre-code.src.sh[153-164]
docs/code.md[20-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Any issue commenter can forge the move marker on a closed issue, causing a later authorized code run to be skipped and users to receive a false destination.
## Fix Focus Areas
- scripts/pre-code.src.sh[89-100]
- scripts/pre-code.src.sh[153-164]
## Recommended Fix
Validate the marker comment's author against the trusted move-agent identity or another authenticated move record before accepting its destination. Add a test with an untrusted marker comment on a closed issue.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. The title hides the ticket scope ⊘ Outdated
Description
The PR title fix(pre-code): stop agents on moved issues uses pre-code as its scope even though
the repository directs fixes for specific issues to prefer the issue number and this PR identifies
AISDLC-317. Reviewers and automation must infer the ticket from the branch or description instead
of the title itself, weakening traceability.
Code

scripts/pre-code.src.sh[R153-156]

+if [[ "${FULLSEND_FORGE}" == "github" ]]; then
+  MOVE_INFO="$(check_for_moved_issue || true)"
+  if [[ -n "${MOVE_INFO}" ]]; then
+    IFS=$'\t' read -r MOVE_REPO MOVE_NUMBER COMMENT_REPO COMMENT_NUMBER <<< "${MOVE_INFO}"
Relevance

●●● Strong

Recent guidance explicitly prioritizes ticket-scoped titles when repository conventions prefer issue
identifiers.

PR-#1257

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The repository's commit-message guidance classifies issue-specific fixes as ticket-scoped, while the
submitted title uses the area scope pre-code; the branch and PR context provide the ticket key
AISDLC-317.

COMMITS.md[53-56]
scripts/pre-code.src.sh[153-156]
Skill: code-implementation

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The repository uses ticket-oriented scopes for fixes tied to a specific issue, but the PR title uses the subsystem name `pre-code` while the branch identifies ticket `AISDLC-317`.

## Fix Focus Areas
- scripts/pre-code.src.sh[153-156]

## Recommended Fix
Rename the PR title to use the ticket scope, for example `fix(AISDLC-317): stop agents on moved issues`, while preserving the existing fix type and subject.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. API failures start agents on moved issues ✓ Resolved
Description
check_for_moved_issue treats an empty issue response or an empty comments result as proof that no
move occurred, while both lookup helpers suppress API failures. If either lookup fails for a moved
issue, the script emits no skip protocol and continues toward the code agent without reporting that
detection failed.
Code

scripts/pre-code.src.sh[R63-65]

+  issue_json="$(forge_get_issue_movement_details)"
+  if [[ -z "${issue_json}" ]]; then
+    return 0
Relevance

●●● Strong

Recent precedent accepts fail-open API handling fixes when suppressed failures can cause incorrect
workflow decisions.

PR-#1590

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The issue helper converts a failed gh api call to empty output, and the comments helper converts
failed or unparseable output to []. The new detector returns no move for both values, so its
caller skips only when both necessary lookups succeeded and yielded move information.

scripts/lib/github-code-ops.lib.sh[275-291]
scripts/pre-code.src.sh[63-70]
scripts/pre-code.src.sh[89-101]
scripts/pre-code.src.sh[153-166]
scripts/lib/prescript-output.lib.sh[20-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Failed issue or comment lookups are interpreted as an unmoved issue, so a moved issue can reach the code agent.
## Fix Focus Areas
- scripts/lib/github-code-ops.lib.sh[275-291]
- scripts/pre-code.src.sh[63-70]
- scripts/pre-code.src.sh[89-94]
- scripts/pre-code.src.sh[153-166]
## Recommended Fix
Preserve lookup errors separately from valid responses with no move. On a lookup failure, report the failure and stop or retry rather than treating it as evidence that the issue has not moved; cover both lookup paths in tests.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Docs omit moved-issue handling ✓ Resolved
Description
The new check_for_moved_issue path stops /fs-code and posts a destination-specific instruction,
but docs/code.md still describes only open-PR and sub-issue pre-script checks. Anyone using that
guide cannot learn that native transfers and marked close-and-recreate moves are skipped before the
code agent starts.
Code

scripts/pre-code.src.sh[R153-156]

+if [[ "${FULLSEND_FORGE}" == "github" ]]; then
+  MOVE_INFO="$(check_for_moved_issue || true)"
+  if [[ -n "${MOVE_INFO}" ]]; then
+    IFS=$'\t' read -r MOVE_REPO MOVE_NUMBER COMMENT_REPO COMMENT_NUMBER <<< "${MOVE_INFO}"
Relevance

●●● Strong

Repository history consistently accepts documentation updates covering newly introduced agent
workflow behavior.

PR-#389

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed pre-code source adds moved-issue detection and an early skip, while the existing
code-agent documentation lists other pre-script checks without documenting this new behavioral path.

scripts/pre-code.src.sh[47-102]
scripts/pre-code.src.sh[150-166]
docs/code.md[60-64]
Skill: pr-review

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The pre-code behavior now detects moved GitHub issues, posts guidance to the destination, emits the skip protocol, and prevents the code agent from starting, but the code-agent documentation does not describe this behavior.

## Fix Focus Areas
- docs/code.md[60-64]
- scripts/pre-code.src.sh[153-166]

## Recommended Fix
Update the pre-script behavior documentation to explain native GitHub transfers and close-and-recreate moves marked with the Fullsend provenance marker, including the guidance comment and skipped-agent protocol.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (1)
6. Mixed-case repo names halt code runs ✓ Resolved
Description
check_for_moved_issue compares the repository name extracted from the API response with
REPO_FULL_NAME using case-sensitive string inequality. When the event URL and API response use
different casing for the same repository, it identifies a native transfer, posts move guidance, and
skips an issue that has not moved.
Code

scripts/pre-code.src.sh[R75-77]

+  target_repo="$(printf '%s' "${repository_url}" | sed -nE 's|.*/repos/([^/]+/[^/]+)$|\1|p')"
+  if [[ "${target_repo}" =~ ^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+$ ]] \
+    && [[ "${target_repo}" != "${REPO_FULL_NAME}" ]]; then
Relevance

●●● Strong

Case-insensitive identity matching is an accepted correctness convention for GitHub usernames and
identifiers.

PR-#592

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The input validator permits uppercase repository names, and the URL-derived repository is checked
against the event's REPO_FULL_NAME. The added comparison does not normalize that name or the API
response before deciding that the issue moved.

scripts/lib/github-code-ops.lib.sh[20-38]
scripts/pre-code.src.sh[112-138]
scripts/pre-code.src.sh[75-83]
scripts/pre-code.src.sh[153-164]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Different casing between the event's repository name and the API's canonical repository name is mistaken for an issue transfer.
## Fix Focus Areas
- scripts/pre-code.src.sh[75-83]
- scripts/pre-code-test.sh[923-949]
## Recommended Fix
Normalize both repository names to the same case for the transfer comparison while preserving the API's spelling for destination guidance. Add a test where only the casing differs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

7. Protected scripts block auto-approval 📜 Skill insight § Compliance
Description
The PR changes files under the configured scripts/ protected prefix, including the pre-code source
and generated bundles. Because the active review policy treats any matching path as requiring human
review, this change cannot receive automatic approval.
Code

scripts/pre-code.src.sh[R153-156]

+if [[ "${FULLSEND_FORGE}" == "github" ]]; then
+  MOVE_INFO="$(check_for_moved_issue || true)"
+  if [[ -n "${MOVE_INFO}" ]]; then
+    IFS=$'\t' read -r MOVE_REPO MOVE_NUMBER COMMENT_REPO COMMENT_NUMBER <<< "${MOVE_INFO}"
Relevance

● Weak

Protected-path human-approval findings have been rejected as policy-process requirements rather than
code changes.

PR-#1645

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The active review configuration lists scripts/ as a protected path, and this PR changes
scripts/pre-code.src.sh plus generated scripts under the same prefix.

harness/review.yaml[63-67]
scripts/pre-code.src.sh[153-156]
Skill: pr-review

Dismiss ↗ | View ↗


Grey Divider

Context sources
⚠️ Tickets: not configured — ticket URL found in PR but could not be fetched — check ticket provider credentials
✅ Compliance rules (platform): 57 rules
✅ Skills: 4 invoked
  code-review
  code-implementation
  pr-review
  docs-review
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/fullsend (sha: 99417cc7) — View relationship
Review mode: Auto: ⚖️ Balanced: Behavioral pre-code gating affects agent dispatch and issue-handling workflows.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Outdated
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}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

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

Dismiss ↗ | View ↗

Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved
@msu8 msu8 changed the title fix(pre-code): stop agents on moved issues fix(AISDLC-317): stop agents on moved issues Oct 19, 2026
@msu8
msu8 force-pushed the AISDLC-317 branch 2 times, most recently from 97b9106 to d5b504b Compare October 19, 2026 09:58

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review-only pass: three MEDIUM findings inline.

Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved
Comment thread scripts/pre-code.src.sh Resolved

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review-only pass: one MEDIUM finding inline.

Comment thread scripts/pre-code.src.sh Outdated
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Signed-off-by: David Turecek <daturece@redhat.com>

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread scripts/pre-code.src.sh
exit 0
fi
echo "::error::Unable to verify whether issue ${ISSUE_NUMBER} was moved; refusing to start the code agent."
exit 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread scripts/pre-code.src.sh
# 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]"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread scripts/pre-code.src.sh
' 2>/dev/null || true)"
[[ -n "${move_comment}" ]] || return 0

move_location="$(extract_move_location "${move_comment}")"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants