fix(git-shim): neutralize process-tree agent detection for human_shim tests - #559
Conversation
…tests agent_invocation_detected() delegates to agent_detector::is_agent(), compiled with the process-tree feature, which walks ancestor processes for agent markers. human_shim only stripped known agent env vars, so tests run under an agent-driven session (opencode/claude/cursor) still got detected as agent-invoked and failed their human-path assertions. Add AGENTFLARE_GIT_ASSUME_HUMAN as a test-only short-circuit in agent_invocation_detected(), set by human_shim. Agentflare-Agent: claude-code Agentflare-Branch: worktree-fix-human-shim-process-tree
… trio Comment lived only in classify.rs; co-locate a pointer here so anyone scanning main.rs's env-var block sees the human-detection override too. Agentflare-Agent: claude-code Agentflare-Branch: task/502-git-shim-agent-vs-human-tests-fail-under Agentflare-Item: 502
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 30 minutes Limit details: You’ve used the included review currently available. Your 60 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Comment |
Fixes
cargo test -p flare-git-shimfailing 3 tests whenever run under an agent-driven session (opencode/claude-code/cursor), becauseflare-git-coreis compiled withagent-detector'sprocess-treefeature: detection walks ancestor processes for agent markers, a signal no env var can strip. Thehuman_shimtest helper only stripped known agent env vars, so its "human" assertions failed under an agent session even though the code path being exercised was correct.Adds
AGENTFLARE_GIT_ASSUME_HUMAN: when set non-empty,classify::agent_invocation_detected()short-circuits tofalsebefore either the process-tree walk or the env-var check runs. Test-only escape hatch —human_shimnow sets it.This continues WIP already committed on the branch (I claimed it from opencode since it was stalled). Verified:
cargo build -p flare-git-core -p flare-git-shimclean,cargo fmt --checkclean,cargo clippy --tests -- -A unsafe_code -A clippy::pedantic -D warningsclean, and the fullflare-git-shimsuite (30/30) passes — including the exact 3 tests this item named as flaky (canonical_repo_detach_is_denied_for_agent_invocation_but_not_human,protected_branch_checkout_is_denied_for_agent_but_passes_through_for_a_human,push_of_default_branch_is_denied_for_agent_but_passes_through_for_a_human), run live under this claude-code session where they previously would have failed.Opened by
claude-codeon flared:c997d745ae66 for item #502 via agentflare.