Skip to content

fix(antigravity): stop waiting on abandoned hook input - #21634

Merged
nwparker merged 3 commits into
nwparker/agy-hook-healthfrom
nwparker/agy-hook-stdin
Sep 21, 2026
Merged

nwparker merged 3 commits into
nwparker/agy-hook-healthfrom
nwparker/agy-hook-stdin

Conversation

@nwparker

@nwparker nwparker commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Latest verification — 2026-09-20: Authenticated local generation now succeeds. A real tool turn emitted seven hook payloads, replayed byte-for-byte through the branch POSIX script. Native loading of the replacement POSIX script remains unverified. The earlier 401 was an authentication limitation and is resolved. All checks at the unchanged PR head are green. Earlier screenshots and test notes below describe their original runs.

Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​206 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​201
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​116 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​72

ELI5

An Antigravity hook can keep waiting forever if its caller leaves the input pipe open. This lets it finish once a complete message arrives, or stop waiting after five seconds of silence. A timed-out partial message is discarded instead of being sent as a broken status update.

What Changed

The POSIX hook reuses the existing JSON reader with stricter incomplete-input handling. With Python available, complete JSON does not require the caller to close stdin. Without Python, a five-second EOF reader bounds the wait and cleans up its reader/watchdog processes. Existing offline event storage and Windows behavior are preserved.

Why

Testing #15821 found its one-second cutoff truncated a message delivered in two writes 1.5 seconds apart; its older implementation also lacked current offline event storage. This change keeps delayed complete messages and the existing replay path. It extends the shared reader while retaining its existing Grok defaults.

Linked Issue

Related: #15117, #11549. Revised approach to #15821; no issue closure claimed. Stacked on #21628 to keep this diff focused.

Visual Proof

Real generated hook scripts executed inside a hidden Orca terminal, posting to a loopback HTTP receiver. current is the original script; revised is this branch. The original abandoned-input probe was killed after three seconds; the revised script exited normally in 5.08 seconds. Both preserved delayed JSON and offline storage.

Before and after generated hook processes

The terminal hosts external scripts generated from this source; the renderer is an earlier validation build. This is direct hook-process evidence, not proof of a successful installed-agy turn or a live agy hang recovery.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

macOS: eight real-process payload tests pass, covering large Unicode JSON, open stdin, delayed chunks with/without Python, timed-out incomplete input, abandoned input, offline storage, stderr, and descendant cleanup. Shared reader/service/lifecycle regression run: 39 passed, two skipped; remote installer suite: 24 passed. Full pnpm tc passes after adding the bounded reader to the CLI project file list. Focused oxlint and changed-code quality gate passed. Full build and remaining platform coverage are left to CI.

Installed agy loads the managed hook bundle, but generation returns HTTP 401 ACCESS_TOKEN_TYPE_UNSUPPORTED; actual event execution after successful generation remains unverified. No user authentication or global hooks were changed.

Review

Without Python, complete JSON still requires EOF within five seconds; an open pipe times out and drops the event. Python mode uses a five-second idle timeout, not a total deadline. Real Linux/SSH execution and Windows regression checks remain pending. Remote installation keeps using the same generated POSIX script; no protocol change.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, user-facing behavior, mechanism, alternatives)
  • Before/after evidence attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform and SSH impact considered
  • Full lint, typecheck, test, and build coverage (focused checks above; CI pending)

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent verification update:

  • Installed agy 1.2.7 returned the exact sentinel AGY_HOOK_STDIN_LIVE_OK.
  • Hook stdin/payload/service suites: 29 passed, 2 skipped.
  • pnpm tc:node and pnpm tc:cli passed.
  • Changed-code quality passed with 0 new findings across 32 changed files.
  • The replacement CI run 35434509028 passed all 8 test shards, typecheck, static analysis, verify, and both packages.

Scoped verdict: Approve after CI, for bounded POSIX hook input and payload handling. Native loading of the replacement POSIX script, Linux/SSH execution, and Windows regressions remain unverified.

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent verification (2026-09-20):

  • Bounded stdin/payload/hook-service suites: 29 passed, 2 skipped.
  • pnpm tc:node and pnpm tc:cli passed.
  • pnpm run check:code-quality:changed origin/main passed with 0 new findings across 32 changed files.
  • Installed agy 1.2.7 authenticated exact sentinel returned AGY_HOOK_OK.
  • Full CI 35434509028 is green across test shards, typecheck, static analysis, managed hooks, and macOS/Windows packages.

Verdict: approve after CI for bounded POSIX hook input and payload handling. Native replacement-script loading, Linux/SSH, and Windows execution remain outside this local proof; #21635 should follow in stack order. No merge performed.

@nwparker

Copy link
Copy Markdown
Contributor Author

Fresh CI rerun: green.

ELI5: if agy's hook stops talking, Orca stops waiting instead of hanging forever. Scoped tests and CI are green; merge verdict: approve scoped hook behavior.

@nwparker
nwparker marked this pull request as ready for review September 21, 2026 03:58
@pullfrog

pullfrog Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor
  • Read summary snapshot and full PR diff
  • Triage: understand hook stdin contract and affected seams
  • Investigate surrounding code, tests, callers
  • Dispatch specialists for unresolved questions
  • Draft and submit review
  • Update PR summary snapshot

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 455ff74 into nwparker/agy-hook-health Sep 21, 2026
67 of 85 checks passed
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.

1 participant