Commit 9b31039
Fix the OpenCode hook row and name the CLIs that fail to install (#636)
* Hide the OpenCode hook row once its hooks are removed
The Agent session tracking list gave OpenCode a different visibility rule
than every other CLI: its row was driven by
ShouldShowDetectedOrConfiguredHookRow (binaryOnPath || hasHookState),
while Copilot, Claude, Gemini and Codex used HasHookState alone.
With the opencode binary on PATH but its hooks uninstalled, the row
therefore stayed behind after a successful removal, showing a Remove
button that CanRemoveOpenCodeHooks kept permanently disabled — a dead
row the user can neither act on nor dismiss, even though
`wta hooks status` correctly reported the hooks as gone.
Drive all five rows from HasHookState so a row disappears when its
hooks are removed. Discoverability is unaffected: installation runs
through the single "Install hooks" button, which already covers every
detected CLI, so a detected-but-uninstalled row carried no action to
begin with.
Drops the now-unused ShouldShowDetectedOrConfiguredHookRow helper, the
_openCodeHooksPresent field, and the CanRemoveOpenCodeHooks projection;
the OpenCode Remove button binds to CanRemoveAgentHooks like the rest.
Validated with a Debug build of Microsoft.Terminal.Settings.Editor
(x64) and AgentHooksStatusTests, 25/25 passing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Name the CLIs that failed to install hooks
Clicking "Install hooks" and having, say, Codex fail produced a single
"Hooks installation failed. Check <log> for details." line. Every other CLI
could have installed fine and the user had no way to tell which one broke,
or that the rest succeeded, short of opening wta-install-hooks.log.
wta already computes the answer. `run_install` folds two independent
failure signals — the spawn errors the install commands reported, and the
post-install status check that catches a command which claimed success but
registered nothing — into a message naming each failing CLI with its
reason. That message only ever reached stderr and the trace log, because
the Settings UI shells out through RunWtaAndWait and sees a bare bool.
Give `wta hooks install` the `--json` treatment `status` and `uninstall`
already have, and consume it:
* InstallReport / CliInstallResult (schema v1) report per-CLI
installed / skipped / failed plus the failure reason. Failure wins over
the status check, so a spawn error with a PREVIOUS plugin still on disk
stays a failure instead of reading as installed.
* A CLI that simply isn't on the machine is `skipped`, not `failed` —
otherwise every uninstalled CLI would be named in the error line.
* `outcome` is a plain string, so an outcome added later lands as
"not a failure" rather than failing the whole parse.
On the C++ side the install path now captures output independently of the
exit code — wta prints the report and *then* exits non-zero, so the
existing exit-0-only helper would have discarded exactly the payload we
need. RunWtaCapture returns the combined output plus the exit code, and
RunWtaCaptureStdout is a thin wrapper preserving its old contract.
The summary falls back to the unattributed message whenever the report is
unreadable or blames no particular CLI — a timeout, a crash before the
report was written, or a failure that isn't per-CLI.
Adds AIAgents_HooksInstallationFailedForSummary across all 16 locales.
The CLI names are brand names rendered with the same display names as the
rows above the summary, and stay untranslated.
Validated with the full wta suite (1587 passing), AgentHooksStatusTests
(33 passing), and Debug x64 builds of Microsoft.Terminal.Settings.Editor
and the unit tests. Live check of both paths:
`hooks install --json --cli codex` reports the real marketplace-repoint
failure with its reason and exits 1; `--cli copilot` reports installed and
exits 0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Keep stderr out of the install report parse
Copilot review found a real defect in the previous commit. `wta hooks
install --json` prints its report to stdout and then lets `main()` return
Err, which makes the Rust runtime write
Error: hooks installation failed for: codex
codex: codex plugin marketplace add failed: ...
to stderr. RunWtaCapture merged both streams into one pipe, so on exactly
the path the report exists to serve — a failing install — the captured
text was JSON plus that trailer, and depending on flush order possibly the
trailer first. ParseInstallReportJson would fail, the UI would fall back
to the unattributed summary, and naming the failing CLI would never work.
Verified against the real binary: stdout carries 278 bytes of pure JSON,
stderr carries a 200-byte Error block.
RunWtaCapture takes a `mergeStderr` flag (default true, so
RunWtaCaptureStdout and its existing callers are untouched) and the
install path passes false. Non-merged stderr goes to NUL rather than a
second pipe: a second pipe would need its own drain to avoid deadlocking
a chatty child, and every wta subcommand already mirrors its diagnostics
into the wta logs, which is where the summary points the user anyway.
Also from the review: HidesDetectedCliWithoutHooks claimed to guard the
Settings row-visibility decision but only asserted that HasHookState
ignores binaryOnPath, so reintroducing `binaryOnPath || HasHookState(...)`
at the call site would have left it green. Add ShouldShowHookRow as the
single named predicate the five ViewModel call sites share, and assert
the row decision through it — including the partially-installed case,
which must stay visible because it's the state the user most needs to act
on.
Two check-spelling findings: rename the unknown-CLI test fixture off an
invented word, and fix "not an detail".
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Use unique_hfile for the NUL stderr handle
Copilot review caught a latent handle bug in the previous commit.
CreateFileW signals failure with INVALID_HANDLE_VALUE, but the NUL handle
was held in a wil::unique_handle, whose invalid value is nullptr. A failed
open would therefore have passed `if (!nullHandle)` and been handed to
CreateProcessW as hStdError.
wil::unique_hfile is the type whose invalid value is INVALID_HANDLE_VALUE,
so the existing null check now actually rejects the failure. It's also
what the rest of the repo uses for CreateFileW results (til/io.h,
WindowEmperor.cpp, types/utils.cpp).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent fa18a35 commit 9b31039
27 files changed
Lines changed: 774 additions & 57 deletions
File tree
- src/cascadia
- TerminalSettingsEditor
- Resources
- de-DE
- en-US
- es-ES
- fr-FR
- it-IT
- ja-JP
- ko-KR
- pt-BR
- qps-ploca
- qps-plocm
- qps-ploc
- ru-RU
- sr-Cyrl-RS
- uk-UA
- zh-CN
- zh-TW
- inc
- ut_app
- tools/wta/src
- cli
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
439 | | - | |
| 438 | + | |
| 439 | + | |
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
| |||
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
571 | | - | |
| 571 | + | |
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| |||
Lines changed: 37 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1237 | 1237 | | |
1238 | 1238 | | |
1239 | 1239 | | |
1240 | | - | |
1241 | 1240 | | |
1242 | 1241 | | |
1243 | 1242 | | |
| |||
1258 | 1257 | | |
1259 | 1258 | | |
1260 | 1259 | | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
1267 | 1265 | | |
1268 | 1266 | | |
1269 | 1267 | | |
| |||
1280 | 1278 | | |
1281 | 1279 | | |
1282 | 1280 | | |
1283 | | - | |
1284 | 1281 | | |
1285 | 1282 | | |
1286 | 1283 | | |
| |||
1394 | 1391 | | |
1395 | 1392 | | |
1396 | 1393 | | |
| 1394 | + | |
1397 | 1395 | | |
1398 | 1396 | | |
1399 | | - | |
| 1397 | + | |
1400 | 1398 | | |
1401 | 1399 | | |
1402 | 1400 | | |
| |||
1408 | 1406 | | |
1409 | 1407 | | |
1410 | 1408 | | |
1411 | | - | |
| 1409 | + | |
1412 | 1410 | | |
1413 | 1411 | | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
1414 | 1427 | | |
1415 | 1428 | | |
1416 | | - | |
| 1429 | + | |
1417 | 1430 | | |
1418 | 1431 | | |
1419 | 1432 | | |
1420 | | - | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
1421 | 1446 | | |
1422 | 1447 | | |
1423 | 1448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 210 | | |
215 | 211 | | |
216 | 212 | | |
| |||
290 | 286 | | |
291 | 287 | | |
292 | 288 | | |
293 | | - | |
| 289 | + | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
297 | 293 | | |
298 | 294 | | |
299 | | - | |
300 | 295 | | |
301 | 296 | | |
302 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2914 | 2914 | | |
2915 | 2915 | | |
2916 | 2916 | | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
2917 | 2921 | | |
2918 | 2922 | | |
2919 | 2923 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3035 | 3035 | | |
3036 | 3036 | | |
3037 | 3037 | | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
3038 | 3042 | | |
3039 | 3043 | | |
3040 | 3044 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2914 | 2914 | | |
2915 | 2915 | | |
2916 | 2916 | | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
2917 | 2921 | | |
2918 | 2922 | | |
2919 | 2923 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2915 | 2915 | | |
2916 | 2916 | | |
2917 | 2917 | | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
2918 | 2922 | | |
2919 | 2923 | | |
2920 | 2924 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2914 | 2914 | | |
2915 | 2915 | | |
2916 | 2916 | | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
2917 | 2921 | | |
2918 | 2922 | | |
2919 | 2923 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2914 | 2914 | | |
2915 | 2915 | | |
2916 | 2916 | | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
2917 | 2921 | | |
2918 | 2922 | | |
2919 | 2923 | | |
| |||
0 commit comments