Skip to content

Revert "feat(agy-core): Slice 2 — task-file-injection notifier for agy (#4303)" - #5166

Merged
sonichi merged 2 commits into
mainfrom
revert/4303
Oct 6, 2026
Merged

sonichi merged 2 commits into
mainfrom
revert/4303

Conversation

@sonichi

@sonichi sonichi commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Reverts #4303 (merged as 4a72ddf), which turned main red, and retires the notifier session #4303 left running.

Why. #4303 was green on its own head but was merged without re-running CI against two changes already on main: #4976 (the watcher clears SUTANDO_INSTANCE_ID on the core's canonical inbox, so the agy notifier polled a sentinel nobody writes and never reported ready) and #4945 (exact tmux targets, which the new agy notifier did not use). Four tests have failed on main since: agy-task-notifier, agy-notifier-dependency-gate, claude-task-notifier-submit, tmux-session-targets-are-exact.

What this changes.

  1. f0126fdf8: a plain git revert of 4a72ddf: 11 files, the agy notifier and its tests removed, start-cli.sh back to its prior state.
  2. 0a108922d: runtime rollback. feat(agy-core): Slice 2 — task-file-injection notifier for agy (Antigravity CLI) #4303 started a persistent <session>-watcher tmux session, and the reverted start-cli.sh returns early once the core session exists, so an update left the old notifier running. start-cli.sh now kills an exact-target =<session>-watcher on its own socket on every run (launch or attach), before that early return; idempotent, one log line. Documented in src/agent/agy/README.md. Regressions in tests/agy-start-cli.test.py (StaleWatcherRetirementTests) run a real tmux server on an isolated socket: leftover watcher over a running core, orphan watcher on a fresh launch, and a near-miss name (<session>-watcher2) that must survive.

Rollout. Land #5166 first. #5161 does not land unchanged after it (git merge-tree reports a start-cli.sh conflict plus modify/delete conflicts for task-notifier.sh and its test). It is rebuilt on post-revert main by replaying #4303 plus its fixes, then gets full CI and a live witness before review.

Evidence.

tests/agy-start-cli.test.py, scrubbed env (SUTANDO_* and TMUX unset):

  • at 0a108922d: Ran 29 tests ... OK
  • StaleWatcherRetirementTests against the parent's start-cli.sh (f0126fdf8): FAILED (failures=2): test_rerun_over_a_running_core_retires_the_leftover_watcher and test_fresh_launch_retires_an_orphan_watcher_and_starts_the_core. The near-miss test passes on both, as it should.
  • scripts/review-checks.sh on the diff: PASS.
  • From the first commit: tmux-session-targets-are-exact and claude-task-notifier-submit pass (both fail on main).

Live witness on a real host, real authenticated agy 1.3.0 (auth on this host is a Gemini API key, no interactive login). Scratch tmux socket, scratch workspace and onboarding path; no live session, socket or workspace touched. It starts from #4303's own launcher at the base commit 54d6465fd (real agy core plus the real notifier watcher, with its watch-tasks-stream.sh and fswatch children), reruns this head's launcher over it, then kills the core and restarts it from this head and does a real prompt round trip:

== base 54d6465fd (#4303 on main): start the core + watcher pair
seeded: <scratch>/wit-ws/onboarding.json
Started wit-agy detached. Attach via:
  tmux -S <tmpdir>/s attach -t wit-agy
rc=0
notifier processes (cmdline names the scratch inbox):
  55202 bash <base>/src/watch-tasks-stream.sh <scratch-ws>/tasks-agy --role session --inbox <scratch-ws>/tasks-agy
  55288 fswatch -l 0.5 --event Created --event Renamed --event Updated <scratch>/wit-ws/tasks-agy
wit-agy pid=55177 cmd=agy
wit-agy-watcher pid=55186 cmd=bash
== PR head 0a108922d: rerun the launcher over that pair
Retired stale wit-agy-watcher (task injection is no longer part of this launcher).
wit-agy already running.
rc=0
wit-agy pid=55177 cmd=agy
notifier processes left after retire: 0
== rerun again (idempotent)
wit-agy already running.
wit-agy pid=55177 cmd=agy
== restart: kill the core session, start fresh from the PR head
no server running on <tmpdir>/s   (the core was the last session, so tmux exited)
already seeded: <scratch>/wit-ws/onboarding.json
Started wit-agy detached. Attach via:
  tmux -S <tmpdir>/s attach -t wit-agy
rc=0
wit-agy pid=55819 cmd=agy
== agy idle after ~2s; typing the prompt (agy's TUI can drop early keystrokes, so confirm it staged)
== agy pane after the prompt (waited ~6s)
  Antigravity CLI 1.3.0
  Gemini API key
  Gemini 3.1 Pro (Low)
  <PR worktree>
────────────────────────────────────────────────────────────
> What is 1234 + 4321? Answer with only the number.
▸ Thought for 3s, 313 tokens   (one-line thinking summary elided)
  5555
────────────────────────────────────────────────────────────────────────────────
>
────────────────────────────────────────────────────────────────────────────────
? for shortcuts                                             Gemini 3.1 Pro · low
ROUND TRIP: OK (5555 in agy's reply)

The stale watcher session and its whole process tree are gone after the rerun, the running core is untouched, a second rerun is quiet, and the restarted manual agy path answers a real prompt.

🤖 Generated with Claude Code

…y (Antigravity CLI) (#4303)"

This reverts commit 4a72ddf. #4303 was green on its own head but was not
re-run against #4976 and #4945, which had landed on main; together they
turned four notifier and tmux tests red on main. The forward fix (#5161) is
still in review, so main is restored first; agy Slice 2 re-lands with that
fix once it is approved.

Stand: Echo Act IV Pro
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonichi
sonichi requested a review from qingyun-wu as a code owner October 6, 2026 21:06

@john-the-dev john-the-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at f0126fd.

  • Exact revert: the +/- lines of git diff f0126fdf^ f0126fdf are identical to the inverse of 4a72ddf (#4303). 11 files, +20/-2068, nothing else touched.
  • Applies cleanly to current main: git merge-tree --write-tree origin/main pr succeeds.
  • No dangling references: the 4 deleted files (src/agent/agy/cli/task-notifier.sh and the 3 agy test files) are referenced on main only by each other.
  • Not verified by me: I didn't run the suites. CI on this head is the proof that main goes green; it was still running at submit.

@qingyun-wu qingyun-wu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-owner approval, decided by Qingyun on the [PA] decision page at f0126fd (verified pure revert of 4a72ddf). Posted by Qingyun's Sutando.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Coverage Gate

✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 91%.

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.

@keweichen keweichen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head f0126fdf8e9adfacf13f88601b8193290fe985f8 against current base 54d6465fd8d54a4c1722dfca6dfb9f3d653ed0c4.

The source-level revert is mechanically clean: its patch is the exact inverse of 4a72ddf54, every affected blob matches the pre-#4303 parent, review-checks.sh passes, the focused suites pass, and all 26 applicable Actions checks are green. I found no extra code delta.

Blocking — the runtime rollback is not demonstrated and leaves an already-running notifier alive. #4303 starts a persistent ${SESSION}-watcher; this revert removes every reference to that session. At this head, start-cli.sh returns as soon as the core session exists, so rerunning it after an update cannot retire the old watcher. I reproduced that on an isolated tmux socket:

before:
review-agy
review-agy-watcher
launcher:
review-agy already running.
after:
review-agy
review-agy-watcher

With default queues that stale watcher is normally inert, and the feature was unreleased/manual, so the exposure is limited. With explicit queue overrides it can nevertheless keep running the removed injector after the checkout and docs say task injection is gone. This is exactly the teardown side required by REVIEW.md lesson 11.

Before approval, please document and exercise an explicit post-update cleanup for an existing ${SESSION}-watcher, then post the exact-head real post-restart agy round trip required for startup/live-path changes (real authenticated session, not only the harness). The witness should begin from a #4303-style core + watcher pair and show the stale watcher absent after rollback while the surviving manual agy path still completes a real interaction.

Follow-up sequencing: the current #5161 cannot simply land after this revert. git merge-tree --write-tree reports a start-cli.sh content conflict plus modify/delete conflicts for task-notifier.sh and its test; retaining #5161's side would still reference the --typable and watcher-ready-token contracts removed here. Please correct the rollout note: land #5166 first, rebuild #5161 on post-revert main by replaying #4303 plus its fixes, and rerun full CI and the live witness.

Separate merge gate: license/cla is absent at this head (total_count: 0, no status contexts), not failing. The repository's documented close/reopen or fresh-head recovery is still needed before merge.

The reverted launcher no longer knows about the "<session>-watcher" tmux
session #4303 started, and it returns early once the core session exists,
so an update left the old notifier running. Every run of start-cli.sh now
kills an exact-name leftover watcher on its own socket before that guard.
Regressions run a real tmux server on an isolated socket.

Stand: Echo Act IV Pro
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cla-assistant check

@sonichi sonichi closed this Oct 6, 2026
@sonichi sonichi reopened this Oct 6, 2026

@john-the-dev john-the-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at 0a10892. My f0126fd approval did not cover the new commit; this review does. It addresses @keweichen's blocking point about the leftover ${SESSION}-watcher.

The revert is still exact. The full PR is f0126fd plus 0a10892, and 0a10892's parent is f0126fd. The +/- lines of git diff f0126fdf^ f0126fdf are identical to the inverse of 4a72ddf. 0a10892 touches only start-cli.sh (+14), the agy README (+4) and tests/agy-start-cli.test.py (+78).

The retirement is safe.

  • retire_stale_watcher (start-cli.sh:39-47) works only on $TMUX_SOCKET, the agy socket. It names one target, "=${SESSION}-watcher". The = prefix forces an exact session match, which is the right form for has-session/kill-session targets (a trailing : is only needed for window/pane targets).
  • It runs at :111, after the agy/tmux availability exits and before the session_exists early return, so it fires on both launch and attach. --check and --help exit earlier and never touch tmux.
  • It is idempotent: when the session is absent, has-session fails and it returns 0 quietly.

Tests, run with a scrubbed env (env -i, no SUTANDO_*/TMUX) at 0a10892:

  • tests/agy-start-cli.test.py: 29 OK. All 3 StaleWatcherRetirementTests ran against a real tmux server; none were skipped.
  • tests/tmux-session-targets-are-exact.test.py: 2 OK.
  • Mutant 1, the call removed: 2 failures.
  • Mutant 2, = dropped so tmux prefix-matches: 1 failure. The -watcher2 near-miss test catches it.

Independent live repro of keweichen's scenario (isolated socket and scratch tasks/results/workspace, stub agy, real fswatch):

  • 4a72ddf's launcher started the real pair, agyw + agyw-watcher, with the notifier's setsid'd watch-tasks-stream.sh and fswatch children alive.
  • I reran this head's launcher. It printed Retired stale agyw-watcher ... then agyw already running., and left only agyw in tmux ls.
  • pgrep -f <scratch tasks dir> then found no processes. The notifier's HUP to EXIT trap tears down its setsid'd watcher group, so the whole process tree is gone, not just the tmux session.

Other checks:

  • scripts/review-checks.sh --diff on the PR diff: PASS.
  • CI on 0a10892: the first run (37535115318) was cancelled. Its "tsc + tests" gate failed only because the test jobs were cancelled (capacity/superseded), not because a test failed. Its replacement, 37535189631 on the same head, was still in progress when I submitted.
  • license/cla is now present on this head.

Not verified by me:

  • I did not do a real authenticated agy round trip. I used a stub agy; the author's PR body carries one at this head.
  • I did not see the replacement CI run finish.
  • #5161 sequencing is out of scope here.

@qingyun-wu qingyun-wu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-owner re-approval, decided by Qingyun on the [PA] decision page at 0a10892 (revert of #4303 plus the agy watcher cleanup). Posted by Qingyun's Sutando.

@sonichi
sonichi dismissed keweichen’s stale review October 6, 2026 22:06

Dismissed on the owner's word after verifying the fix at 0a10892: start-cli.sh retires a leftover '-watcher' tmux session before its early return (exact target, idempotent), with a regression on an isolated tmux socket that fails at the parent; the rollout note now says land this revert first and rebuild #5161 on post-revert main; CLA re-attached; the PR body carries a real agy round trip on this host (stale watcher retired, restarted agy answers). rui and Qingyun approved this head. Kewei, a re-review is still welcome.

@sonichi
sonichi merged commit 8bf2d16 into main Oct 6, 2026
55 of 68 checks passed
@sonichi
sonichi deleted the revert/4303 branch October 6, 2026 22:07
sonichi added a commit that referenced this pull request Oct 6, 2026
…ored notifier

Re-landing agy Slice 2 (#4303) brings back ensure_task_notifier, which already
has its own tested contract: preserve a live watcher across a plain reattach,
recycle one only when the core session itself is fresh or after a crash
restart (test_normal_reattach_does_not_recycle_a_live_watcher,
test_second_invocation_does_not_duplicate_the_watcher,
test_crash_restart_recycles_the_stale_watcher_exactly_once, all pre-dating
#5166). Calling #5166's retire_stale_watcher unconditionally on every
invocation -- its shape while ensure_task_notifier didn't exist -- regressed
both of the first two: every reattach now killed and restarted an otherwise
healthy watcher.

Keeps retire_stale_watcher, but only for what ensure_task_notifier genuinely
cannot cover: a watcher left running when this launcher currently has no way
to manage one at all (the notifier script or fswatch missing). Every other
case -- reattach, fresh launch, crash restart -- is ensure_task_notifier's
existing, tested call, unchanged.

tests/agy-start-cli.test.py's StaleWatcherRetirementTests already simulates
the "cannot manage a watcher" case (no real notifier script in its hermetic
env), so its assertions needed no behavioral change, only an explicit
SUTANDO_AGY_NOTIFIER_SCRIPT override (so the retirement path fires on intent,
not by accident of what's on PATH) and an updated stderr expectation for the
now-restored ensure_task_notifier warning when it also runs on the same path.

Stand: Echo Act IV Pro
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
sonichi added a commit that referenced this pull request Oct 6, 2026
…ored notifier

Re-landing agy Slice 2 (#4303) brings back ensure_task_notifier, which already
has its own tested contract: preserve a live watcher across a plain reattach,
recycle one only when the core session itself is fresh or after a crash
restart (test_normal_reattach_does_not_recycle_a_live_watcher,
test_second_invocation_does_not_duplicate_the_watcher,
test_crash_restart_recycles_the_stale_watcher_exactly_once, all pre-dating
#5166). Calling #5166's retire_stale_watcher unconditionally on every
invocation -- its shape while ensure_task_notifier didn't exist -- regressed
both of the first two: every reattach now killed and restarted an otherwise
healthy watcher.

Keeps retire_stale_watcher, but only for what ensure_task_notifier genuinely
cannot cover: a watcher left running when this launcher currently has no way
to manage one at all (the notifier script or fswatch missing). Every other
case -- reattach, fresh launch, crash restart -- is ensure_task_notifier's
existing, tested call, unchanged.

tests/agy-start-cli.test.py's StaleWatcherRetirementTests already simulates
the "cannot manage a watcher" case (no real notifier script in its hermetic
env), so its assertions needed no behavioral change, only an explicit
SUTANDO_AGY_NOTIFIER_SCRIPT override (so the retirement path fires on intent,
not by accident of what's on PATH) and an updated stderr expectation for the
now-restored ensure_task_notifier warning when it also runs on the same path.

Stand: Echo Act IV Pro
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
qingyun-wu added a commit that referenced this pull request Oct 7, 2026
Brings in the #4303 revert (#5166), the CI sharding change (#5000) and
the rest of main since 54d6465. One conflict, in the CLI usage string of
src/delivery/task_dispatch.py: this branch adds the `sweep-plan` line
above `pending-candidates`/`next-pending`, while main's revert drops
`[--typable]` from those two lines. Resolved by keeping the new line and
taking main's text for the two existing ones. No other change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

4 participants