Skip to content

review: dedup config parsing, revert claude/gemini -p - change, bump version#44

Open
kridaydave wants to merge 9 commits into
Shreyan1:mainfrom
kridaydave:review/config-dedup-and-cli
Open

review: dedup config parsing, revert claude/gemini -p - change, bump version#44
kridaydave wants to merge 9 commits into
Shreyan1:mainfrom
kridaydave:review/config-dedup-and-cli

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

Split out of PR #39 (kridaydave:fix/good-first-issues) to address review concern #4.

  • readConfig and readConfigAsync duplicated the entire YAML-ish parse body. Extract a shared parseProviderConfig() helper and have both call it, so the two paths cannot drift apart.
  • Revert the claude/gemini CLI providers from spawn('claude', ['-p', '-']) back to spawnSync('claude', ['-p', prompt]). - is a literal positional prompt to claude/gemini, not a stdin sentinel, so the stdin write/end path did not do what the comment claimed. Restoring the original positional form keeps behaviour matching the real binaries. (agy's -p - would also hang without --headless/--approve, which is why Antigravity capture is being held off entirely — see review: drop Antigravity capture wiring (keep migration detection) #41.)
  • Bump version 0.9.0 -> 0.9.1 (user-facing change per the PR checklist).

Depends on / should be merged after #41 (this branch is based on it) so providers/index.ts lands cleanly. It is otherwise independent of #42 and #43.

The other concerns (drop Antigravity #1, bounded concurrency #2, the captureDisabled cache fix #3) land in their own PRs, also split from #39.

kridaydave and others added 9 commits July 15, 2026 10:36
Part of the review split of PR Shreyan1#39 (kridaydave:fix/good-first-issues). This
PR handles concern Shreyan1#1 only.

We made a deliberate, documented call in detect.ts and the FAQ: we
intentionally do not wire Antigravity capture yet, because Google has not
published the finalized hook format, and shipping a capture path that
silently never fires would break the transparency/reliability promise in
PHILOSOPHY.md ("no half-working features dressed up to look finished").
fromAntigravity guesses the payload shape and AntigravityCliProvider guesses
`agy -p -` (which, per Google's own docs, a non-interactive agy also needs
--headless/--approve or it hangs).

Most importantly, adding antigravity to ALLOWED_ADAPTERS/HOOK_ADAPTERS to
satisfy the parity test was the part that should not land: that invariant
exists to prove every registered adapter is real and fully wired end-to-end
(install + detect + a real fixture), so including it made the test pass
without the thing it tests being true.

This removes:
- src/adapters/antigravity.ts and src/providers/antigravity-cli.ts
- the antigravity entries in ALLOWED_ADAPTERS, HOOK_ADAPTERS, PARKED_PROVIDERS
- the adapter/provider registration tests

The Antigravity *migration detection* in detect.ts stays (it only switches
the Gemini setup path to inject-only, it does not register capture hooks).

Split from Shreyan1#39; the other three concerns (bounded concurrency, the
captureDisabled cache fix, config-parse dedup) land in their own PRs.
…version

Part of the review split of PR Shreyan1#39 (kridaydave:fix/good-first-issues). This
PR handles concern Shreyan1#4 only.

- readConfig and readConfigAsync duplicated the entire YAML-ish parse body.
  Extract a shared parseProviderConfig() helper and have both call it, so the
  two paths cannot drift apart.

- Revert the claude/gemini CLI providers from `spawn('claude', ['-p', '-'])`
  back to `spawnSync('claude', ['-p', prompt])`. `-` is a literal positional
  prompt to claude/gemini, not a stdin sentinel, so the stdin write/end path
  did not do what the comment claimed. Restoring the original positional form
  keeps behaviour matching the real binaries. (agy's `-p -` would also hang
  without --headless/--approve, which is why Antigravity capture is being
  held off entirely — see the sibling Antigravity PR.)

- Bump version 0.9.0 -> 0.9.1 (user-facing change per the PR checklist).

Base is the drop-Antigravity PR so providers/index.ts lands cleanly.

Split from Shreyan1#39; the other three concerns (drop Antigravity, bounded
concurrency, the captureDisabled cache fix) land in their own PRs.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Shreyan1 Shreyan1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good cleanup. parseProviderConfig + resolveConfigPath shared between both readers so they cannot drift, and this is the only one of the four that actually bumps the version.

One real bug though, and it is a bit ironic for a "clean up config parsing" PR (inline): the comment stripper truncates any value that contains a #. I ran it against a realistic Ollama config (I have Ollama enabled locally now): ollama_url: http://user:pa#ss@localhost:11434 (an embedded credential with a #) parses to http://user:pa, so extraction would silently connect to the wrong host and fail. A plain sk-a#bc secret becomes sk-a too. The dedup lifted the naive logic into a shared helper, so now both paths corrupt it. Since you are already in here, worth fixing properly and adding a test.

Two smaller notes:

  • The PR description says it reverts the claude/gemini -p - change, but versus current main that is a no-op: main never had -p - (it was only in the #39 blob), so claude-cli.ts is not even in this diff. Nothing to do, just so the description matches reality.
  • CodeQL HIGH at storage.ts from the carried #39 base (inline). This one depends on #41, so it also carries #41's blob; once #41 is rebased and slimmed, rebase this on top.

Comment thread src/providers/index.ts
return cfg;
}
const lines = text.split('\n').map(line => {
const hashIdx = line.indexOf('#');

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is the bug: indexOf('#') strips from the first # anywhere on the line, including inside a value. Verified live against an Ollama config: ollama_url: http://user:pa#ss@localhost:11434 becomes http://user:pa, and openai_api_key: "sk-a#bc" becomes sk-a. Only treat # as a comment when it is at line-start or preceded by whitespace and outside quotes. Please add a test with a # inside a value so it cannot regress.

Comment thread src/storage.ts
return; // absent or unstattable: nothing to trim
}
if (size <= LOG_ROTATE_BYTES) return;
const st = fs.statSync(filePath);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same CodeQL HIGH TOCTOU as the other three (stat here, then readFileSync next line; carried from the #39 trimIfNeeded rewrite, not on current main). Rebasing on main drops it, or read through a single fd like readFileBytesSafe does below.

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.

cch bootstrap defaults to checking Claude sessions

2 participants