Skip to content

fix: close ponytail parity gaps from upstream PR audit (#61) - #96

Merged
getappz merged 2 commits into
masterfrom
fix/ponytail-upstream-parity-issue-61
Jul 8, 2026
Merged

fix: close ponytail parity gaps from upstream PR audit (#61)#96
getappz merged 2 commits into
masterfrom
fix/ponytail-upstream-parity-issue-61

Conversation

@getappz

@getappz getappz commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the remaining gaps identified in #61 (audit of ponytail upstream PRs relevant to this Rust port). Of the 18 items audited, 10 were already done and 1 (CRLF handling in #3) doesn't apply to this port. This PR addresses the rest:

Note on #11/#16/#18: this wording previously existed only in a dead fallback_instructions() function in instructions.rs that build() never called, so it never reached the live skill. Moved the content into the actually-shipped skill.md and deleted the dead function rather than let it keep drifting out of sync.

Test plan

  • cargo build --workspace
  • cargo test --workspace (all 272 tests pass, including new coverage for the report/deconfliction/no-hallucination-skill behavior)
  • cargo clippy --workspace --all-targets — no new warnings introduced by this change

Summary by CodeRabbit

  • New Features

    • Added a new No Hallucination mode, selectable via /ponytail-no-hallucination.
    • Expanded and clarified the in-app guidance for using only reality-checked, supported APIs.
  • Bug Fixes

    • Improved detection of conflicting compression/persona plugins and now displays a coexistence warning when detected.
    • Hook output now reports the active Ponytail mode (instead of doing nothing).
    • State saving now emits warnings when persistence fails, making issues easier to notice.
  • Documentation

    • Updated the skills list text to reflect that all seven slash-command skills are included.

Addresses items 5, 7, 11, 15, 16, 18 from the issue #61 PR audit:

- Bare `/ponytail` (and `/ponytail status`) now actually reports the
  active mode via UserPromptSubmit additionalContext instead of being
  a no-op that only echoed "OK" (ponytail#99).
- Detect a compression/persona plugin (e.g. caveman) wired into the
  agent's settings.json and append a deconfliction note so ponytail's
  structural rules and the peer plugin's style rules don't read as
  contradictory (ponytail#517).
- Add a `ponytail-no-hallucination` companion skill that blocks
  invented APIs, deprecated methods, and undeclared variables
  (ponytail#504).
- Tighten the simplification-marker rule so normal/trivial code no
  longer needs a `ponytail:` comment (ponytail#491), and add an
  explicit persona-boundary rule keeping ponytail/lazy framing out of
  user-facing replies (ponytail#521).
- Both of the above were previously only written into a dead
  `fallback_instructions()` function that `build()` never called;
  moved the content into the live `skill.md` and deleted the dead
  function instead of leaving it to drift out of sync.
- Stop silently swallowing state-persistence I/O errors in
  src/state.rs — now logs to stderr on failure (ponytail#303).
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7818f339-bc86-487c-9058-cc87e6e7959d

📥 Commits

Reviewing files that changed from the base of the PR and between 9b67d44 and 5941bac.

📒 Files selected for processing (4)
  • crates/ponytail/src/config.rs
  • crates/ponytail/src/instructions.rs
  • crates/ponytail/src/skill-help.md
  • src/cli/ponytail.rs
✅ Files skipped from review due to trivial changes (1)
  • crates/ponytail/src/skill-help.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/ponytail/src/config.rs
  • crates/ponytail/src/instructions.rs

📝 Walkthrough

Walkthrough

This PR adds a new no-hallucination ponytail mode and sub-skill, detects conflicting Claude plugins from settings.json, appends a coexistence note during instruction building, updates the CLI report hook output, and changes state saving to log failures instead of ignoring them.

Changes

No-hallucination skill and plugin coexistence

Layer / File(s) Summary
Mode and plugin detection
crates/ponytail/src/config.rs
Adds "no-hallucination" to VALID_MODES, introduces Claude config path resolution and plugin detection from settings.json, and updates tests for missing settings and env-var locking.
Instruction body deconfliction
crates/ponytail/src/instructions.rs
Appends a compression/persona coexistence note to built instructions when conflicting plugins are detected, and updates tests for the new body output.
No-hallucination skill registration and docs
crates/ponytail/src/sub_skills.rs, crates/ponytail/src/switcher.rs, crates/ponytail/src/skill-no-hallucination.md, crates/ponytail/src/skill-help.md, crates/ponytail/src/skill.md
Registers the new built-in skill, recognizes its slash command, adds its documentation page and help entry, and updates persona guidance text.
CLI report output and state warnings
src/cli/ponytail.rs, src/state.rs
Changes SwitchAction::Report to emit formatted hook output with the active mode and platform, and makes state persistence warn on directory creation, serialization, and write failures.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

  • getappz/agentflare#45: Introduced the ponytail instruction-building path that this PR updates by removing fallback logic and appending deconfliction text.
  • getappz/agentflare#81: Also changes crates/ponytail/src/instructions.rs and the instruction construction flow.
  • getappz/agentflare#83: Touches the same fallback_instructions-adjacent guidance and tests that this PR replaces.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: closing ponytail parity gaps from the upstream audit.
Description check ✅ Passed The description is mostly complete and follows the template, though the Notes for reviewers section is not filled in.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ponytail-upstream-parity-issue-61

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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/ponytail/src/skill-help.md (1)

34-38: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Stale count: "all six" should be "all seven".

Adding ponytail-no-hallucination brings the skill table to seven entries, but line 38 still refers to "Claude Code and OpenCode use the slash-command forms above (OpenCode ships all six as slash commands)."

📝 Proposed fix
-Codex uses `@ponytail`, `@ponytail-review`, and `@ponytail-help`; Claude Code
-and OpenCode use the slash-command forms above (OpenCode ships all six as
-slash commands).
+Codex uses `@ponytail`, `@ponytail-review`, and `@ponytail-help`; Claude Code
+and OpenCode use the slash-command forms above (OpenCode ships all seven as
+slash commands).
🤖 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 `@crates/ponytail/src/skill-help.md` around lines 34 - 38, The documentation in
skill-help.md has an outdated slash-command count after adding
ponytail-no-hallucination. Update the sentence near the skills table so it
refers to “all seven” instead of “all six,” keeping the wording aligned with the
current set of entries and the OpenCode slash-command note.
🤖 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.

Inline comments:
In `@crates/ponytail/src/config.rs`:
- Around line 137-154: The env-mutating tests around detect_compression_plugins
are flaky because they change process-global variables like CLAUDE_CONFIG_DIR,
PONYTAIL_DEFAULT_MODE, and the new instructions.rs case while tests run in
parallel. Update each test that calls std::env::set_var/remove_var in config.rs
and the related instructions.rs test to use a shared serialization guard, such
as a mutex or #[serial], so only one env-changing test runs at a time. Keep the
fix scoped to the affected test functions so the existing behavior of
detect_compression_plugins and the other env-based checks remains unchanged.

In `@src/cli/ponytail.rs`:
- Around line 193-205: The Report branch in ponytail::SwitchAction::Report
incorrectly labels an "off" mode as active when building the ctx string. Update
this branch to mirror the existing
active_mode().unwrap_or_else(ponytail::default_mode) handling used in emit_hook
and the Statusline handler by special-casing mode == "off" before formatting the
output, so the message reflects an off state instead of "PONYTAIL MODE ACTIVE".

---

Outside diff comments:
In `@crates/ponytail/src/skill-help.md`:
- Around line 34-38: The documentation in skill-help.md has an outdated
slash-command count after adding ponytail-no-hallucination. Update the sentence
near the skills table so it refers to “all seven” instead of “all six,” keeping
the wording aligned with the current set of entries and the OpenCode
slash-command note.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ca7d3ee-8179-4c06-83f9-414796b0640e

📥 Commits

Reviewing files that changed from the base of the PR and between 312dc79 and 9b67d44.

📒 Files selected for processing (9)
  • crates/ponytail/src/config.rs
  • crates/ponytail/src/instructions.rs
  • crates/ponytail/src/skill-help.md
  • crates/ponytail/src/skill-no-hallucination.md
  • crates/ponytail/src/skill.md
  • crates/ponytail/src/sub_skills.rs
  • crates/ponytail/src/switcher.rs
  • src/cli/ponytail.rs
  • src/state.rs

Comment thread crates/ponytail/src/config.rs
Comment thread src/cli/ponytail.rs
- Report a proper off-state message instead of "PONYTAIL MODE ACTIVE
  — level: off" when the configured default mode is off; extracted
  the mode->message mapping into report_message() with unit tests.
- Serialize the env-var-mutating tests in config.rs/instructions.rs
  behind a shared ENV_TEST_LOCK mutex (mirrors PATH_LOCK in
  agent-registry) so parallel cargo test runs can't race on
  CLAUDE_CONFIG_DIR / PONYTAIL_DEFAULT_MODE.
- Fix stale "all six" skill count in skill-help.md now that
  ponytail-no-hallucination brings it to seven.
@getappz
getappz merged commit 27a1cd9 into master Jul 8, 2026
9 checks passed
@getappz
getappz deleted the fix/ponytail-upstream-parity-issue-61 branch July 8, 2026 08:07
@github-actions github-actions Bot mentioned this pull request Jul 8, 2026
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
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.

1 participant