Skip to content

fix(ponytail): Codex hook output — additionalContext at top level, not nested - #89

Merged
getappz merged 2 commits into
masterfrom
fix/codex-hook-output
Jul 7, 2026
Merged

fix(ponytail): Codex hook output — additionalContext at top level, not nested#89
getappz merged 2 commits into
masterfrom
fix/codex-hook-output

Conversation

@getappz

@getappz getappz commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the platform hook output format so session start events now include the expected system message while preserving other context.
    • Updated non-session-start event output to use a flatter structure, improving compatibility and consistency across event handling.
  • Tests
    • Added unit tests covering both session start and non-session-start output behavior for the affected platform.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@getappz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

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 for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ec7d5781-a760-4249-b3f4-008e6febe6da

📥 Commits

Reviewing files that changed from the base of the PR and between 92dcb32 and 6b44a07.

📒 Files selected for processing (1)
  • crates/ponytail/src/platform.rs
📝 Walkthrough

Walkthrough

The Codex branch of format_hook_output was modified to build a flat JSON object containing only additionalContext, replacing the previous nested hookSpecificOutput structure that included hookEventName and additionalContext.

Changes

Codex hook output format

Layer / File(s) Summary
Flatten Codex hook output JSON
crates/ponytail/src/platform.rs
The initial JSON payload for the Codex arm now starts as { "additionalContext": ctx } instead of a nested hookSpecificOutput object, with systemMessage still conditionally added for SessionStart.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks the required Summary, Test plan, and Notes for reviewers sections from the template. Add the template sections with a summary, test plan checkboxes, and reviewer notes covering risk areas and backward compatibility.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main Codex hook output change and is specific enough for history scanning.
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 fix/codex-hook-output

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

@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.

@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)
crates/ponytail/src/platform.rs (2)

36-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests locking in the new flat Codex shape.

No test appears to cover format_hook_output for AgentPlatform::Codex, particularly the non-SessionStart path (flat {"additionalContext": ctx} with no hookEventName/hookSpecificOutput) and the SessionStart path (with systemMessage). A regression test would prevent this shape from silently reverting to nested output.

🤖 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/platform.rs` around lines 36 - 42, The Codex branch in
format_hook_output currently has no regression coverage, so add tests for
AgentPlatform::Codex that lock in both shapes: the non-SessionStart case should
assert a flat JSON object with only additionalContext and no hookEventName or
hookSpecificOutput, and the SessionStart case should assert the same flat shape
plus systemMessage set to PONYTAIL:FULL. Use format_hook_output and
AgentPlatform::Codex in the test names or assertions so the coverage stays tied
to this path.

36-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Design/plan docs still describe the old nested Codex contract.

The referenced spec and plan documents show the Codex output as {"systemMessage":"...","hookSpecificOutput":{"hookEventName":"...","additionalContext":"..."}}, which no longer matches this flattened implementation. Worth a follow-up doc update so the contract docs stay authoritative.

🤖 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/platform.rs` around lines 36 - 42, The Codex output
contract has changed in AgentPlatform::Codex, but the spec/plan docs still
describe the old nested shape. Update the referenced design/plan documents to
match the current flattened output from the platform logic, using the actual
fields produced by the Codex branch (including the SessionStart systemMessage
behavior) so the docs remain authoritative.
🤖 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 `@crates/ponytail/src/platform.rs`:
- Around line 36-42: The Codex branch in format_hook_output currently has no
regression coverage, so add tests for AgentPlatform::Codex that lock in both
shapes: the non-SessionStart case should assert a flat JSON object with only
additionalContext and no hookEventName or hookSpecificOutput, and the
SessionStart case should assert the same flat shape plus systemMessage set to
PONYTAIL:FULL. Use format_hook_output and AgentPlatform::Codex in the test names
or assertions so the coverage stays tied to this path.
- Around line 36-42: The Codex output contract has changed in
AgentPlatform::Codex, but the spec/plan docs still describe the old nested
shape. Update the referenced design/plan documents to match the current
flattened output from the platform logic, using the actual fields produced by
the Codex branch (including the SessionStart systemMessage behavior) so the docs
remain authoritative.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fe968eb9-eda0-43f3-a9ea-9c685a1fb2ac

📥 Commits

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

📒 Files selected for processing (1)
  • crates/ponytail/src/platform.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 added 2 commits July 8, 2026 00:09
…t nested

- Codex CLI expects additionalContext at JSON root, not under hookSpecificOutput
- Matches upstream ponytail#508 fix
- Other platforms (Claude, Copilot, Fallback) unchanged
- Closes ponytail PR audit ticket #64
- Test non-SessionStart: flat JSON, no hookSpecificOutput or hookEventName
- Test SessionStart: includes systemMessage with additionalContext at top level
- Lock in the flattened Codex contract against regression
@getappz
getappz force-pushed the fix/codex-hook-output branch from 6b44a07 to 253dcb8 Compare July 7, 2026 18:39
@getappz
getappz merged commit 9d51869 into master Jul 7, 2026
6 of 7 checks passed
@getappz
getappz deleted the fix/codex-hook-output branch July 7, 2026 18:39
@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