Commit 7ec62f2
Eng 3123 cli action comment wait (#4245)
## Summary
- Add `--comment` flag to CLI (`submit-plan`, `start-analysis`) and
`--wait` flag to `get-change` to enable GitHub App PR commenting and
control analysis polling
- Add `comment` and `wait` inputs to the `submit-plan` composite action,
with backward-compatible `fetch-change` deprecation
- Migrate internal workflows (`terraform.yml`, `terraform-meta.yml`) to
use the new inputs and disable legacy Slack plan notifications
## Linear Ticket
- **Ticket**:
[ENG-3123](https://linear.app/overmind/issue/ENG-3123/phase-4-cli-action-wire-comment-flag-auto-detect-and-skip-wait)
— Phase 4: CLI + Action — Wire Comment Flag, Auto-Detect, and Skip Wait
- **Project**: Multi-Plan Submission & GitHub App PR Commenting (Phase 4
of 5)
## Changes
### CLI (`cli/cmd/`)
- `flags.go`: New `--comment` bool flag on `addAnalysisFlags`,
requesting the GitHub App to post PR comments
- `changes_submit_plan.go`: When `--comment` is set, outputs eval-able
`CHANGE_URL` and `GITHUB_APP_ACTIVE` assignments instead of bare URL;
passes `PostGithubComment` to `StartChangeAnalysis` RPC
- `changes_start_analysis.go`: Same `--comment` behavior and
`PostGithubComment` plumbing for the standalone `start-analysis` command
- `changes_get_change.go`: Adds `--wait` flag (default `true`); skips
`waitForChangeAnalysis` when `--wait=false`. Also fixes `MarkDeprecated`
referencing wrong command (`submitPlanCmd` → `getChangeCmd`)
- Housekeeping: replace `_ = MarkDeprecated`/`MarkHidden` with
`cobra.CheckErr(...)` across 7 call sites
### Action (`actions/submit-plan/action.yml`)
- New `comment` (default `"true"`) and `wait` (default `"false"`) inputs
- `fetch-change` marked deprecated with backward-compatible shim
- New `github-app-active` output; fixes `message` output (was
incorrectly mapped to `change-url`)
- When `comment=true`: tries `--comment` flag, falls back gracefully if
CLI is older (`unknown flag` detection), and only fetches/posts sticky
comment when the GitHub App is not active
- Stderr isolation: redirects stderr to temp files (`submit-stderr.log`,
`get-stderr.log`) instead of `2>&1` to prevent logrus output from
polluting eval'd shell assignments or PR comment content
### Workflows (`.github/workflows/`)
- `terraform.yml` and `terraform-meta.yml`: migrate from `fetch-change`
to `comment`, add push-event guard, disable Slack plan notifications
(GitHub App replaces them)
## Deviations from Approved Plan
### Additions not in the plan
1. **Stderr isolation in action shell logic**
(`actions/submit-plan/action.yml`): The plan uses `eval "$(cli ...)"`
directly. The implementation captures stdout to a variable with stderr
redirected to temp files (`2>./overmindtech/submit-stderr.log`,
`2>./overmindtech/get-stderr.log`), then evals the variable. This
prevents logrus stderr lines (containing invalid bash identifiers like
`change-url`) from breaking `eval`, and prevents log noise from leaking
into PR comment content.
2. **Backward compatibility fallback for older CLIs**
(`actions/submit-plan/action.yml`): The plan assumes the CLI supports
`--comment` and `--wait`. The implementation adds fallback: if the CLI
returns "unknown flag" (detected via the stderr temp file), it falls
back to the legacy code path and logs a `::notice::`. This enables
rolling out the action change before all CLI versions support the new
flags.
3. **Push-event guard in workflows** (`.github/workflows/terraform.yml`,
`terraform-meta.yml`): The plan removes `fetch-change` without adding an
equivalent guard. The implementation passes `comment: ${{
github.event.number != '' }}` instead of unconditional `comment: true`,
preventing comment logic from running on push events where there's no PR
number.
### Minor approach changes
4. **Sticky comment condition**: The plan checks `inputs.comment !=
'false'`. The implementation checks `steps.submit-plan.outputs.message
!= ''` — more robust since `message` is only populated when the change
was actually fetched.
5. **`fetch-change` deprecation mapping**: The plan maps both `true` →
`comment: true` and `false` → `comment: false`. The implementation only
remaps the `false` case (setting `OVM_COMMENT='false'`), since `comment`
already defaults to `"true"`.
### Omissions from the plan
6. **Part 8 — Linear issue for Slack notification feature**: The plan
calls for creating a Linear issue titled "Investigate Slack notification
feature for change analysis results". This was **not created** and
should be filed separately.
## Test Plan
- [x] Flag registration tests for `--comment` on `submit-plan` and
`start-analysis`
- [x] Flag registration test for `--wait` on `get-change` (default
`true`)
- [ ] Verify `submit-plan` action with `comment: true` on a PR event
(GitHub App active path)
- [ ] Verify `submit-plan` action with `comment: true` when GitHub App
is not installed (sticky comment fallback)
- [ ] Verify `submit-plan` action with older CLI that doesn't support
`--comment` (graceful fallback)
- [ ] Verify `comment: false` skips all PR commenting logic
- [ ] Verify `wait: true` blocks until analysis completes and populates
`message` output
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Changes GitHub Actions and CLI behavior around when to wait for
Overmind analysis and where results are posted; misconfiguration could
lead to missing plan feedback or altered CI timing. Touches deployment
workflows but not Terraform execution logic itself.
>
> **Overview**
> Routes Terraform plan reporting away from Slack and toward PR
comments, wiring workflows to pass a new `comment` input to
`actions/submit-plan` (and disabling the plan-to-Slack steps).
>
> Updates the `submit-plan` composite action and Overmind CLI to support
`comment`/`wait` controls (deprecating `fetch-change`), including
conditional fetching of analysis results, GitHub App vs sticky-comment
handling, and new CLI flags/outputs (`--comment`, `get-change --wait`).
Also tightens flag handling by checking errors when hiding/deprecating
Cobra flags and adds targeted tests for the new flags.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1690417e01470b73fe9bd371b2eb1f878895d32d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
GitOrigin-RevId: a0fb20e395e0f0ffb62e32a3970c48dff980e1841 parent 55b2fd3 commit 7ec62f2
10 files changed
Lines changed: 67 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
145 | | - | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
10 | 24 | | |
11 | 25 | | |
12 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| 193 | + | |
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| |||
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
208 | 224 | | |
209 | 225 | | |
210 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
261 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
262 | 267 | | |
263 | 268 | | |
264 | 269 | | |
| |||
281 | 286 | | |
282 | 287 | | |
283 | 288 | | |
284 | | - | |
| 289 | + | |
285 | 290 | | |
286 | 291 | | |
287 | 292 | | |
288 | 293 | | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
| 297 | + | |
292 | 298 | | |
293 | 299 | | |
294 | 300 | | |
| |||
298 | 304 | | |
299 | 305 | | |
300 | 306 | | |
| 307 | + | |
301 | 308 | | |
302 | 309 | | |
303 | 310 | | |
304 | 311 | | |
305 | 312 | | |
306 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
307 | 320 | | |
308 | 321 | | |
309 | 322 | | |
| |||
385 | 398 | | |
386 | 399 | | |
387 | 400 | | |
388 | | - | |
| 401 | + | |
389 | 402 | | |
390 | 403 | | |
391 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
| 669 | + | |
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
0 commit comments