Repository navigation
Conversation
The Electron shell is gone (#7), so nothing writes ~/Library/Application Support/llm-usage-tracker/server-port anymore. Remove the hook's port-file probe, its short-timeout/stale-file cleanup branch, and the Electron comments. Local discovery is now :3789 (DOCKER_MONITOR_PORT) then :3000, each with the same 3s budget as before; MONITOR_URL and the edge shipper are untouched. Also drop the README tip about deleting the leftover port file, which no longer affects the hook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9bc0a5fa0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def read_candidate_ports(): | ||
| """Yield (port, from_file) pairs. from_file marks the server-port entry: | ||
| it is the least trustworthy candidate — Electron killed with SIGKILL used | ||
| to leave it pointing at an orphaned server that accepts TCP but never | ||
| answers HTTP, so it gets a shorter timeout and stale-file cleanup below.""" | ||
| ports = [] | ||
| try: | ||
| with open(PORT_FILE) as f: | ||
| ports.append((int(f.read().strip()), True)) | ||
| except (OSError, ValueError): | ||
| pass | ||
| ports.append((int(os.environ.get("DOCKER_MONITOR_PORT", "3789")), False)) | ||
| ports.append((3000, False)) | ||
| seen, out = set(), [] | ||
| for p, from_file in ports: | ||
| if p not in seen: | ||
| seen.add(p) | ||
| out.append((p, from_file)) | ||
| return out | ||
| """Local tracker ports to try: the Docker hub, then a `next dev` server.""" | ||
| ports = [int(os.environ.get("DOCKER_MONITOR_PORT", "3789")), 3000] | ||
| return list(dict.fromkeys(ports)) |
There was a problem hiding this comment.
Remove the remaining port-file discovery claim
After this change the hook only tries DOCKER_MONITOR_PORT and port 3000, but the primary hook-setup documentation in README.md:163 still says it also discovers a leftover legacy port file. Users following that section may expect an Electron/legacy instance on a dynamic port to receive events when it no longer can, so update that remaining description alongside the other documentation changes.
Useful? React with 👍 / 👎.
Follow-up to #7, which retired the Electron shell but left
hooks/alone.What changed
hooks/agent-monitor-hook.py: removed theserver-portfile probe, its 0.75s budget, the delete-on-ConnectionRefusedstale-file cleanup, and the comments about SIGKILLed Electron and unclean exits.read_candidate_ports()now returns[DOCKER_MONITOR_PORT or 3789, 3000]with duplicates removed.hooks/claude-hooks-config.json:_commentno longer mentions the Electron port file.README.md: dropped the troubleshooting tip about deleting the leftover port file. The hook no longer reads it, so the tip doesn't apply.Unchanged
DOCKER_MONITOR_PORT) and :3000, posting to every listening instance with the same 3s timeout.MONITOR_URLoverride path (HTTP/HTTPS, bounded post).hooks/edge-hook.sh,edge/), not touched.Testing
Run against the Docker hub on :3789 (
/api/live→ 200; nothing on :3000; no port file present):All 7 events show up in
GET /api/monitor/eventsunderhook-smoke-test. AMONITOR_URL=http://127.0.0.1:3789Stop event also arrived.grep -rni electron hooks/comes back empty.🤖 Generated with Claude Code