Skip to content

feat: detect competing compression plugins during init - #86

Merged
getappz merged 1 commit into
masterfrom
feat/compression-conflicts
Jul 7, 2026
Merged

feat: detect competing compression plugins during init#86
getappz merged 1 commit into
masterfrom
feat/compression-conflicts

Conversation

@getappz

@getappz getappz commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • The initialization flow now checks for potential plugin conflicts and warns you if it finds signs of a competing plugin in your configuration.
    • Conflict scanning can be skipped by setting an environment flag.

- Add check_competing_plugins() called at start of agentflare init
- Scans agent config files for lex-temple, cc-md markers
- Emits warning to stderr when competitor detected
- AGENTFLARE_IGNORE_CONFLICTS=true to suppress
- Closes ponytail PR audit ticket #72
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a3c2738c-217b-4185-b27d-54b82d37f258

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

Adds a preflight conflict check to the init flow in src/init.rs. A new check_competing_plugins function scans agent configuration files for known competitor plugin markers, warning on stderr if found, and can be disabled via an environment variable.

Changes

Competing plugin conflict detection

Layer / File(s) Summary
Conflict detection wiring and scanning logic
src/init.rs
run(agent, yes) now calls check_competing_plugins(agent) before component wiring; new helpers check_competing_plugins and scan_agent_configs read agent-specific config files, lowercase content, match against a fixed list of competitor markers, and skip scanning when AGENTFLARE_IGNORE_CONFLICTS is set.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing the required Summary, Test plan, and Notes for reviewers sections from the template. Rewrite the description using the template headings and add the test plan plus reviewer notes for risks and backward compatibility.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely describes the init-time detection of competing plugins, which is the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/compression-conflicts

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/init.rs (2)

436-441: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Substring marker matching can false-positive.

Matching markers via lower.contains(m) on the raw lowercased config content means any incidental substring (e.g. a path segment or comment containing "cc-md") triggers the warning, even without an actual competing plugin installed. Given this is only a warning (not a hard failure) the risk is low, but a more targeted check (e.g. looking for the marker as a JSON key/value or word-bounded match) would reduce noise.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/init.rs` around lines 436 - 441, The marker check in the config scan is
too broad because `lower.contains(m)` on raw content can match incidental
substrings and produce false warnings. Update the logic in `src/init.rs` around
the `read_to_string`/`markers.iter().any(...)` block to use a more targeted
match, such as word-bounded or JSON key/value-aware detection, so only actual
plugin markers trigger the warning.

406-420: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Redundant work: env var and file reads repeated per competitor.

AGENTFLARE_IGNORE_CONFLICTS is checked inside scan_agent_configs, which is called once per competitor entry — so the env var lookup and (on a hit) the config file read happen multiple times per init call instead of once. Hoisting the AGENTFLARE_IGNORE_CONFLICTS check and the config-file read up into check_competing_plugins (reading each relevant config file once, then matching all competitor markers against the cached content) avoids the duplicate I/O.

♻️ Sketch of hoisting the read/env-check
 fn check_competing_plugins(agent: &str) {
+    if std::env::var("AGENTFLARE_IGNORE_CONFLICTS").is_ok() {
+        return;
+    }
     let competitors: &[(&str, &[&str])] = &[
         ("lex-temple", &["lex-temple", "lex_temple"]),
         ("cc-md", &["cc-md", "cc_md"]),
     ];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/init.rs` around lines 406 - 420, The repeated env-var lookup and
config-file reads happen because check_competing_plugins calls
scan_agent_configs once per competitor. Hoist the AGENTFLARE_IGNORE_CONFLICTS
check into check_competing_plugins, read each relevant config file only once,
cache its contents, and then match all competitor markers against that cached
content before emitting the warning. Keep the existing scan_agent_configs
behavior only if needed elsewhere, but avoid per-competitor I/O in
check_competing_plugins.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/init.rs`:
- Around line 436-441: The marker check in the config scan is too broad because
`lower.contains(m)` on raw content can match incidental substrings and produce
false warnings. Update the logic in `src/init.rs` around the
`read_to_string`/`markers.iter().any(...)` block to use a more targeted match,
such as word-bounded or JSON key/value-aware detection, so only actual plugin
markers trigger the warning.
- Around line 406-420: The repeated env-var lookup and config-file reads happen
because check_competing_plugins calls scan_agent_configs once per competitor.
Hoist the AGENTFLARE_IGNORE_CONFLICTS check into check_competing_plugins, read
each relevant config file only once, cache its contents, and then match all
competitor markers against that cached content before emitting the warning. Keep
the existing scan_agent_configs behavior only if needed elsewhere, but avoid
per-competitor I/O in check_competing_plugins.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c21b5c44-5bdc-4b9b-835c-43a8678d9f5c

📥 Commits

Reviewing files that changed from the base of the PR and between 05263fa and a8ba200.

📒 Files selected for processing (1)
  • src/init.rs

@getappz

getappz commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@getappz
getappz merged commit 615d7bc into master Jul 7, 2026
8 checks passed
@getappz
getappz deleted the feat/compression-conflicts branch July 7, 2026 18:38
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant