Repository navigation
feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go - #1275
Conversation
…the fleet-monitor workflow behind a human go/no-go
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an opt-in ChangesFleet stub-drift remediation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Maintainer
participant FleetMonitor as actions-fleet-monitor.yml
participant Gate as fleet_remediate_gate.sh
participant Remediator as fleet_stub_remediate.sh
Maintainer->>FleetMonitor: dispatch with remediate=dry-run or live
FleetMonitor->>Gate: evaluate event and live prerequisites
Gate-->>FleetMonitor: return DRY_RUN=true or false
FleetMonitor->>Remediator: pass fleet_stub_drift.json and remediation settings
Remediator-->>FleetMonitor: complete without blocking the monitor
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
There was a problem hiding this comment.
Code Review
This pull request introduces the Fleet stub-drift remediation loop, adding documentation in AGENTS.md, a gate script in scripts/fleet_remediate_gate.sh to control dry-run vs. live execution, and comprehensive BATS tests in tests/fleet_remediate_gate.bats. The reviewer provided constructive feedback suggesting a simplification of the source-guard check in the gate script to avoid redundant fallbacks, and a more robust assertion in the test suite by checking the entire output variable instead of a specific line index.
There was a problem hiding this comment.
Pull request overview
Implements issue #1152 (Phase 4) by wiring the existing stub-drift remediation mechanism into the Actions Fleet Monitor workflow in a way that is opt-in, DRY_RUN by default, and guarded by an explicit human workflow_dispatch input plus pilot + credential gates, with documentation and tests to keep the behavior safe and auditable.
Changes:
- Add a pure “go/no-go” gate (
scripts/fleet_remediate_gate.sh) to decide DRY_RUN vs live remediation from(event, remediate mode, credential present, pilot present). - Extend
actions-fleet-monitor.ymlwith aworkflow_dispatchchoice input (remediate: dry-run|live) and a non-blocking remediation step that consumesfleet_stub_drift.json. - Document the remediation loop controls in
AGENTS.mdand add Bats coverage + wire it into the CI bats suite.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/fleet_remediate_gate.bats |
Adds unit tests covering the pure gate behavior and its CLI/source-guard usage. |
scripts/fleet_remediate_gate.sh |
Introduces the pure DRY_RUN/live decision gate with warning-on-degrade semantics. |
AGENTS.md |
Documents the opt-in remediation loop, including pilot gating, cap, allowlist, and DRY_RUN defaults. |
.github/workflows/lint.yml |
Adds the new gate test file to the Bats test set run in CI. |
.github/workflows/actions-fleet-monitor.yml |
Adds remediate input and a non-blocking remediation step that consumes fleet_stub_drift.json after drift detection/reporting. |
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
Dev-Lead — waiting on PR blockers (intent: fix-reviews)PR: #1275 |
Dev-Lead — fix-reviews (no-changes)Agent reasoning |
Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run).
Human review (Phase-4 live-remediation wiring) — approved to proceedReviewed as the fleet maintainer's delegate; go/no-go recorded on #1152. This PR wires the remediation loop into the monitor opt-in and fail-closed; I verified the safety-critical properties directly:
One nit fixed in Clearing |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 2d30ecb406ac1a574bfefb6d5eb2ed9730dfec19
Review mode: triage-approved (single reviewer)
Summary
Phase-4 wiring of the opt-in stub-drift remediation loop into actions-fleet-monitor.yml (266 additions, 5 files, closes #1152). Adds a workflow_dispatch remediate input (dry-run|live, default dry-run), a new pure gate script (scripts/fleet_remediate_gate.sh) with 10 bats tests wired into lint.yml, a remediation step that consumes fleet_stub_drift.json after the existing report/dispatch steps, and AGENTS.md documentation of the four safety controls. Confirms the triage low-risk assessment with one adjustment: classified MEDIUM (not LOW) because the change wires a cross-repo write credential into a workflow step — however the credential (GH_PAT_WORKFLOWS) is the established org credential already used by ~15 workflows, all expression interpolations are routed through env: blocks (no script-injection surface), and the live path is quadruple-gated (workflow_dispatch-only + explicit remediate=live + credential present + pilot repo configured) with a second fail-closed pilot gate inside the pre-existing driver script itself. Inert by default; continue-on-error keeps the monitor non-blocking.
Linked issue analysis
Issue #1152 (epic #1148, Phase 4) — all six acceptance criteria substantively addressed:
- ✅ Remediation step added to actions-fleet-monitor.yml in the same job, AFTER the report/dispatch steps, consuming fleet_stub_drift.json (skips with ::warning:: if artifact absent).
- ✅ DRY_RUN defaults to true; live requires explicit workflow_dispatch remediate=live — schedule/workflow_call are unconditionally dry-run (gate short-circuits on event name; covered by bats tests referencing AC #2).
- ✅ Runs under GH_PAT_WORKFLOWS; absent credential degrades to dry-run with ::warning:: and never fails (gate always returns 0; step is continue-on-error).
- ✅ Go/no-go recording on the tracking issue/PR is documented in AGENTS.md per the repo's go/no-go pattern (process AC — enablement itself is deliberately out of scope of this PR).
- ✅ AGENTS.md documents the remediation loop: DRY_RUN default, pilot gate, per-run cap (default 1), and never-overwrite allowlist with recorded-rationale rule.
- ✅ actionlint/Lint/shellcheck/bats all green; actions-fleet-monitor.yml is org-private automation, not a thin-caller stub, so the no-edit constraint is not violated.
Findings
No blocking findings.
- Verified scripts/fleet_stub_remediate.sh exists at the PR head (pre-existing from Phases 1–3) and its env contract matches the new step exactly (DRY_RUN default true, REMEDIATE_PILOT_REPO, REMEDIATE_MAX_REPOS, REMEDIATE_SUMMARY_FILE); the driver additionally re-checks the pilot gate fail-closed (refuses live writes with no pilot even if DRY_RUN=false) — genuine defense in depth.
- Credential handling: GH_PAT_WORKFLOWS is the established org cross-repo credential (used by ~15 existing workflows); all ${{ }} interpolations in the new step go through env: assignments, no injection surface.
- Both prior review threads (gemini-code-assist, low priority: BASH_SOURCE fallback; bats $output assertion) are resolved, and both fixes are verified present at the reviewed head SHA.
- Secret scan: the run_secret_scanning MCP tool was not available in this session; the gitleaks CI check passed (SUCCESS). No secrets appear in the diff (only secret/var references via GitHub expressions).
CI status
All checks green at 2d30ecb: Lint, ShellCheck, shellcheck, bats (includes the new tests/fleet_remediate_gate.bats), unit-tests, actionlint, gh-aw-compile, CodeQL (actions + python), SonarCloud, Secret scan (gitleaks), Agent Security Scan, agent-shield, caller-stub-freeze, template-drift, validate-* checks, holdout-guard, guard. Conditional dependency-audit jobs skipped (no matching ecosystems). One earlier CANCELLED guard run was superseded by a passing rerun and no longer appears in current checks. mergeStateStatus BLOCKED reflects only the required-review branch protection.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
|
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…the fleet-monitor workflow behind a human go/no-go (#1275) * feat: implement issue #1152 — [Phase 4] Wire opt-in remediation into the fleet-monitor workflow behind a human go/no-go * fix(reviews): address review comments [skip ci-relay] * style(fleet-gate): scope strict mode to direct-exec (no source leak) Human-review polish on #1275: move `set -euo pipefail` out of the top level into the execute-directly guard, so sourcing fleet_remediate_gate.sh for the bats tests doesn't leak strict mode into the caller's shell — matches the repo standard codified in #1257/AGENTS.md. Pure/behaviour-preserving: shellcheck clean, all 10 gate bats pass, sourcing leaves errexit off, and the gate still fail-closes (schedule->dry-run, live dispatch w/ all preconditions->live, missing token/pilot->dry-run). --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>



Closes #1152
Implemented by dev-lead agent. Please review.
Summary by CodeRabbit
New Features
Documentation
Tests