Skip to content

fix: parse --https_server_port for Antigravity 2.0 detection#196

Merged
Finesssee merged 2 commits into
nesszer:mainfrom
Ch1nYu:fix/antigravity-https-server-port
Jul 17, 2026
Merged

fix: parse --https_server_port for Antigravity 2.0 detection#196
Finesssee merged 2 commits into
nesszer:mainfrom
Ch1nYu:fix/antigravity-https-server-port

Conversation

@Ch1nYu

@Ch1nYu Ch1nYu commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Parse --https_server_port in addition to --extension_server_port
when detecting the Antigravity language server process.

Antigravity 2.0 no longer passes --extension_server_port — it uses
--https_server_port 0 instead. The old regex only matched the former,
causing process detection to fail even though the server is running
and has valid CSRF tokens.

Changes

  • Added HTTPS_PORT_RE fallback regex for --https_server_port
  • Made extension_port optional (Option<u16>)
  • Updated find_api_port to skip heuristic window when port is None or 0
  • All existing tests updated; 2 new tests added

Fixes #192

Validation

  • cargo test -p codexbar antigravity — 9 passed
  • cargo test -p codexbar — 590 passed, 1 pre-existing failure (PTY env, unrelated)
  • cargo tauri build — success
  • Live: codexbar diagnose --provider antigravity → auth.configured: true, 11 model windows
  • Live: codexbar usage --provider antigravity → Plan: Pro, usage tracking works

Assisted by AI
image

Antigravity 2.0 language_server.exe uses --https_server_port instead
of --extension_server_port. The old regex only matched the latter,
causing process detection to fail even though the server is running
and has valid CSRF tokens.

Add HTTPS_PORT_RE fallback regex and make extension_port optional
so detection works with both old and new argument formats.

Fixes nesszer#192
@Finesssee

Copy link
Copy Markdown
Collaborator

Thanks for the PR, I will review this ASAP.

@Finesssee

Copy link
Copy Markdown
Collaborator

P2: The new fallback only matches the space-separated spelling --https_server_port VALUE. Antigravity/Chromium-style command lines may also emit --https_server_port=VALUE; in that form extension_port remains None, so the heuristic window is skipped and detection depends entirely on Get-NetTCPConnection or the hard-coded ports. Please accept both spellings and add a regression test for the equals form (including a nonzero value), ideally through one shared argument parser.

Use one flag_re helper for all --csrf_token, --extension_server_*
and --https_server_* args so the parser accepts both
--flag VALUE and --flag=VALUE spellings (e.g. Chromium-style).
Antigravity 2.0 may emit the = form, which previously left
extension_port None and fell through to heuristic probing.

Add regression test for --csrf_token=... --https_server_port=...
@Ch1nYu

Ch1nYu commented Jul 15, 2026

Copy link
Copy Markdown
Author

Thanks for the catch. Pushed a follow-up commit that:

  1. Adds --flag=VALUE support to the parser via a shared flag_re helper
  2. Refactors all four CSRF/port regexes through one shared function
  3. Adds a regression test (parses_equals_form_args) covering the = form for both --csrf_token and --https_server_port

@Finesssee Finesssee 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.

Approved — thermo-nuclear + ponytail review

Core fix for #192 is sound: Antigravity 2.0 no longer emits --extension_server_port; requiring it made detection return NotInstalled before PID port probe. CSRF-sufficient detection, optional port, --https_server_port (incl. =value), and tests match the failure mode.

Optional follow-ups (non-blocking):

  1. Normalize 0 → None at parse time so “no useful seed port” is not both None and Some(0).
  2. Restore compile-once (OnceLock) or a non-regex flag_value() scan instead of rebuilding Regex on every parse_process_info.

Ponytail: ~8 lines shaveable; not a merge blocker.

Ship.

@Finesssee
Finesssee merged commit f6bcee8 into nesszer:main Jul 17, 2026
2 checks passed
@Ch1nYu
Ch1nYu deleted the fix/antigravity-https-server-port branch July 17, 2026 07:38
@Ch1nYu

Ch1nYu commented Jul 17, 2026

Copy link
Copy Markdown
Author

Thanks for the review and the suggestions! I'll follow up on the normalization and OnceLock improvements.

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.

[Bug]: Antigravity detection fails when language_server.exe has no --extension_server_port argument

2 participants