Repository navigation
Open
Description
Environment:
- macOS 27 (Apple Silicon), zsh
- agy 1.2.11 (installed via mise,
AGY_CLI_DISABLE_AUTO_UPDATE=true) - agy-reader: latest (supports agy 1.2.11 per COMPATIBILITY.md)
Summary:
On macOS, watch mode cannot authenticate against the CLI daemon. The 1.2.11 CSRF token discovery documented in the README relies on Linux /proc (reading the sidecar process environment / argv), which doesn't exist on macOS, so there appears to be no working discovery path here. Every tick fails with:
[cli] watch: authentication failed; sync blocked, retrying discovery next tick
(LoadTrajectory: daemon authentication failed: HTTP 401 on LoadTrajectory
(check CSRF token discovery or ANTIGRAVITY_CSRF_TOKEN))
Additional macOS-specific observations:
- Process name truncation: the daemon's listener shows up in
lsofasantigravi(truncated fromantigravity-style name), notagy, so any name-based matching (lsof | grep agy) misses it. Matching by PID (pgrep -x agy→lsof -p <pid>) works reliably. - Two ports, roles observable: the daemon listens on two ports; the lower-numbered one speaks HTTPS (returns 400 "Client sent an HTTP request to an HTTPS server" when probed over http://), the higher-numbered one is the plain-HTTP JSON-RPC endpoint. A
curl http://127.0.0.1:<port>/probe can distinguish them automatically. - Token not discoverable from the environment:
ps ewwon the main agy process shows noANTIGRAVITY_CSRF_TOKEN; macOS also restricts reading other processes' environments.
Workaround (currently working for me):
Start agy with an explicit token and pass it through a file:
# terminal A
TOKEN="$(uuidgen)"
echo "$TOKEN" > ~/.agy-session
agy --csrf_token="$TOKEN"
# terminal B
TOKEN="$(head -1 ~/.agy-session)"
PID=$(pgrep -x agy | head -1)
PORT=$(lsof -iTCP -sTCP:LISTEN -anP -p "$PID" 2>/dev/null \
| grep '(LISTEN)' | awk '{print $9}' | sed 's/.*://' | sort -un | tail -1)
export ANTIGRAVITY_CSRF_TOKEN="$TOKEN"
export ANTIGRAVITY_DAEMON_URL="http://127.0.0.1:$PORT"
agy-reader --watchFeature request:
- Support macOS for CSRF token discovery — e.g. accept
agy --csrf_token=<user-supplied>sessions, or document the manual workaround in the README for non-Linux platforms. - Auto-detect the HTTP endpoint among the daemon's ports (curl probe / distinguish HTTPS vs HTTP), rather than assuming port ordering.
References
Metadata
Metadata
Assignees
Labels
No labels
Activity
mjacobs commentedon Oct 27, 2026
Thanks for the detailed report. I reproduced the authentication failure on macOS 27.0.1 (Apple Silicon), using agy 1.4.0 and a fresh agy-reader build from
mainate3d9580.The reader found the correct HTTP endpoint, but discovered no token, and
LoadTrajectoryreturned HTTP 401. Starting agy with--csrf_tokenalone did not fix discovery. Passing that same token to the reader throughANTIGRAVITY_CSRF_TOKENmade authentication succeed.The current CLI token-discovery implementation is Linux-only, so this remains an open macOS support gap. There are two options available now:
For transcript exports from supported SQLite sessions, the newer offline command bypasses daemon authentication entirely:
It does not require a running agy process or a CSRF token. It exports one session; it does not provide continuous watch/sync or write sync sidecars. Legacy encrypted
.pbfiles and unsupported SQLite projections are not supported.For watch/sync, the pair helper launches agy and the reader together, supplying a matching token and HTTP endpoint:
I verified that its default
argvmode authenticated successfully and started the watcher on macOS. That test used an empty temporary store, so it confirms authentication and watcher startup, not conversation-sync completeness. This mode puts the token in agy’s process arguments; use it only on a single-user machine.I also confirmed separate HTTP and HTTPS listeners. The reader’s log fallback selects the port explicitly logged as
for HTTP, rather than relying on port ordering. I did not reproduce the truncated process name in this environment.Keeping this issue open: these options provide ways forward, but standalone macOS CLI token discovery remains unfixed.
mjacobs commentedon Nov 18, 2026
Thanks for reporting the 401 and pointing out the separate HTTP and HTTPS listeners. The macOS fix is now on
mainin #14. Run these commands from your checkout to try it.Run plain
agyand, in a separate terminal under the same macOS account, run./bin/agy-reader --watchfrom the checkout. The first sync can wait until agy runs a readable external tool, such as a shell command. Short commands can finish between polls. I used--watch-interval=2sfor the test. Once the watcher discovers the credential, it can sync later text-only turns after the tool exits. A freshdoctorprocess needs a running tool to check daemon authentication.I verified this on Apple Silicon with agy 1.5.10. The watcher saved a verified transcript from a fresh conversation, then synced a later text-only turn.
./bin/agy-reader doctor --root "$HOME/.gemini/antigravity-cli"reported the CLI store healthy while the tool was active. The README covers troubleshooting and launchd setup.