Skip to content

fix(git-shim): neutralize process-tree agent detection for human_shim tests - #559

Merged
getappz merged 5 commits into
masterfrom
task/502-git-shim-agent-vs-human-tests-fail-under
Aug 19, 2026
Merged

fix(git-shim): neutralize process-tree agent detection for human_shim tests#559
getappz merged 5 commits into
masterfrom
task/502-git-shim-agent-vs-human-tests-fail-under

Conversation

@getappz

@getappz getappz commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Fixes cargo test -p flare-git-shim failing 3 tests whenever run under an agent-driven session (opencode/claude-code/cursor), because flare-git-core is compiled with agent-detector's process-tree feature: detection walks ancestor processes for agent markers, a signal no env var can strip. The human_shim test 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 to false before either the process-tree walk or the env-var check runs. Test-only escape hatch — human_shim now 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-shim clean, cargo fmt --check clean, cargo clippy --tests -- -A unsafe_code -A clippy::pedantic -D warnings clean, and the full flare-git-shim suite (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-code on flared:c997d745ae66 for item #502 via agentflare.

…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
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

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.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 065f75bd-52db-45ab-a289-cef778a38f1e

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9ce62 and 69894fc.

📒 Files selected for processing (3)
  • crates/flare-git-core/src/classify.rs
  • crates/flare-git-shim/src/main.rs
  • crates/flare-git-shim/tests/shim_test.rs

Comment @coderabbitai help to get the list of available commands.

@getappz getappz changed the title git-shim agent-vs-human tests fail under any agent-driven local run (process-tree detection) fix(git-shim): neutralize process-tree agent detection for human_shim tests Aug 19, 2026
@getappz
getappz enabled auto-merge (squash) August 19, 2026 05:23
@getappz
getappz merged commit b106f1d into master Aug 19, 2026
16 checks passed
@getappz
getappz deleted the task/502-git-shim-agent-vs-human-tests-fail-under branch August 19, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant