Skip to content

fix(work): comment posting must never dump unbounded raw output — summary only, large content goes to mcp__flare__asset - #444

Merged
getappz merged 3 commits into
masterfrom
task/81
Aug 11, 2026
Merged

fix(work): comment posting must never dump unbounded raw output — summary only, large content goes to mcp__flare__asset#444
getappz merged 3 commits into
masterfrom
task/81

Conversation

@getappz

@getappz getappz commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Committed as 3cb83f9.

Summary

Root cause confirmed: parse_claude_reply's fallback (work.rs) returned the entire raw captured stdout unbounded whenever a headless Claude Code run's last line wasn't the expected {"result": ...} JSON shape, and format_success_comment embedded that unbounded reply directly into the item comment — this is exactly what produced item #78's 1,068,249-char comment thread.

Fix:

  • Added cap_reply_for_comment(mcp, item_id, reply) in src/cli/work.rs, called just before format_success_comment in execute_work's success branch.
  • Size cap chosen: reused agent_launch::DIAGNOSTIC_TAIL_CHARS (2000 chars) rather than inventing a new constant — same precedent the failure-diagnostic path already uses (tail-only, capped). Made it and tail_str pub(crate) so both paths share one definition.
  • Content within budget is posted unchanged. Anything larger is staged to ~/.agentflare/staging/ and attached to the item via asset_impl (action=attach) — the same mechanism mcp__flare__asset exposes — and the comment carries only a bounded tail preview plus a pointer to the asset id (fetch via mcp__flare__asset action=get id=...).
  • Checked release_and_comment/notify: their failure-message input is already bounded via diagnostic_suffix's existing 2000-char cap, so no change was needed there — confirmed by tracing every caller.
  • Left item_done's summary (PR body) untouched — out of scope per the task's explicit instruction not to conflate with [ponytail#303] Log errors to stderr, never swallow silently #70/[ponytail#99] Bare /ponytail reports active mode, doesn't reset #75.

Tests added (both pass):

  • cap_reply_for_comment_leaves_a_reply_within_budget_unchanged — small replies pass through untouched, no I/O.
  • cap_reply_for_comment_offloads_an_oversized_reply_to_a_retrievable_asset — feeds a 450KB raw string (item [ponytail#523] Numbered review and audit findings in output #78's shape), asserts the comment body stays far under the raw size, and verifies the full original content is byte-for-byte retrievable via the attached asset.

Full cargo build, and cargo test for cli::work:: (29 tests) and agent_launch:: (23 tests) all pass — 52/52.

… asset

parse_claude_reply's fallback returns the entire raw captured stdout when a
headless run's last line isn't the expected {"result": ...} JSON shape, and
format_success_comment embedded that unbounded. Item #78 hit a 1,068,249-char
comment thread this way from a stream-json transcript with no valid trailing
result line.

cap_reply_for_comment now caps the reply to DIAGNOSTIC_TAIL_CHARS (reusing
agent_launch's existing tail-only-capped-diagnostic constant/helper) before
it reaches the comment; anything over budget is staged in
~/.agentflare/staging/ and attached to the item as a versioned asset via
asset_impl, with the comment carrying a bounded tail preview plus a pointer
to the asset instead of the raw dump. release_and_comment's failure path was
already bounded the same way via diagnostic_suffix, so it needed no change.

Agentflare-Agent: claude-code
Agentflare-Branch: task/81
Agentflare-Item: 81
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 58 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

Run ID: f5c81af8-35ef-4da9-8589-438019375c13

📥 Commits

Reviewing files that changed from the base of the PR and between 8b10834 and e96b444.

📒 Files selected for processing (2)
  • src/agent_launch.rs
  • src/cli/work.rs

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

@getappz
getappz enabled auto-merge (squash) August 11, 2026 12:04
@getappz
getappz merged commit 74280be into master Aug 11, 2026
16 checks passed
@getappz
getappz deleted the task/81 branch August 11, 2026 12:17
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