Skip to content

fix(#4718): wire GH_TOKEN and re-add fail-fast validation for pre-code/pre-fix#5013

Open
waynesun09 wants to merge 1 commit into
mainfrom
fix-4718-dedupe-pre-scripts
Open

fix(#4718): wire GH_TOKEN and re-add fail-fast validation for pre-code/pre-fix#5013
waynesun09 wants to merge 1 commit into
mainfrom
fix-4718-dedupe-pre-scripts

Conversation

@waynesun09

Copy link
Copy Markdown
Member

Summary

Companion PR to fullsend-ai/agents#175. That PR adds CODE_SKIP_EXISTING_PR_CHECK and FIX_SKIP_TOOL_INSTALL flags to pre-code.sh/pre-fix.sh and harness/code.yaml so the harness pre_script invocation (inside fullsend run) can skip the work these workflows' inline pre-run steps already did, instead of repeating it. This PR is the fullsend-ai/fullsend half — the two only work together.

Related Issue

Fixes #4718

Changes

  • .github/workflows/reusable-code.yml — pass GH_TOKEN to the inline Validate inputs step. It never had one, so pre-code.sh's existing-human-PR check (GH API search, pr-open label, skip comment) was silently a no-op there — the harness invocation was the only place it ever ran. Once CODE_SKIP_EXISTING_PR_CHECK is set on that harness invocation (fix(#4718): stop running pre-code/pre-fix scripts twice per run agents#175), the check needs to actually work on this side, or the feature runs nowhere at all. (Caught by fullsend-ai-review[bot] on the original fix(#4718): stop running pre-code/pre-fix scripts twice per run #4762.)
  • .github/workflows/reusable-fix.yml — re-add a lightweight inline Validate inputs step with FIX_SKIP_TOOL_INSTALL=true, so PR_NUMBER/instruction/iteration-cap validation still fails fast before GCP/agent-env setup, without re-running the pre-commit tool auto-install that only the harness invocation needs.

Testing

  • make lint passes (staged changes)
  • YAML syntax validated (python3 -c "import yaml; yaml.safe_load(...)")

History

This supersedes #4762, which edited internal/scaffold/fullsend-repo/{harness,scripts}/* directly — those moved to fullsend-ai/agents and no longer affect runtime behavior (per discussion on #4762 with @rh-hemartin). This PR carries forward only the parts that still belong in this repo.

pre-code.sh and pre-fix.sh (now in fullsend-ai/agents) grew
CODE_SKIP_EXISTING_PR_CHECK and FIX_SKIP_TOOL_INSTALL flags so their
harness pre_script invocation (inside `fullsend run`) can skip the
work already done by these workflows' inline pre-run steps, instead
of repeating it. This is the fullsend-ai/fullsend half of that split:

- reusable-code.yml: pass GH_TOKEN to the inline "Validate inputs"
  step. It never had one, so pre-code.sh's existing-human-PR check
  (GH API search, pr-open label, skip comment) was silently a no-op
  there — the harness invocation was the only place it ever ran. Once
  CODE_SKIP_EXISTING_PR_CHECK is set on that harness invocation, the
  check needs to actually work on this side.
- reusable-fix.yml: re-add a lightweight inline "Validate inputs"
  step with FIX_SKIP_TOOL_INSTALL=true, so PR_NUMBER/instruction/
  iteration-cap validation still fails fast before GCP/agent-env
  setup, without re-running the pre-commit tool auto-install that
  only the harness invocation needs.

Depends on the matching fullsend-ai/agents change for the flags
themselves to exist.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 15, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:49 PM UTC · Completed 1:57 PM UTC
Commit: a1b4ca7 · View workflow run →

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix reusable workflows: pass GH_TOKEN and restore fail-fast pre-* validation

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Pass GH_TOKEN to pre-code.sh so existing-PR validation runs in reusable-code workflow.
• Set FIX_SKIP_TOOL_INSTALL=true for pre-fix.sh to keep validation fail-fast without re-install
 work.
Diagram

graph TD
  A["reusable-code.yml job"] --> B("Validate inputs") --> C["pre-code.sh"] --> D["GitHub API PR search"]
  E["reusable-fix.yml job"] --> F("Validate inputs") --> G["pre-fix.sh"] --> H["Fail fast before setup"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Move existing-PR validation into a dedicated workflow step/action
  • ➕ Makes the check explicit in the workflow (less hidden behavior in shell scripts)
  • ➕ Easier to unit-test and reason about permissions/outputs
  • ➖ Duplicates logic across repos unless a shared action is created/maintained
  • ➖ Bigger change than necessary for restoring broken behavior
2. Rely solely on harness `pre_script` and remove inline validation
  • ➕ Single place to run checks; no duplication between inline and harness paths
  • ➖ Loses fail-fast behavior in the GitHub workflow before expensive setup
  • ➖ Breaks once skip flags are enabled (validation might run nowhere)

Recommendation: Keep the PR’s approach: wiring GH_TOKEN and the skip flags into the existing inline validation preserves fail-fast behavior and ensures the existing-PR check still runs after the companion change makes the harness invocation skip that work. Alternatives either increase duplication/maintenance (dedicated action) or regress early failure semantics (harness-only).

Files changed (2) +2 / -0

Bug fix (1) +1 / -0
reusable-code.ymlPass GH_TOKEN into pre-code validation invocation +1/-0

Pass GH_TOKEN into pre-code validation invocation

• Adds 'GH_TOKEN' to the environment for the inline 'pre-code.sh' run. This ensures the script’s GitHub API-based existing-human-PR check actually executes in the reusable-code workflow (instead of being a silent no-op when the harness path is skipped).

.github/workflows/reusable-code.yml

Other (1) +1 / -0
reusable-fix.ymlSkip tool auto-install during pre-fix validation +1/-0

Skip tool auto-install during pre-fix validation

• Sets 'FIX_SKIP_TOOL_INSTALL=true' for the inline 'pre-fix.sh' run. This preserves fast input validation (PR number/instruction/iteration limits) without re-running the tool-install work intended only for the harness pre-script path.

.github/workflows/reusable-fix.yml

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rh-hemartin

Copy link
Copy Markdown
Member

Jobs are now inlined, you need to rebase and update reusable-dispatch.yml as well

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (2) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 54 rules

Grey Divider


Action required

1. pre-code.sh runs twice 📎 Requirement gap ☼ Reliability
Description
The reusable code workflow still runs scripts/pre-code.sh inline in Validate inputs, and then
runs fullsend run code, which executes the same script again via harness/code.yaml pre_script.
This violates the requirement to avoid double-running the pre-script and can cause duplicated side
effects and wasted CI time.
Code

.github/workflows/reusable-code.yml[R163-165]

+          GH_TOKEN: ${{ steps.app-token.outputs.token }}
          FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
        run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-code.sh"
Relevance

⭐⭐ Medium

No clear historical acceptance/rejection for removing duplicate pre-code.sh run; only related
duplicate-PR work in PR#2373.

PR-#2373

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed Validate inputs step in .github/workflows/reusable-code.yml still runs
scripts/pre-code.sh inline. Separately, action.yml shows this workflow later runs `fullsend run
code, and internal/scaffold/fullsend-repo/harness/code.yaml configures pre_script:
scripts/pre-code.sh, meaning fullsend run` will run the same script again.

Remove redundant direct pre-code.sh invocation from reusable-code workflow
.github/workflows/reusable-code.yml[156-166]
action.yml[332-337]
internal/scaffold/fullsend-repo/harness/code.yaml[38-40]

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

## Issue description
`.github/workflows/reusable-code.yml` directly invokes `scripts/pre-code.sh` in the inline `Validate inputs` step, but `fullsend run code` will also execute `scripts/pre-code.sh` because `internal/scaffold/fullsend-repo/harness/code.yaml` defines it as `pre_script`. This results in the pre-script being executed twice in a single workflow run.

## Issue Context
The Fullsend composite action runs `fullsend run <agent>` (see `action.yml`), and `fullsend run` executes `pre_script` when present (per harness config). The compliance requirement for #4718 specifically disallows redundant direct invocation from the reusable workflow.

## Fix Focus Areas
- .github/workflows/reusable-code.yml[156-166]

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


2. pre-fix.sh runs twice 📎 Requirement gap ☼ Reliability
Description
The reusable fix workflow still runs scripts/pre-fix.sh inline in Validate inputs, and then runs
fullsend run fix, which executes the same script again via harness/fix.yaml pre_script. This
violates the requirement to avoid double-running the pre-script and can cause duplicated work/side
effects.
Code

.github/workflows/reusable-fix.yml[R376-378]

+          FIX_SKIP_TOOL_INSTALL: "true"
          FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
        run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-fix.sh"
Relevance

⭐⭐ Medium

No clear historical evidence for removing duplicate pre-fix.sh run; closest related
gh-error-hardening change in PR#1565.

PR-#1565

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The modified Validate inputs step in .github/workflows/reusable-fix.yml still runs
scripts/pre-fix.sh inline. The workflow later runs the Fullsend composite action, which calls
fullsend run fix (see action.yml), and internal/scaffold/fullsend-repo/harness/fix.yaml sets
pre_script: scripts/pre-fix.sh, so the same script will be executed again.

Remove redundant direct pre-fix.sh invocation from reusable-fix workflow
.github/workflows/reusable-fix.yml[369-379]
action.yml[332-337]
internal/scaffold/fullsend-repo/harness/fix.yaml[25-27]

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

## Issue description
`.github/workflows/reusable-fix.yml` directly invokes `scripts/pre-fix.sh` in the inline `Validate inputs` step, but `fullsend run fix` will also execute `scripts/pre-fix.sh` because `internal/scaffold/fullsend-repo/harness/fix.yaml` defines it as `pre_script`. This causes double execution of the same pre-script.

## Issue Context
The Fullsend composite action runs `fullsend run <agent>` (see `action.yml`). The harness definition for `fix` includes `pre_script: scripts/pre-fix.sh`, so the pre-script will run during `fullsend run` even if it already ran earlier in the workflow.

## Fix Focus Areas
- .github/workflows/reusable-fix.yml[369-379]

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



Remediation recommended

3. Unused tool-skip flag 🐞 Bug ➹ Performance
Description
The reusable fix workflow sets FIX_SKIP_TOOL_INSTALL=true before running scripts/pre-fix.sh, but
pre-fix.sh never reads that variable and always executes the pre-commit tool auto-install section.
Since harness/fix.yaml also declares scripts/pre-fix.sh as pre_script, this can lead to redundant
tool installation and longer/flakier runs.
Code

.github/workflows/reusable-fix.yml[R373-378]

          TRIGGER_SOURCE: ${{ inputs.trigger_source }}
          FIX_ITERATION: ${{ steps.context.outputs.iteration }}
          HUMAN_INSTRUCTION: ${{ steps.context.outputs.instruction }}
+          FIX_SKIP_TOOL_INSTALL: "true"
          FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
        run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-fix.sh"
Relevance

⭐⭐ Medium

No historical evidence on unused workflow env flags like FIX_SKIP_TOOL_INSTALL; similar patterns not
previously reviewed.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow now exports FIX_SKIP_TOOL_INSTALL, but the corresponding script never references it
and always runs the tool-install block; additionally the harness config also runs the same script as
a pre_script, making redundant execution likely.

.github/workflows/reusable-fix.yml[369-379]
internal/scaffold/fullsend-repo/scripts/pre-fix.sh[13-18]
internal/scaffold/fullsend-repo/scripts/pre-fix.sh[103-166]
internal/scaffold/fullsend-repo/harness/fix.yaml[22-27]

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

### Issue description
`reusable-fix.yml` sets `FIX_SKIP_TOOL_INSTALL=true` for the inline `Validate inputs` call to `scripts/pre-fix.sh`, but `pre-fix.sh` does not check this flag and always runs the pre-commit tool auto-install block. This makes the “lightweight” validation step still perform heavy work and can duplicate work when the harness `pre_script` also runs.

### Issue Context
- The workflow explicitly exports `FIX_SKIP_TOOL_INSTALL` in the validate step.
- The shipped `pre-fix.sh` documents optional vars but not `FIX_SKIP_TOOL_INSTALL`, and contains no conditional around the auto-install section.
- The harness config also uses `scripts/pre-fix.sh` as `pre_script`, so tool installation can happen more than once per job.

### Fix Focus Areas
- internal/scaffold/fullsend-repo/scripts/pre-fix.sh[13-18]
- internal/scaffold/fullsend-repo/scripts/pre-fix.sh[103-166]
- internal/scaffold/fullsend-repo/harness/fix.yaml[22-27]

### Suggested change
- Add `FIX_SKIP_TOOL_INSTALL` to the documented optional env vars.
- Guard the auto-install section with something like:
 - if `FIX_SKIP_TOOL_INSTALL == "true"`, emit a `::notice::` and skip the entire install block (still allow the earlier validation/iteration-cap checks to run).

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


4. Silent gh failures 🐞 Bug ☼ Reliability
Description
pre-code.sh discards stderr and ignores failures from gh pr list, so even with GH_TOKEN now
provided by reusable-code.yml, API/auth/rate-limit errors can silently turn the existing-PR check
into a no-op and allow duplicate code-agent runs without any diagnostic signal.
Code

.github/workflows/reusable-code.yml[R160-165]

          REPO_FULL_NAME: ${{ inputs.source_repo }}
          GITHUB_ISSUE_URL: ${{ fromJSON(inputs.event_payload).issue.html_url }}
          COMMENT_BODY: ${{ fromJSON(inputs.event_payload).comment.body }}
+          GH_TOKEN: ${{ steps.app-token.outputs.token }}
          FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
        run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-code.sh"
Relevance

⭐⭐ Medium

Mixed history: accepted surfacing gh failures (PR#1565,#2398) but merged gh pr list
2>/dev/null||true (PR#2373).

PR-#1565
PR-#2398
PR-#2373

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow change ensures GH_TOKEN is set for pre-code.sh, but the script’s PR search still
explicitly discards stderr and ignores errors, so failure modes remain silent and indistinguishable
from “no PR exists.”

.github/workflows/reusable-code.yml[156-165]
internal/scaffold/fullsend-repo/scripts/pre-code.sh[54-62]
internal/scaffold/fullsend-repo/scripts/pre-code.sh[75-85]

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

### Issue description
`pre-code.sh` uses `gh pr list ... 2>/dev/null || true`, which suppresses both errors and exit status. If GitHub API calls fail (auth/scopes/rate limiting), the script treats the result as “no PRs found” and continues, undermining the duplicate-PR prevention the workflow now depends on.

### Issue Context
This PR wires `GH_TOKEN` into the inline `Validate inputs` step, making the existing-PR check path active. But the script still hides failures, making this logic brittle and hard to debug when the check doesn’t work.

### Fix Focus Areas
- internal/scaffold/fullsend-repo/scripts/pre-code.sh[75-85]
- internal/scaffold/fullsend-repo/scripts/pre-code.sh[122-124]

### Suggested change
- Capture `gh pr list` exit status and stderr.
- On failure, emit a `::warning::` (include a brief reason) and default to `skipped=false` (fail-open), rather than silently proceeding as if there are no PRs.
- Avoid redirecting stderr to `/dev/null` for this call (or only suppress known-noise while preserving actionable errors).

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


Grey Divider

Qodo Logo

Comment on lines +163 to 165
GH_TOKEN: ${{ steps.app-token.outputs.token }}
FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-code.sh"

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

1. pre-code.sh runs twice 📎 Requirement gap ☼ Reliability

The reusable code workflow still runs scripts/pre-code.sh inline in Validate inputs, and then
runs fullsend run code, which executes the same script again via harness/code.yaml pre_script.
This violates the requirement to avoid double-running the pre-script and can cause duplicated side
effects and wasted CI time.
Agent Prompt
## Issue description
`.github/workflows/reusable-code.yml` directly invokes `scripts/pre-code.sh` in the inline `Validate inputs` step, but `fullsend run code` will also execute `scripts/pre-code.sh` because `internal/scaffold/fullsend-repo/harness/code.yaml` defines it as `pre_script`. This results in the pre-script being executed twice in a single workflow run.

## Issue Context
The Fullsend composite action runs `fullsend run <agent>` (see `action.yml`), and `fullsend run` executes `pre_script` when present (per harness config). The compliance requirement for #4718 specifically disallows redundant direct invocation from the reusable workflow.

## Fix Focus Areas
- .github/workflows/reusable-code.yml[156-166]

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

Comment on lines +376 to 378
FIX_SKIP_TOOL_INSTALL: "true"
FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-fix.sh"

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. pre-fix.sh runs twice 📎 Requirement gap ☼ Reliability

The reusable fix workflow still runs scripts/pre-fix.sh inline in Validate inputs, and then runs
fullsend run fix, which executes the same script again via harness/fix.yaml pre_script. This
violates the requirement to avoid double-running the pre-script and can cause duplicated work/side
effects.
Agent Prompt
## Issue description
`.github/workflows/reusable-fix.yml` directly invokes `scripts/pre-fix.sh` in the inline `Validate inputs` step, but `fullsend run fix` will also execute `scripts/pre-fix.sh` because `internal/scaffold/fullsend-repo/harness/fix.yaml` defines it as `pre_script`. This causes double execution of the same pre-script.

## Issue Context
The Fullsend composite action runs `fullsend run <agent>` (see `action.yml`). The harness definition for `fix` includes `pre_script: scripts/pre-fix.sh`, so the pre-script will run during `fullsend run` even if it already ran earlier in the workflow.

## Fix Focus Areas
- .github/workflows/reusable-fix.yml[369-379]

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

Comment on lines 373 to 378
TRIGGER_SOURCE: ${{ inputs.trigger_source }}
FIX_ITERATION: ${{ steps.context.outputs.iteration }}
HUMAN_INSTRUCTION: ${{ steps.context.outputs.instruction }}
FIX_SKIP_TOOL_INSTALL: "true"
FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-fix.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

3. Unused tool-skip flag 🐞 Bug ➹ Performance

The reusable fix workflow sets FIX_SKIP_TOOL_INSTALL=true before running scripts/pre-fix.sh, but
pre-fix.sh never reads that variable and always executes the pre-commit tool auto-install section.
Since harness/fix.yaml also declares scripts/pre-fix.sh as pre_script, this can lead to redundant
tool installation and longer/flakier runs.
Agent Prompt
### Issue description
`reusable-fix.yml` sets `FIX_SKIP_TOOL_INSTALL=true` for the inline `Validate inputs` call to `scripts/pre-fix.sh`, but `pre-fix.sh` does not check this flag and always runs the pre-commit tool auto-install block. This makes the “lightweight” validation step still perform heavy work and can duplicate work when the harness `pre_script` also runs.

### Issue Context
- The workflow explicitly exports `FIX_SKIP_TOOL_INSTALL` in the validate step.
- The shipped `pre-fix.sh` documents optional vars but not `FIX_SKIP_TOOL_INSTALL`, and contains no conditional around the auto-install section.
- The harness config also uses `scripts/pre-fix.sh` as `pre_script`, so tool installation can happen more than once per job.

### Fix Focus Areas
- internal/scaffold/fullsend-repo/scripts/pre-fix.sh[13-18]
- internal/scaffold/fullsend-repo/scripts/pre-fix.sh[103-166]
- internal/scaffold/fullsend-repo/harness/fix.yaml[22-27]

### Suggested change
- Add `FIX_SKIP_TOOL_INSTALL` to the documented optional env vars.
- Guard the auto-install section with something like:
  - if `FIX_SKIP_TOOL_INSTALL == "true"`, emit a `::notice::` and skip the entire install block (still allow the earlier validation/iteration-cap checks to run).

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

Comment on lines 160 to 165
REPO_FULL_NAME: ${{ inputs.source_repo }}
GITHUB_ISSUE_URL: ${{ fromJSON(inputs.event_payload).issue.html_url }}
COMMENT_BODY: ${{ fromJSON(inputs.event_payload).comment.body }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
FULLSEND_DIR: ${{ inputs.install_mode == 'per-repo' && '.fullsend' || '' }}
run: bash "${FULLSEND_DIR:+$FULLSEND_DIR/}scripts/pre-code.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Silent gh failures 🐞 Bug ☼ Reliability

pre-code.sh discards stderr and ignores failures from gh pr list, so even with GH_TOKEN now
provided by reusable-code.yml, API/auth/rate-limit errors can silently turn the existing-PR check
into a no-op and allow duplicate code-agent runs without any diagnostic signal.
Agent Prompt
### Issue description
`pre-code.sh` uses `gh pr list ... 2>/dev/null || true`, which suppresses both errors and exit status. If GitHub API calls fail (auth/scopes/rate limiting), the script treats the result as “no PRs found” and continues, undermining the duplicate-PR prevention the workflow now depends on.

### Issue Context
This PR wires `GH_TOKEN` into the inline `Validate inputs` step, making the existing-PR check path active. But the script still hides failures, making this logic brittle and hard to debug when the check doesn’t work.

### Fix Focus Areas
- internal/scaffold/fullsend-repo/scripts/pre-code.sh[75-85]
- internal/scaffold/fullsend-repo/scripts/pre-code.sh[122-124]

### Suggested change
- Capture `gh pr list` exit status and stderr.
- On failure, emit a `::warning::` (include a brief reason) and default to `skipped=false` (fail-open), rather than silently proceeding as if there are no PRs.
- Avoid redirecting stderr to `/dev/null` for this call (or only suppress known-noise while preserving actionable errors).

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

@fullsend-ai-review

Copy link
Copy Markdown

Review — fix(#4718): wire GH_TOKEN and re-add fail-fast validation for pre-code/pre-fix

Verdict: approve

Summary

Two-line change to CI workflow files that (1) fixes a silently broken existing-PR check in the code agent workflow and (2) forward-wires a skip flag for the fix agent's tool auto-install step.

Analysis

.github/workflows/reusable-code.yml — GH_TOKEN wiring (line 163)

Correct and needed. pre-code.sh explicitly gates the existing-human-PR check on GH_TOKEN being set (line 58: if [[ -z "${GH_TOKEN:-}" ]]). Without it, the entire check — PR search, pr-open label application, skip comment — was silently bypassed with "GH_TOKEN not set — skipping existing-PR check". The steps.app-token.outputs.token (coder-role) is available at this point (minted at step 5, this step is step 7) and is consistent with the token used by subsequent steps (Checkout target repository, Resolve bot identity).

The token is used for gh pr list --repo (PR search), gh label create (label management), and gh issue comment (posting skip notices) — all operations the coder-role token supports.

.github/workflows/reusable-fix.yml — FIX_SKIP_TOOL_INSTALL (line 376)

The env var is set to "true" but the current pre-fix.sh in this repo does not read or branch on FIX_SKIP_TOOL_INSTALL — the tool auto-install section (lines 103–166) runs unconditionally. This makes the env var a no-op today. The PR explicitly documents this as a companion to fullsend-ai/agents#175 which adds script-side support for the flag. Setting an unused env var is harmless: all validation still runs, and the tool install section simply executes as it always has — the only consequence is that the inline step doesn't yet achieve the intended performance optimization of skipping the redundant tool install.

Security: The GH_TOKEN is the same coder-role minted token already used in four other steps in this workflow. Adding it to the Validate inputs step does not expand the credential exposure surface. No secrets are introduced to untrusted contexts. No workflow command injection patterns are present in the diff.

Scope & intent: The PR is tightly scoped to issue #4718 (deduplicate pre-script calls). Changes are limited to the two workflow files identified in the issue body. The companion PR relationship is clearly documented. The fix(#4718) prefix is appropriate — the existing-PR check silently failing is a user-visible bug.

Findings

Severity Category File Description
low mechanism-readiness .github/workflows/reusable-fix.yml:376 FIX_SKIP_TOOL_INSTALL=true is a no-op — pre-fix.sh does not check this env var. The tool auto-install section runs unconditionally. Harmless today; the companion PR (fullsend-ai/agents#175) is expected to add script-side support.

Protected paths detected — this PR modifies files under one or more
protected paths. The review agent cannot approve PRs that touch these paths.
A human reviewer must approve this PR.

Protected files in this PR:

  • .github/workflows/reusable-code.yml
  • .github/workflows/reusable-fix.yml

Labels: PR modifies CI workflow files for code and fix agents

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

TRIGGER_SOURCE: ${{ inputs.trigger_source }}
FIX_ITERATION: ${{ steps.context.outputs.iteration }}
HUMAN_INSTRUCTION: ${{ steps.context.outputs.instruction }}
FIX_SKIP_TOOL_INSTALL: "true"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] mechanism-readiness

FIX_SKIP_TOOL_INSTALL=true is a no-op — pre-fix.sh does not check this env var. The tool auto-install section (lines 103–166) runs unconditionally. Harmless today; the companion PR (fullsend-ai/agents#175) is expected to add script-side support.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment component/ci CI pipelines and checks labels Jul 15, 2026
waynesun09 added a commit that referenced this pull request Jul 16, 2026
Records the pattern introduced in #5013/fullsend-ai/agents#175 so the
next agent that needs to gate expensive workflow setup behind a fast
pre-check (per rh-hemartin's request for consistency across agents,
one: an {AGENT}_SKIP_{THING} env var, set on whichever of the two
pre-script call sites should skip the redundant/expensive part.

Distinguishes this from ADR 0049's agent-configuration env vars —
same {AGENT}_{SETTING} syntax, but an internal invocation-context
signal rather than a user-facing behavioral knob, so it belongs in
script/harness comments, not docs/agents/<agent>.md.

Scopes the decision to agents that actually need workflow-level
gating (code, fix today) rather than mandating it retroactively for
agents that don't currently duplicate pre-script execution.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>

@ifireball ifireball 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.

We need to decrease the differences between the reusable* workflows if we ever want to be able to port the agents to use the generic harness triggers, this is a step in the wrong direction.

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

Labels

component/ci CI pipelines and checks requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove redundant pre-code.sh / pre-fix.sh calls from reusable workflows

3 participants