fix: align detection and init behavior across implementations#5
Conversation
- Resolve equal-confidence ties to the earliest rule in all languages (Rust previously picked the last match) - Deduplicate signals when a variable matches both an exact rule and a prefix rule - Sort prefix-matched signal names in TypeScript and Python to match Rust - Include env:CLAUDE_CODE_IS_COWORK in signals when it classifies cowork - Reject option-like names in 'agenthint init' consistently (exit 2) - Share one AI_AGENT normalizer between detection and init in TypeScript - Use parent_id() instead of spawning ps to find the Rust parent pid - Cache detection rules in the Python library - Compare CLI fixture stdoutContains literally in the Node test - Build and install linux-arm64 native binaries - Guard CI against a stale Cargo.lock and update release-please to keep it in sync; pin Python in mise - Document AGENTHINT_AGENT, ordering/tie rules, REPL_ID confidence, and the Windows parent-process limitation https://claude.ai/code/session_01R7u5FuNixEbMNQiFGBBx3H
|
Warning Review limit reached
More reviews will be available in 58 minutes and 15 seconds. Learn how PR review limits work. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (19)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes from a full repo review. The headline items are cross-implementation consistency bugs: identical inputs could produce different results in the TypeScript, Python, and Rust implementations, contrary to the portable detection contract.
Cross-implementation fixes (each pinned by new shared fixtures)
max_bypicked the last maximal match, while TS/Python picked the first. WithCURSOR_AGENT=1 GEMINI_CLI=1, Rust reportedgeminiand TS/Python reportedcursor. All implementations now prefer the earliest rule in the registry.CURSOR_AGENT) was reported twice insignals. Results are now deduplicated.agenthint init --json: TS/Python printedAI_AGENT=--json(exit 0) while Rust exited 2. All CLIs now reject option-like names with the usage message and exit 2, and Rust's--help/initargument handling matches TS/Python exactly.CLAUDE_CODE_IS_COWORKclassifies the result ascowork, the classifier signal is now included insignals.Cleanups
AI_AGENTnormalizer (src/agent-names.ts) for detection andinit; removed the deadisKnownAgentbranch. Public exports unchanged.parent_id()instead of spawningpsto find the parent pid.stdoutContainsfixtures literally (matching Rust/Python) instead of as regex.Tooling and docs
ubuntu-24.04-armmatrix entry +install.shdetection).Cargo.lock, guard CI withcargo metadata --locked, and add the release-pleasecargo-workspaceplugin so version bumps keep the lockfile in sync (worth eyeballing on the next release PR)..mise.tomlsonpm run checkworks out of the box.AGENTHINT_AGENT, the ordering/dedup/tie-break contract in SPEC, theREPL_IDfalse-positive caveat, and the Windows parent-process limitation.Deliberately unchanged:
REPL_IDstill reportsisAgent: trueat 0.65 confidence — documented the threshold guidance instead of changing detection semantics.https://claude.ai/code/session_01R7u5FuNixEbMNQiFGBBx3H
Generated by Claude Code