Skip to content

fix(agent-hooks): repair hooks after Windows CLI installation - #22330

Closed
lurunzi wants to merge 2 commits into
stablyai:mainfrom
lurunzi:codex/antigravity-hook-repair
Closed

lurunzi wants to merge 2 commits into
stablyai:mainfrom
lurunzi:codex/antigravity-hook-repair

Conversation

@lurunzi

@lurunzi lurunzi commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

ELI5

After installing Antigravity while Orca is already open on Windows, a new terminal can run it while its status hooks remain missing. Asking Orca to enable hooks again can also do nothing when the setting is already on. This fixes those two recovery gaps.

What Changed

  • Refresh the persisted Windows PATH before managed-hook CLI detection, using the existing PATH reader on a private environment copy. Explicit target PATHs and POSIX hosts keep their existing behavior.
  • Treat an explicit agentStatusHooksEnabled: true update as a repair request, using the existing serialized reconciliation and cancellation checks. The connected-runtime orca agent hooks on path can now retry installation without toggling every agent off first.
  • Add regressions for newly installed CLIs, target-environment isolation, POSIX behavior, and repeated enable.

Why

The terminal launch path already refreshes Windows PATH, while the hook detector previously relied on the older inherited environment. Reusing that reader aligns detection without adding install-directory guesses or changing the process-wide PATH. Reusing reconciliation repairs missing hooks without a new poller or another status store.

Linked Issue

Related to #17672. This is a focused recovery fix, not a claim to resolve every cause in that report.

Visual Proof

Pending: this draft has no rendered before/after proof. On the affected Windows machine, Antigravity's hooks were backed up and repaired with the existing installer, and the production CLI confirmed installed. The already-running agent has not published a new status row; no session was interrupted to obtain a screenshot. Live sidebar/dashboard recovery remains unverified.

Testing

  • I manually tested the detector and configuration repair on Windows; rendered recovery is pending.
  • Automated tests added/updated.

Both new failure regressions fail on the unmodified upstream implementation: PATH detection returns missing, and repeated enable makes zero reconciliation calls. They pass with the fix.

Validated on this branch against current upstream:

  • Hook/presence suites: 34 passed, 4 platform skips.
  • Selected runtime/paired-settings tests: 26 passed; other runtime tests were deselected.
  • Node typecheck and the changed-code quality gate.
  • The real-filesystem detector comparison on the affected machine finds agy after the fix without manually supplying its new PATH.

Full lint/test/build, native macOS/Linux execution, live SSH, and rendered Electron checks were not run. No application package was built or installed.

AI Disclosure

Developed and checked with Codex (OpenAI).

Review

Self-reviewed the Windows-only registry access, explicit PATH isolation, serialization, and disabled-agent cancellation checks. This does not add automatic hook reconciliation on every new agent launch, identify the writer of an empty hooks config, or force running agents to reload their hooks.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied or translated.

Notes

No RPC field or status schema is added. Paired settings updates run the repair on the runtime owning execution. Unrelated settings updates retain their existing behavior.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots or videos attached for UI changes
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path impact considered
  • Full pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass; only the focused checks above were run locally

lurunzi and others added 2 commits September 22, 2026 22:25
Refresh persisted Windows PATH for managed hook detection and reconcile
an explicit enable even when status hooks are already enabled.

Co-authored-by: Codex <[email protected]>
@lurunzi

lurunzi commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Added the missing Windows PATH modules to the CLI TypeScript project in 1341a12. The CLI now includes the same dependencies used by hook discovery; this is a follow-up to this PR, not an additional feature.

Rechecked on Windows: CLI typecheck passed; the two local-agent-cli-presence test files reported 11 passed / 1 skipped. Full runtime, packaged app and macOS/Linux/SSH checks were not rerun in this update. Prepared with Codex.

@nwparker

Copy link
Copy Markdown
Contributor

Thank you, @lurunzi, for tracking this down and for the clear write-up. The same fix has since landed on main in #38899: on Windows, hook CLI detection now reads the persisted registry PATH the way terminal launch does, and orca agent hooks on while hooks are already enabled re-runs reconciliation to repair missing hooks. Since this is now covered, I'm closing this draft. Your investigation pointed directly at both root causes, so thank you!

@nwparker nwparker closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants