Skip to content

Restore saves one at a time; input heard at once; hook events with matchers - #182

Merged
harshalgajjar merged 4 commits into
mainfrom
shared-input-restore-hooks
Oct 6, 2026
Merged

harshalgajjar merged 4 commits into
mainfrom
shared-input-restore-hooks

Conversation

@harshalgajjar

Copy link
Copy Markdown
Owner

Four small fixes to shared code:

  • Restore: one save at a time. saveRestore can be asked for from more than its own loop, so two saves could interleave their reads and writes of the restore state. It now runs under restoreMu.
  • Input is heard at once, and window input counts. The first keystroke after a pause (2 s) flushes the session record immediately instead of at the next flush, so whatever reads it sees someone came back now. A click or key in a mirrored window now counts as input, as terminal typing does. Test: markinput_test.go.
  • Hooks: read the Antigravity CLI's conversation id (conversationId). Test case added.
  • Integrate: hook events name their fields and may carry a matcher. hookEvent{Event, State, Matcher}; a matcher is written only when set (none are today). Generated configs for all four hook harnesses (fresh file, existing file, re-run, removal) are byte-identical before and after. Test: TestHookEntryMatcher.

Gates (Docker, temp HOME): gofmt clean, go vet, go test ./..., -race on internal/client and cmd/reminal, six-target cross-compile.

🤖 Generated with Claude Code

harshalgajjar and others added 4 commits October 6, 2026 07:59
saveRestore reads and rewrites the session's restore state (the agent
seen running again, the plan, the sequence number) without a lock, safe
only while the restore ticker is its one caller. A lock around the whole
save keeps that true for any caller added later: two saves can no longer
interleave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A person's last input reached the session record only at the next
throttled flush, so a list could show a session idle for seconds after
someone came back to it. The first input after a two-second pause now
asks for a flush at once; the rest of a burst still waits for the usual
one.

A click or key in a mirrored window is a person at work too, as typing in
the terminal is: it now stamps the session's last input the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Antigravity CLI names the conversation conversationId in its hook
payload, a key convFromPayload did not look under, so a restart of an
Antigravity session could not resume the conversation it was in. The key
is now read with the others, through the same id-shape check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hook table's entries were positional {event, state} pairs, and
hookEntry took only the state. Each entry is now {Event, State, Matcher}
by name and hookEntry takes the whole event, so an entry can narrow a
tool event to the tools it names. None does: every entry's matcher is
empty, and an empty matcher writes no matcher key at all.

The generated configs are unchanged byte for byte: every harness's hooks
file, written fresh and over a person's existing file, re-run, and
removed, for a plain and a spaced reminal path, dumps identically before
and after. A test pins that no table entry writes a matcher, and that one
naming tools is written with them and replaced, not repeated, on a
re-run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@harshalgajjar harshalgajjar reopened this Oct 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 6, 2026
@harshalgajjar
harshalgajjar merged commit f02d59c into main Oct 6, 2026
6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant