Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions .github/workflows/reusable-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' }}
sparse-checkout: |
.fullsend/config.yaml
.fullsend/config.base.yaml
/OWNERS
/OWNERS_ALIASES
sparse-checkout-cone-mode: false
Expand Down Expand Up @@ -496,14 +497,45 @@ jobs:
if: steps.route.outputs.stage != ''
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
run: |
set -euo pipefail
# Mirrors internal/config's IsKillSwitchActive(): if
# config.yaml sets kill_switch at all, that value is final
# and config.base.yaml is ignored; config.base.yaml is only
# consulted when config.yaml is silent on the key.
# -o=json normalizes every YAML null spelling (bare key, ~,
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
# Null, NULL) to the literal "null", and the true/false
# case variants (True, FALSE, ...) to lowercase. It does not
# normalize the YAML 1.1 word booleans yq treats as plain
# strings (yes/no/on/off print as quoted JSON strings, e.g.
# "yes"), so yes is matched explicitly below, where
# go-yaml's lenient *bool decoding also treats it as active.
# on/off and the single-letter y/n forms are deliberately
# not matched. -o=json also keeps surrounding quotes on any
# scalar that was itself quoted in the source YAML (e.g.
# kill_switch: "true" prints as the JSON string "true", not
# the JSON boolean true), so those quotes are stripped below
# before comparing, matching go-yaml's lenient *bool
# decoding of a quoted "true"/"yes" scalar.
KILL_SWITCH="false"
OVERLAY_KS="null"
if [[ -f .fullsend/config.yaml ]]; then
KILL_SWITCH=$(yq '.kill_switch // false' .fullsend/config.yaml)
if [[ "$KILL_SWITCH" == "true" ]]; then
echo "::error::Kill switch is active — all agent dispatch halted"
echo "::error::Set kill_switch: false in .fullsend/config.yaml to resume"
exit 1
OVERLAY_KS=$(yq -o=json '.kill_switch' .fullsend/config.yaml)
fi
if [[ "$OVERLAY_KS" != "null" ]]; then
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
KILL_SWITCH="$OVERLAY_KS"
elif [[ -f .fullsend/config.base.yaml ]]; then
BASE_KS=$(yq -o=json '.kill_switch' .fullsend/config.base.yaml)
if [[ "$BASE_KS" != "null" ]]; then
KILL_SWITCH="$BASE_KS"
fi
fi
KILL_SWITCH="${KILL_SWITCH,,}"
KILL_SWITCH="${KILL_SWITCH#\"}"
KILL_SWITCH="${KILL_SWITCH%\"}"
if [[ "$KILL_SWITCH" == "true" || "$KILL_SWITCH" == "yes" ]]; then
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
echo "::error::Kill switch is active — all agent dispatch halted"
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
echo "::error::Set kill_switch: false in .fullsend/config.yaml or .fullsend/config.base.yaml to resume"
exit 1
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved
fi

- name: Validate agents config
if: steps.route.outputs.stage != ''
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/config-source-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ These fields live on `perRepoConfig` in `internal/config/config.go`. Unset means
| `status_notifications` | Start and completion comments and reactions | Overlay, base, compiled unset | Whole object replaces the parent when set | Status posting | Already layered | Yes, when a fleet wants one notification policy. |
| `models.aliases` | Remap of `opus`, `sonnet`, `haiku`, `fable` | Overlay, base, compiled alias table | Per-key merge, then the compiled table | Model resolution | Already layered | Yes. Fleet model pins belong here. |
| `inference.provider` | Inference backend id | Overlay, base, compiled `vertex` | Overlay, then base, then `vertex`. No workflow variable found | Accessor at install and run setup | Already layered | Yes. |
| `kill_switch` | Stop all agent dispatch | Overlay, base, compiled `false` | Overlay, then base, then `false`. Both direct reads — GitHub's "Check kill switch" bash step and GitLab's `run-agent-job.sh` — now consult `config.base.yaml` when `config.yaml` is silent on the key, matching the Go accessor | `internal/harnessdispatch`, `reusable-dispatch.yml`, and GitLab's `run-agent-job.sh` | Already layered | Yes. A central stop belongs in the base file. |

`authorization` (extra permission sources, today `owners_file`) is
overlay-only by design, not an accessor gap: a base-file value under this
Expand All @@ -97,7 +98,6 @@ The Go accessor layers these. The bash steps in `.github/workflows/reusable-disp

| Setting | Controls | Set from | Wins today | Read by | Decision | Base file? |
|---|---|---|---|---|---|---|
| `kill_switch` | Stop all agent dispatch | Overlay, base, compiled `false` | Go accessor: overlay, then base, then `false`. Bash "Check kill switch": `yq '.kill_switch'` on `config.yaml` only. A missing file does not halt dispatch | `internal/harnessdispatch` and `reusable-dispatch.yml` | Layer the direct read so a base-file `true` halts dispatch | Yes. A central stop belongs in the base file. |
| `roles` | Which agent roles are enabled | Overlay, base, compiled default role list | Go accessor: replace-if-set, so an explicit empty `roles: []` denies every role. Bash "Check role is enabled": `yq '.roles[]'` on `config.yaml` only, piped through `\|\| echo ""`. An omitted key, a missing file, an explicit `roles: []`, or any `yq` error all leave `$ROLES` empty, and the script only skips the stage when `$ROLES` is non-empty — so all four cases fail open and let the stage run, the opposite of the Go accessor's deny-all | Go accessor and `reusable-dispatch.yml` | Layer the direct read, and make the bash script fail closed on an explicit empty list, not just add the base file | Yes, for the shared role set. An overlay list replaces it. |
| `agents` | Registered agents and per-agent `runtime`, `model`, `effort`, `subagents` | Overlay, base, compiled none | Go accessor: keyed merge by agent name. Bash validates the shape of `config.yaml` only | Go run path and `reusable-dispatch.yml` | Layer the direct read for enablement and role checks. Per-agent runtime, model, and effort still lose to flags and environment variables; those rows are below | Yes, for the shared agent baseline. |

Expand Down
6 changes: 4 additions & 2 deletions docs/guides/dev/behaviour-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ The `fork-dispatch.feature` file defines the canonical fork-PR behaviour contrac
| CEL `is_fork` exclusion (`!event.state.change_proposal.is_fork`) | Empty matrix, exit 0 | Harness with `is_fork` guard in positive scenario; assert agent did not run |
| Fork PR matches CEL `trigger` on `pull_request_target`; unauthorized actor ([ADR 0054](../../ADRs/0054-require-authorization-on-all-agent-dispatch-paths.md)) | Empty matrix, exit 0 — no agent run | `platform/trigger-auth.feature`. The outsider opens a PR from its own fork; assert the harness dispatch completed with an empty matrix, the agent did not run, and it was dispatched exactly 0 times, then a label as the positive control |

**Kill switch vs disabled harness:** These are distinct mechanisms. The **kill switch** (`kill_switch: true` in `config.yaml`) is a global emergency stop that blocks *all* harness dispatch for the repo — tested in its own scenario because no positive harness can run alongside it. A **disabled harness** (`enabled: false` per agent entry) only prevents that single agent from running — tested as a piggyback negative assertion in the positive-path scenario.
**Kill switch vs disabled harness:** These are distinct mechanisms. The **kill switch** (`kill_switch: true`, settable in either `config.yaml` or `config.base.yaml`) is a global emergency stop that blocks *all* harness dispatch for the repo — tested in its own scenario because no positive harness can run alongside it. A **disabled harness** (`enabled: false` per agent entry) only prevents that single agent from running — tested as a piggyback negative assertion in the positive-path scenario.

**Consolidation pattern:** To conserve parallel execution slots, add negative-path harnesses (disabled agent, CEL exclusion) alongside the positive-path harness in a single scenario rather than creating separate scenarios. The positive harness wait acts as the settle window for negative assertions (piggyback pattern — see `negativeSettleDuration` in `dispatch.go`). The kill switch scenario cannot be consolidated because it blocks all harnesses.

Expand All @@ -424,7 +424,9 @@ The `fork-dispatch.feature` file defines the canonical fork-PR behaviour contrac

**`the harness dispatch completes with an empty matrix`** — Waits for the harness workflow run(s) created since the last trigger step, then requires every run that was not cancelled to have completed with its `Harness dispatch` job succeeded and no `Harness run (<agent>)` job scheduled. It fails if the dispatch job failed or an agent was scheduled, and keeps waiting while no run exists yet or a run is still in progress, so a denial is never inferred from a missing or failed run. Pair it with `agent did not run` and `dispatched exactly 0 times` for denial scenarios. It needs a CI driver that implements the optional `ci.EmptyMatrixWaiter`; the GitHub Actions driver does.

**`the kill switch is active`** — Sets `kill_switch: true` in the repo's `config.yaml`, causing `Dispatch` to return an empty matrix for *all* agents. Use this step in a dedicated scenario where no harness should run. Because the kill switch blocks everything, it cannot share a scenario with a positive-path harness.
**`the kill switch is active`** — Sets `kill_switch: true` in the repo's `config.yaml` (the overlay), causing `Dispatch` to return an empty matrix for *all* agents. Use this step in a dedicated scenario where no harness should run. Because the kill switch blocks everything, it cannot share a scenario with a positive-path harness.

**`the kill switch is active in config.base.yaml`** — Sets `kill_switch: true` in `config.base.yaml` (the central/base layer) instead, leaving `config.yaml` unset. Use this step to verify that a base-file kill switch halts dispatch the same way an overlay one does, since the two files are read independently.

## Forge operational constraints

Expand Down
19 changes: 19 additions & 0 deletions e2e/behaviour/features/dispatch/fork-dispatch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@ Feature: Fork PR dispatch
And the fork pull request is labeled "ready-for-fork-killswitch"
Then the harness "fork-pr-killswitch" agent did not run

Scenario: Fork PR kill switch in config.base.yaml blocks all harnesses
Given a custom harness "fork-pr-killswitch-base" with:
"""
agent: agents/triage.md
role: triage
slug: fullsend-ai-fork-pr-killswitch-base
model: opus
image: ghcr.io/fullsend-ai/fullsend-sandbox:latest
policy: policies/base.yaml
trigger: |
event.entity.kind == "change_proposal"
&& event.transition.kind == "label_changed"
&& event.transition.label.name == "ready-for-fork-killswitch-base"
"""
And the kill switch is active in config.base.yaml
When a fork pull request is opened
And the fork pull request is labeled "ready-for-fork-killswitch-base"
Then the harness "fork-pr-killswitch-base" agent did not run
Comment thread
mfrancisc marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved

Scenario: Fork PR sync + label dispatches harness
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Given a custom harness "fork-pr-sync" with:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,41 @@ if ! git fetch origin "${FULLSEND_PINNED_REF}" --depth=1; then
fi
DEFAULT_BRANCH_SHA=$(git rev-parse FETCH_HEAD)
CONFIG_YAML=$(git show "${DEFAULT_BRANCH_SHA}:.fullsend/config.yaml" 2>/dev/null || echo "")

# Kill switch — halt all agent dispatch when active
if [ -n "${CONFIG_YAML}" ]; then
if ! KILL_SWITCH=$(echo "${CONFIG_YAML}" | python3 -c "import sys,yaml; print('true' if str((yaml.safe_load(sys.stdin) or {}).get('kill_switch', False)).lower() in ('true','yes','1','on') else 'false')"); then
echo "WARNING: invalid .fullsend/config.yaml — treating as unconfigured (no kill-switch)"
CONFIG_BASE_YAML=$(git show "${DEFAULT_BRANCH_SHA}:.fullsend/config.base.yaml" 2>/dev/null || echo "")

# Kill switch — halt all agent dispatch when active. Mirrors
# internal/config's IsKillSwitchActive(): if config.yaml sets
# kill_switch at all, that value is final and config.base.yaml is
# ignored; config.base.yaml is only consulted when config.yaml is
# silent on the key.
if [ -n "${CONFIG_YAML}" ] || [ -n "${CONFIG_BASE_YAML}" ]; then
if ! KILL_SWITCH=$(OVERLAY_YAML="${CONFIG_YAML}" BASE_YAML="${CONFIG_BASE_YAML}" python3 -c "
import os, sys, yaml
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved

def load(text):
return (yaml.safe_load(text) or {}) if text else {}

# Resolve the overlay first, and only parse the base file when the
# overlay is silent on kill_switch. This keeps a malformed base.yaml
# from ever being able to suppress an explicit overlay value (it is
# never parsed in that case), and treats overlay 'kill_switch: null'
# (or a bare 'kill_switch:') the same as a fully omitted key — both
# decode to None, matching Go's *bool nil-falls-through-to-parent
# semantics — rather than as an explicit false that shadows the base.
overlay = load(os.environ.get('OVERLAY_YAML', ''))
active = overlay.get('kill_switch')
if active is None:
base = load(os.environ.get('BASE_YAML', ''))
active = base.get('kill_switch')

print('true' if str(active).lower() in ('true', 'yes', '1', 'on') else 'false')
"); then
echo "WARNING: invalid .fullsend/config.yaml or .fullsend/config.base.yaml — treating as unconfigured (no kill-switch)"
KILL_SWITCH="false"
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
fi
if [ "${KILL_SWITCH}" = "true" ]; then
echo "ERROR: Kill switch is active — all agent dispatch halted" >&2
echo "Set kill_switch: false in .fullsend/config.yaml to resume" >&2
echo "Set kill_switch: false in .fullsend/config.yaml or .fullsend/config.base.yaml to resume" >&2
exit 1
fi
fi
Expand Down
Loading
Loading