Skip to content

fix(dispatch): an empty role list is honored in dispatch - #7659

Closed
rh-hemartin wants to merge 1 commit into
mainfrom
roles-gates
Closed

rh-hemartin wants to merge 1 commit into
mainfrom
roles-gates

Conversation

@rh-hemartin

Copy link
Copy Markdown
Member

Summary

Fixed a bug in which an empty list (roles: [] or roles:) of roles in .fullsend/config.yaml allowed any role to be dispatched. This contradicted the code behavior at ConfigRoles().

Now empty slice (roles: []) or empty value (roles:) prevents dispatching, while no roles key on the config.yaml dispatches everything.

Related Issue

Closes #6915

Changes

Testing

  • make lint passes (stage changes first, then run)
  • Tests added/updated for new or modified logic

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

Fixed a bug in which an empty list of roles in .fullsend/config.yaml
`roles: []` or `roles:` allowed any role to be dispatched. This
contradicted the code behavior at `ConfigRoles()`.

Now empty slice (`roles: []`) or empty value (`roles:`) prevents
dispatching, while no `roles` key on the config.yaml dispatches
everything.

Signed-off-by: Hector Martinez <hemartin@redhat.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Honor empty role lists during workflow dispatch

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Distinguishes omitted roles configuration from explicitly empty role lists during dispatch.
• Allows all stages only when the roles key is absent.
• Skips stages when configured roles are empty or exclude the stage.
Diagram

graph TD
  A["Dispatch stage"] --> B{"Config exists?"} -- No --> C["Allow dispatch"]
  B -- Yes --> D{"Roles key exists?"} -- Yes --> E["Read roles"] --> F{"Role allowed?"} -- No --> G["Skip stage"]
  D -- No --> C
  F -- Yes --> C
Loading
High-Level Assessment

The explicit key-presence check is the clearest approach because omission and an empty value have intentionally different semantics. A single consolidated yq predicate was considered but would obscure this distinction and make workflow diagnostics less informative.

Files changed (1) +11 / -1

Bug fix (1) +11 / -1
reusable-dispatch.ymlDifferentiate missing and empty role configuration +11/-1

Differentiate missing and empty role configuration

• Checks whether the roles key exists before evaluating configured roles. An omitted key preserves unrestricted dispatch, while an empty value or list is treated as an explicit deny-all configuration and produces clearer workflow notices.

.github/workflows/reusable-dispatch.yml

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:01 AM UTC · Completed 10:21 AM UTC

Commit: cd23a49 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $4.35

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Empty role lists still dispatch 🐞 Bug ≡ Correctness
Description
The role check leaves the existing [[ -n "$ROLES" ]] guard in place, so an empty result never
enters the branch that sets skipped=true. This occurs for roles: [] or roles: and allows every
routed stage to continue to agent dispatch despite the explicitly empty configuration.
Code

.github/workflows/reusable-dispatch.yml[551]

+          ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo "")
Relevance

●●● Strong

The PR explicitly fixes empty-role dispatch, matching accepted precedent for role-filtering
correctness and regression coverage.

PR-#2781

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new key-presence check proceeds to role evaluation whenever roles exists, but .roles[] emits
no role names for an empty sequence and the following non-empty guard prevents rejection. The
configuration API and its test explicitly establish that a non-nil empty role slice replaces
defaults and represents no roles.

.github/workflows/reusable-dispatch.yml[543-559]
internal/config/interfaces.go[444-455]
internal/config/defaults_test.go[433-440]

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

## Issue description
A present but empty `roles` value produces an empty `ROLES` variable, and the `-n` guard prevents the workflow from marking the stage as skipped.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[543-559]

## Recommended Fix
After confirming that the `roles` key exists, treat an empty `ROLES` result as permitting no stages. Remove the `-n "$ROLES"` prerequisite from the membership check, or add an explicit empty-result branch that writes `skipped=true` to `GITHUB_OUTPUT` and exits before dispatch.

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



Remediation recommended

2. Role gates differ across workflows 📘 Rule violation ⚙ Maintainability
Description
reusable-dispatch.yml adds a has("roles") routing branch, while the corresponding gate in
scaffold dispatch.yml still reads only .defaults.roles[] without a documented exception. Future
changes or scaffold regeneration must reconcile two different missing-versus-empty implementations
before maintainers can determine which stage-routing behavior is authoritative.
Code

.github/workflows/reusable-dispatch.yml[R543-546]

+          HAS_ROLES="$(yq '. | has("roles")' .fullsend/config.yaml 2>/dev/null)"
+          if [[ "$HAS_ROLES" = "false" ]]; then
+            echo "::notice::No roles key on config.yaml, dispatching $STAGE_ROLE..."
+            exit 0
Relevance

●●● Strong

Workflow synchronization findings are accepted when reusable and scaffold behavior diverge without
documented intent.

PR-#1688

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 1062045 requires stage-routing conditions in the reusable and scaffold dispatch
workflows to remain equivalent unless divergence is explicitly documented. The changed reusable
workflow now branches on key presence, but the scaffold workflow retains the previous list-only
check and contains no intentional-divergence comment.

Rule 1062045: Keep jq payload, stage routing, and secret threading logic in dispatch workflows in sync
.github/workflows/reusable-dispatch.yml[543-551]
internal/scaffold/fullsend-repo/.github/workflows/dispatch.yml[474-483]

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 reusable and scaffold dispatch workflows now implement role-presence routing differently, contrary to the required synchronization between these workflows.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[543-551]
- internal/scaffold/fullsend-repo/.github/workflows/dispatch.yml[474-483]

## Recommended Fix
Apply equivalent omitted-versus-empty role handling to both workflows, accounting for their respective configuration paths, or add an inline comment documenting why their routing must intentionally differ.

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


3. Users cannot verify empty-role behavior 📘 Rule violation ⚙ Maintainability
Description
docs/reference/config-reference.md describes replacement and inheritance for roles but does not
state that an explicitly empty value blocks dispatch or that an omitted key permits every role. The
new HAS_ROLES branch changes this user-facing configuration behavior, yet the PR updates neither
the required configuration reference nor a related guide.
Code

.github/workflows/reusable-dispatch.yml[R543-551]

+          HAS_ROLES="$(yq '. | has("roles")' .fullsend/config.yaml 2>/dev/null)"
+          if [[ "$HAS_ROLES" = "false" ]]; then
+            echo "::notice::No roles key on config.yaml, dispatching $STAGE_ROLE..."
+            exit 0
+          else
+            echo "::notice::config.yaml has roles, checking if $STAGE_ROLE is allowed..."
+          fi
+
+          ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo "")
Relevance

●●● Strong

Recent configuration behavior changes consistently receive documentation updates clarifying changed
semantics and precedence.

PR-#7476
PR-#7506

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rules 2748504 and 2806787 require documentation updates when configuration behavior changes, and the
repository documentation guide specifically names docs/reference/config-reference.md for
.fullsend/config.yaml fields. The implementation introduces key-presence behavior while the
existing roles reference documents only valid roles and layered replacement or inheritance.

Rule 2748504: Update docs/ references when changing user-facing behavior
Rule 2806787: Update CLI-related docs according to docs/contributing/documentation.md when changing CLI surface
.github/workflows/reusable-dispatch.yml[543-551]
docs/contributing/documentation.md[25-33]
docs/reference/config-reference.md[144-153]

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 dispatch behavior of omitted and explicitly empty `roles` configuration is user-facing, but the canonical configuration reference does not describe the distinction introduced by this change.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[543-551]
- docs/reference/config-reference.md[144-153]
- docs/guides/infrastructure/layered-config-reference.md[279-283]

## Recommended Fix
Update the configuration reference to state the purpose, valid values, omission default, and dispatch effect of `roles: []` and `roles:`. Reconcile the layered-config guide so its examples clearly distinguish configuration inheritance from final dispatch authorization.

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


4. Workflow change omits required review 📘 Rule violation § Compliance
Description
reusable-dispatch.yml changes inline dispatch routing without an inline comment or PR-description
statement that docs/contributing/ci-workflows.md was consulted. The missing review evidence
applies to the newly introduced configuration-dependent branch in this GitHub Actions workflow.
Code

.github/workflows/reusable-dispatch.yml[R543-549]

+          HAS_ROLES="$(yq '. | has("roles")' .fullsend/config.yaml 2>/dev/null)"
+          if [[ "$HAS_ROLES" = "false" ]]; then
+            echo "::notice::No roles key on config.yaml, dispatching $STAGE_ROLE..."
+            exit 0
+          else
+            echo "::notice::config.yaml has roles, checking if $STAGE_ROLE is allowed..."
+          fi
Relevance

●● Moderate

The rule is explicit, but historical workflow-governance evidence findings are often rejected as
process-only concerns.

PR-#1063
PR-#1688

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 3201588 requires explicit evidence that the CI workflow guide was consulted for
qualifying GitHub Actions workflow changes. The diff adds routing logic to a workflow, while the
supplied PR description and changed lines contain no such reference.

Rule 3201588: Consult CI workflow guide when modifying GitHub Actions workflows or secrets
.github/workflows/reusable-dispatch.yml[543-549]
docs/contributing/ci-workflows.md[1-3]

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 GitHub Actions workflow was modified without the required evidence that the repository's CI workflow guide was consulted.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[543-549]

## Recommended Fix
Review `docs/contributing/ci-workflows.md`, verify the routing change follows its workflow conventions, and record that consultation in the PR description or an appropriate inline comment.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 72 rules
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/experiments (sha: 3f1614fa)
  Explored: repo: fullsend-ai/.fullsend (sha: 7c163cad)
  Explored: repo: fullsend-ai/pi-xai-vertex (sha: 8f50bdda)
  Explored: repo: fullsend-ai/pi-anthropic-vertex (sha: 477b3546)
  Explored: repo: fullsend-ai/scribe (sha: 0f3eb528)
  Explored: repo: fullsend-ai/mlflow-assessments (sha: 6815e0e9)
  Explored: repo: fullsend-ai/metrics (sha: 98fd2466)
  Explored: repo: fullsend-ai/agents (sha: 9665f9ff)
Review mode: ⚖️ Balanced: This changes runtime CI dispatch authorization semantics, including YAML parsing and shell control flow, so a careful review is warranted despite the localized diff.

Grey Divider

Tip of the day
💡 Did you know, you can choose which labels appear on a finding, and whether they show icons or text

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread .github/workflows/reusable-dispatch.yml Resolved
Comment on lines +543 to +551
HAS_ROLES="$(yq '. | has("roles")' .fullsend/config.yaml 2>/dev/null)"
if [[ "$HAS_ROLES" = "false" ]]; then
echo "::notice::No roles key on config.yaml, dispatching $STAGE_ROLE..."
exit 0
else
echo "::notice::config.yaml has roles, checking if $STAGE_ROLE is allowed..."
fi

ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo "")

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. Users cannot verify empty-role behavior 📘 Rule violation ⚙ Maintainability

docs/reference/config-reference.md describes replacement and inheritance for roles but does not
state that an explicitly empty value blocks dispatch or that an omitted key permits every role. The
new HAS_ROLES branch changes this user-facing configuration behavior, yet the PR updates neither
the required configuration reference nor a related guide.
Agent Prompt
## Issue description
The dispatch behavior of omitted and explicitly empty `roles` configuration is user-facing, but the canonical configuration reference does not describe the distinction introduced by this change.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[543-551]
- docs/reference/config-reference.md[144-153]
- docs/guides/infrastructure/layered-config-reference.md[279-283]

## Recommended Fix
Update the configuration reference to state the purpose, valid values, omission default, and dispatch effect of `roles: []` and `roles:`. Reconcile the layered-config guide so its examples clearly distinguish configuration inheritance from final dispatch authorization.

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

Comment thread .github/workflows/reusable-dispatch.yml Resolved
Comment thread .github/workflows/reusable-dispatch.yml Resolved
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullsend-ai-review fullsend-ai-review Bot added the risk/elevated PR risk: elevated label Sep 24, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: elevated (3/5)

Details

Elevated risk: small diff but modifies a protected-path CI dispatch permission gate with zero test coverage, and review found the fix likely does not close the gate for all input shapes it claims to handle.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [logic-error] .github/workflows/reusable-dispatch.yml:552 — After the new has("roles") check correctly lets an absent roles key dispatch everything, the membership test is still [[ -n "$ROLES" ]] && ! echo "$ROLES" | grep -Fqx "$STAGE_ROLE", with ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo ""). That retained -n conjunct is the original fail-open pattern (issue roles: [] does not disable an agent — empty role list behaves identically to unset roles #6915 / the fix(review): submit formal PR review with empty body to avoid duplicate notifications #653→docs: ADR 0029 — central token mint for secretless .fullsend #655 production incident): any code path that leaves $ROLES empty skips the deny branch and dispatch proceeds. yq could not be executed in this review's sandbox (no network access), so this is reasoned from documented jq/yq splat-and-alternative-operator (//) semantics rather than confirmed by execution. Two shapes the PR explicitly claims to fix are affected: (1) roles: (YAML null) — .roles[] on a null node is expected to error before // [] can apply; the error is discarded by 2>/dev/null and || echo "" yields ROLES="", so [[ -n "$ROLES" ]] is false and dispatch proceeds — contradicting the PR body's claim that an empty value (roles:) prevents dispatching. (2) roles: [] (explicit empty array) — unverified either way: if yq's // fires on a zero-output splat the way jq's does, it emits the literal [] and the skip path fires correctly (by accident, since [] won't match a real role); if yq applies // per-node instead, the empty splat produces no output at all, ROLES="", and the array case fail-opens too. Do not treat the empty-array case as confirmed fixed.
    Remediation: Once has("roles") is true, fail closed on an empty or unparseable role list instead of falling through. Drop the // [] sentinel and the [[ -n "$ROLES" ]] && conjunct, e.g.: ROLES=$(yq '.roles[]' .fullsend/config.yaml 2>/dev/null) || { echo "::error::Failed to parse roles from config.yaml — refusing dispatch"; exit 1; } then if ! echo "$ROLES" | grep -Fqx "$STAGE_ROLE"; then (retain the fullsend/retro/prioritize compat branch). This makes roles: [] and roles: (null) both produce an empty $ROLES that fails the grep and skips dispatch, and makes a yq parse failure fail closed. Add fixtures asserting all three shapes (absent / [] / null) plus a populated list before merging — this is a permission gate and the exact class of bug that caused the fix(review): submit formal PR review with empty body to avoid duplicate notifications #653→docs: ADR 0029 — central token mint for secretless .fullsend #655 incident.

Medium

  • [fail-open] internal/scaffold/fullsend-repo/.github/workflows/dispatch.yml:482 — Issue roles: [] does not disable an agent — empty role list behaves identically to unset roles #6915 explicitly names this exact fail-open bug in two files: .github/workflows/reusable-dispatch.yml (fixed by this PR) and internal/scaffold/fullsend-repo/.github/workflows/dispatch.yml (per-org mode scaffold, not touched by this PR). Confirmed in the current tree at lines 482-483: ROLES=$(yq '.defaults.roles[]' config.yaml 2>/dev/null || echo "") followed by if [[ -n "$ROLES" ]] && ! echo "$ROLES" | grep -Fqx "$STAGE_ROLE", with no has("defaults.roles") check — so defaults.roles: [] still behaves identically to an absent key and dispatches every stage, including privileged review/coder/fix roles. Per-org installation mode is deprecated (AGENTS.md, ADR 0044) and this repo's contributor guidance says not to extend org-mode-specific content, but the scaffold file is still shipped and live for existing per-org installs, and the issue this PR closes explicitly named it as part of the bug's scope. This is a residual live instance of a confirmed fail-open, not a regression introduced by this PR.
    Remediation: Either apply the equivalent has("defaults.roles")-based fail-closed fix to this scaffold file (in this PR or a fast-follow), or explicitly record in the issue/PR that the per-org half of roles: [] does not disable an agent — empty role list behaves identically to unset roles #6915 is intentionally left unfixed pending ADR 0044's removal of per-org mode, so the residual exposure is a documented decision rather than an oversight.

  • [missing-test] .github/workflows/reusable-dispatch.yml:551 — This is a security-relevant CI dispatch permission gate whose correct behavior now depends on subtle yq/YAML-shape distinctions (key absent vs roles: [] vs roles: null vs a non-empty list). The PR's own "Testing" checklist leaves "Tests added/updated for new or modified logic" unchecked, and there is no existing test harness in the repo exercising this bash-in-workflow logic (the Go-level ConfigRoles() unit test — "empty slice replaces parent (no roles)" in internal/config/defaults_test.go — covers only the Go config layer, not this bash/yq gate). Issue roles: [] does not disable an agent — empty role list behaves identically to unset roles #6915's triage comment explicitly requested fixtures asserting: all stages skip when roles is explicitly empty, dispatch proceeds when the key is unset, and dispatch restricts to the listed role otherwise — checked against both workflow files. Without such tests, the fail-open regression identified above (the roles: null case) would not have been caught.
    Remediation: Add fixtures/assertions covering roles absent / roles: [] / roles: (null) / roles: ["coder"], ideally by extracting the bash gating logic into a small testable script or a fullsend CLI subcommand backed by the already-tested ConfigRoles(), rather than leaving it as untested inline YAML bash.

  • [protected-path] .github/workflows/reusable-dispatch.yml — This PR modifies .github/workflows/reusable-dispatch.yml, which falls under the repository's protected paths (.github/). Human approval is always required for protected-path changes, regardless of context. The PR links a specific issue (roles: [] does not disable an agent — empty role list behaves identically to unset roles #6915) and its description explains the rationale for the change (fixing a fail-open role-gating bug), which provides sufficient context for this modification — but protected-path changes still require explicit human sign-off before merge.

Low

  • [design-coherence] .github/workflows/reusable-dispatch.yml:543 — Issue roles: [] does not disable an agent — empty role list behaves identically to unset roles #6915's triage comment noted that internal/config/interfaces.go's ConfigRoles() already implements the correct nil-vs-empty-list distinction with unit test coverage, and that the bash/yq dispatch gate reimplementing similar logic separately is "likely how the two implementations diverged" in the first place. This PR adds another separate yq-based reimplementation (has("roles") + .roles[] // []) rather than consolidating on the existing tested Go logic. This preserves the semantic-drift risk the triage comment warned about, though it is not a blocking concern for this fix.
    Remediation: Consider a fast-follow that routes the dispatch gate through the already-tested ConfigRoles() Go logic (e.g. a small fullsend config check-role subcommand), so the bash gate and Go config semantics cannot diverge again.

  • [workflow-conventions] .github/workflows/reusable-dispatch.yml:548 — The new else branch emits an intermediate progress ::notice:: ("config.yaml has roles, checking if $STAGE_ROLE is allowed...") that only records an in-progress state, unlike the other ::notice:: annotations in this file, which record terminal decisions (dispatch allowed/skipped) or fallback paths. This adds a UI annotation to every run where .fullsend/config.yaml has a roles key, which is more verbose than the surrounding convention.
    Remediation: Replace the intermediate ::notice:: with a plain echo (or drop it) if progress logging is desired, reserving ::notice:: for terminal decisions as elsewhere in this file.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

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

fi

ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo "")
if [[ -n "$ROLES" ]] && ! echo "$ROLES" | grep -Fqx "$STAGE_ROLE"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[high] logic-error

After the new has("roles") check correctly lets an absent roles key dispatch everything, the membership test is still [[ -n "$ROLES" ]] && ! echo "$ROLES" | grep -Fqx "$STAGE_ROLE", with ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo ""). That retained -n conjunct is the original fail-open pattern (issue #6915 / the #653→#655 production incident): any code path that leaves $ROLES empty skips the deny branch and dispatch proceeds. yq could not be executed in this review's sandbox (no network access), so this is reasoned from documented jq/yq splat-and-alternative-operator (//) semantics rather than confirmed by execution. Two shapes the PR explicitly claims to fix are affected: (1) roles: (YAML null) — .roles[] on a null node is expected to error before // [] can apply; the error is discarded by 2>/dev/null and || echo "" yields ROLES="", so [[ -n "$ROLES" ]] is false and dispatch proceeds — contradicting the PR body's claim that an empty value (roles:) prevents dispatching. (2) roles: [] (explicit empty array) — unverified either way: if yq's // fires on a zero-output splat the way jq's does, it emits the literal [] and the skip path fires correctly (by accident, since [] won't match a real role); if yq applies // per-node instead, the empty splat produces no output at all, ROLES="", and the array case fail-opens too. Do not treat the empty-array case as confirmed fixed.

Suggested fix: Once has("roles") is true, fail closed on an empty or unparseable role list instead of falling through. Drop the // [] sentinel and the [[ -n "$ROLES" ]] && conjunct, e.g.: ROLES=$(yq '.roles[]' .fullsend/config.yaml 2>/dev/null) || { echo "::error::Failed to parse roles from config.yaml — refusing dispatch"; exit 1; } then if ! echo "$ROLES" | grep -Fqx "$STAGE_ROLE"; then (retain the fullsend/retro/prioritize compat branch). This makes roles: [] and roles: (null) both produce an empty $ROLES that fails the grep and skips dispatch, and makes a yq parse failure fail closed. Add fixtures asserting all three shapes (absent / [] / null) plus a populated list before merging — this is a permission gate and the exact class of bug that caused the #653→#655 incident.

echo "::notice::config.yaml has roles, checking if $STAGE_ROLE is allowed..."
fi

ROLES=$(yq '.roles[] // []' .fullsend/config.yaml 2>/dev/null || echo "")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] missing-test

This is a security-relevant CI dispatch permission gate whose correct behavior now depends on subtle yq/YAML-shape distinctions (key absent vs roles: [] vs roles: null vs a non-empty list). The PR's own "Testing" checklist leaves "Tests added/updated for new or modified logic" unchecked, and there is no existing test harness in the repo exercising this bash-in-workflow logic (the Go-level ConfigRoles() unit test — "empty slice replaces parent (no roles)" in internal/config/defaults_test.go — covers only the Go config layer, not this bash/yq gate). Issue #6915's triage comment explicitly requested fixtures asserting: all stages skip when roles is explicitly empty, dispatch proceeds when the key is unset, and dispatch restricts to the listed role otherwise — checked against both workflow files. Without such tests, the fail-open regression identified above (the roles: null case) would not have been caught.

Suggested fix: Add fixtures/assertions covering roles absent / roles: [] / roles: (null) / roles: ["coder"], ideally by extracting the bash gating logic into a small testable script or a fullsend CLI subcommand backed by the already-tested ConfigRoles(), rather than leaving it as untested inline YAML bash.

esac
ROLES=$(yq '.roles[]' .fullsend/config.yaml 2>/dev/null || echo "")

HAS_ROLES="$(yq '. | has("roles")' .fullsend/config.yaml 2>/dev/null)"

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] design-coherence

Issue #6915's triage comment noted that internal/config/interfaces.go's ConfigRoles() already implements the correct nil-vs-empty-list distinction with unit test coverage, and that the bash/yq dispatch gate reimplementing similar logic separately is "likely how the two implementations diverged" in the first place. This PR adds another separate yq-based reimplementation (has("roles") + .roles[] // []) rather than consolidating on the existing tested Go logic. This preserves the semantic-drift risk the triage comment warned about, though it is not a blocking concern for this fix.

Suggested fix: Consider a fast-follow that routes the dispatch gate through the already-tested ConfigRoles() Go logic (e.g. a small fullsend config check-role subcommand), so the bash gate and Go config semantics cannot diverge again.

echo "::notice::No roles key on config.yaml, dispatching $STAGE_ROLE..."
exit 0
else
echo "::notice::config.yaml has roles, checking if $STAGE_ROLE is allowed..."

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] workflow-conventions

The new else branch emits an intermediate progress ::notice:: ("config.yaml has roles, checking if $STAGE_ROLE is allowed...") that only records an in-progress state, unlike the other ::notice:: annotations in this file, which record terminal decisions (dispatch allowed/skipped) or fallback paths. This adds a UI annotation to every run where .fullsend/config.yaml has a roles key, which is more verbose than the surrounding convention.

Suggested fix: Replace the intermediate ::notice:: with a plain echo (or drop it) if progress logging is desired, reserving ::notice:: for terminal decisions as elsewhere in this file.

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

One finding from a review sweep, posted inline.

esac
ROLES=$(yq '.roles[]' .fullsend/config.yaml 2>/dev/null || echo "")

HAS_ROLES="$(yq '. | has("roles")' .fullsend/config.yaml 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] roles: (null) blocks all dispatch in the workflow but inherits the parent roles in Go's ConfigRoles()

I ran this gate with yq v4.47.2:

config has("roles") .roles[] // [] result
key absent false n/a dispatches
roles: (null) true [] (literal string) every stage skipped=true
roles: [] true [] (literal string) every stage skipped=true
roles: [coder] true coder only coder dispatches

So roles: and roles: [] both fail closed here. The -n "$ROLES" guard is true because $ROLES holds the literal [], and grep then misses the stage role.

On the Go side, the per-repo config declares Roles *[]string yaml:"roles,omitempty" (internal/config/config.go) and decodes it with gopkg.in/yaml.v3. yaml.v3 decodes a YAML null into a nil pointer. ConfigRoles() (internal/config/interfaces.go) then takes the "nil (key omitted) falls through to parent" branch. For the same roles: input, the workflow blocks every stage and Go inherits the parent role list. That contradicts the PR description's claim that this change aligns the workflow with ConfigRoles().

Suggestion: Choose one meaning for roles: (null) and use it in both places:

  1. Make the gate match Go by treating null as omitted. For example, dispatch everything when yq '.roles | type' is !!null.
  2. Or change the Go decoding so a key that is present but null becomes a non-nil empty slice. Document that in docs/reference/config-reference.md.

Either way, update the PR description to state which semantic roles: has.

@rh-hemartin

Copy link
Copy Markdown
Member Author

Deprecated in favor or removing the step completely after talking with the team.

@rh-hemartin
rh-hemartin deleted the roles-gates branch September 28, 2026 07:15
@fullsend-ai-retro

fullsend-ai-retro Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 7:17 AM UTC · Completed 7:27 AM UTC

Commit: cd23a49 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $1.97

@fullsend-ai-retro

Copy link
Copy Markdown

PR #7659 (fullsend-ai/fullsend) was a human-authored fix for issue #6915 (roles: [] fails open in dispatch gating). It was closed unmerged on 2026-09-28 after a design disagreement, not a CI failure — all checks were green throughout. No code/fix agent stage ever ran; triage correctly routed this to a human because the fix touches a protected .github/workflows/ path, but the triage bot's phrasing ('the code agent cannot modify workflow files under current permissions') repeats an inaccuracy already tracked in open issue fullsend-ai/agents#1252, which argues the real constraint is a merge-time human-review gate, not a modification incapability — this PR is a fresh, near-verbatim instance of that exact pattern (same appended /fs-code contradiction). The fullsend review agent posted a CHANGES_REQUESTED review with a high-severity claim that a retained bash guard still lets roles: (null) fail open; it explicitly caveated that it could not execute yq in its sandbox and reasoned from jq/yq semantics analogy instead. Human reviewer waynesun09 then ran real yq v4.47.2 locally and empirically showed both roles: and roles: [] actually fail closed at the bash layer — the bot's specific claim was wrong — but in doing so surfaced a real, different bug: Go's ConfigRoles() treats a null roles: key as 'inherit parent' while the (proposed) workflow gate treats the same input as 'block everything,' an undocumented cross-layer contradiction. The yq-unavailability root cause is already tracked and unresolved in open issue fullsend-ai/agents#403 ('yq missing from sandbox image causes wrong claims'), and the general 'verify empirically or downgrade confidence' fix is already proposed in open fullsend-ai/agents#1480 — this PR is corroborating evidence for both, not a new proposal. A third-party bot (qodo-code-review, not a fullsend agent) also posted a flatly wrong high-severity finding with no verification caveat, rebutted by the author; out of scope for a fullsend-layer proposal. The one genuinely new, non-duplicate gap found is that the null-vs-empty-vs-absent semantics for tri-state per-repo config fields (like roles) have never been written down anywhere, which is the third bug in this exact family (#5660, #6915, and this PR's reviewer disagreement) and will likely recur in the team's planned replacement design (agents: [{name, enabled}]) unless documented once, generically — that is proposed below. Note for context only (not a formal proposal, since it's a human/product decision outside agent-workflow scope): issue #6915 was priority/high and was closed together with the PR without a merged fix, based on the author's stated intent to redesign the gating mechanism after talking with the team.

Proposals filed

This branch was previously deployed

1 inactive deployment
dev — cd23a499 Deployed Sep 24, 2026 by rh-hemartin via behaviour #13866
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/elevated PR risk: elevated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roles: [] does not disable an agent — empty role list behaves identically to unset roles

2 participants