Skip to content

fix(triage): remove 500-char cap on verdict summary - #60

Merged
chrisleekr merged 2 commits into
mainfrom
fix/triage-summary-uncapped
Apr 26, 2026
Merged

fix(triage): remove 500-char cap on verdict summary#60
chrisleekr merged 2 commits into
mainfrom
fix/triage-summary-uncapped

Conversation

@chrisleekr

@chrisleekr chrisleekr commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Description

Drops the artificial .max(500) constraint on verdict.summary in the triage workflow. A real triage may need to cite multiple claims, reproductions, and evidence to honestly convey the verdict — capping the summary to 500 chars forced the agent to either truncate analysis or, as observed in production, overflow the cap and have a $1.15 / 21-turn run thrown away by post-validation.

The schema already supports detail elsewhere (TRIAGE.md is the full uncapped report, reproduction.details allows 2000 chars, structured evidence[] is unbounded). The 500-char cap on summary was the only field standing between a successful agent run and a failed outcome on cosmetic overflow.

Prompt template and stale comment updated to match the loosened schema.

Before

flowchart LR
  Agent["Agent writes<br/>TRIAGE_VERDICT.json"]:::work
  Schema["verdictSchema<br/>summary.max=500"]:::gate
  Outcome["outcome=failed<br/>$1.15 of work discarded"]:::fail
  Agent --> Schema --> Outcome
  classDef work fill:#1f4e79,color:#ffffff,stroke:#0b2545
  classDef gate fill:#8b1d1d,color:#ffffff,stroke:#3b0a0a
  classDef fail fill:#5a0f0f,color:#ffffff,stroke:#220000
Loading

After

flowchart LR
  AgentNew["Agent writes<br/>TRIAGE_VERDICT.json"]:::work
  SchemaNew["verdictSchema<br/>summary length unbounded"]:::ok
  OutcomeNew["outcome=succeeded<br/>verdict + report posted"]:::pass
  AgentNew --> SchemaNew --> OutcomeNew
  classDef work fill:#1f4e79,color:#ffffff,stroke:#0b2545
  classDef ok fill:#1b5e20,color:#ffffff,stroke:#0a2e0d
  classDef pass fill:#0d3d12,color:#ffffff,stroke:#001a04
Loading

Related Issues

  • Refs production triage failure on chrisleekr/github-app-playground#16 (run 34e361c2-9e9a-433d-b419-f7568221923d) where the agent produced a valid VALID verdict (confidence 0.9) but the post-run validator rejected TRIAGE_VERDICT.json with summary too_big — expected ≤500 characters.

Testing

  • Typecheck passes (bun run typecheck)
  • Lint passes (bun run lint — 0 errors, only pre-existing warnings unrelated to this change)
  • No new tests added — this is a constraint relaxation; existing schema tests continue to validate all other invariants (min(1), structured fields, recommendedNext enum, etc.)
  • Manual re-trigger of triage on issue fix(pipeline): agent timeout never aborts SDK query, leaking tokens and breaking daemon cancel #16 to confirm the previously-failing run now succeeds

Notes for reviewer

  • Downstream consequence (intentional): summary is interpolated into the tracking-comment reason line as triage rejected as invalid: ${verdict.summary}. With the cap removed, that line may now span multiple paragraphs. It still renders as valid markdown. If a one-liner headline becomes valuable for log/UI purposes later, the right fix is a separate headline field — not re-imposing a cap on summary.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Relaxed character and formatting constraints on triage verdict summaries, allowing more detailed and flexible feedback.

A real triage may need to cite multiple claims, reproductions, and
evidence to honestly convey the verdict. Capping summary at 500 chars
forced the agent to truncate analysis or, as observed in production
on issue #16, overflowed the cap and discarded a $1.15 / 21-turn run.

Detail is unaffected: TRIAGE.md remains uncapped, reproduction.details
keeps its 2000-char allowance, and evidence[] is structured. Prompt
template and a stale comment are aligned with the loosened schema.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@chrisleekr has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 13 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 13 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83bb92e3-6677-4b2e-a82f-336770089206

📥 Commits

Reviewing files that changed from the base of the PR and between b90d522 and d84b4db.

📒 Files selected for processing (1)
  • docs/BOT-WORKFLOWS.md
📝 Walkthrough

Walkthrough

The summary field validation in the triage verdict was relaxed: the maximum 500-character limit and newline constraints were removed, allowing unbounded-length summaries. The triage agent prompt was updated to reflect this new format requirement, and an inline comment was updated to clarify the handler's use of the verdict summary for failure reasons.

Changes

Cohort / File(s) Summary
Triage Verdict Schema & Handler
src/workflows/handlers/triage.ts, TRIAGE_VERDICT.json
Removed 500-character maximum and newline restrictions on summary field; updated triage agent prompt to permit unbounded-length strings; clarified inline comment about failure reason handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 No more chains on words so long,
The summaries now sing their song,
Newlines flow and length runs free,
Triage verdicts let words be—
A rabbit's cheer for constraints released! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(triage): remove 500-char cap on verdict summary' directly and clearly describes the main change: removing the 500-character maximum constraint on the verdict summary field in the triage workflow.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/triage-summary-uncapped

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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/workflows/handlers/triage.ts (2)

74-74: Schema relaxation looks fine; consider a sanity ceiling for downstream comment safety.

Removing .max(500) is well-motivated by the cited incident. One thing to keep in mind: verdict.summary is interpolated into result.reason at line 188 (triage rejected as invalid: ${verdict.summary}), and per src/workflows/orchestrator.ts:74-91 that reason is embedded verbatim into the parent run's humanMessage, which becomes a GitHub comment. GitHub enforces a 65,536-character limit on issue/PR comment bodies, so a pathologically long agent-produced summary could now cause the parent "ship halted…" comment to be rejected by the API.

In practice this is unlikely with current agent behavior, but since the only guardrail has been removed, you may want either:

  • a generous defensive cap (e.g. .max(20_000)) purely to protect downstream surfaces, or
  • a truncation step when composing reason (and orchestrator humanMessage) rather than at the schema layer.

Per the PR description, a separate headline field is the preferred long-term answer; this is just a near-term safety net.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/workflows/handlers/triage.ts` at line 74, Add a defensive ceiling to the
verdict summary to prevent extremely large GitHub comments: in
src/workflows/handlers/triage.ts constrain verdict.summary (the z.string()
schema) with a generous .max(20000) so that when it is interpolated into
result.reason (used by orchestrator.ts to build the parent run humanMessage) it
cannot exceed GitHub's comment size and risk rejection; alternatively, if you
prefer not to change the schema, ensure truncation of verdict.summary before
composing result.reason in the same triage handler (truncate to ~20k chars and
append an ellipsis) so orchestrator.ts receives a bounded humanMessage.

320-320: Prompt guidance is now open-ended — consider a soft length hint.

The new instruction "<as long as needed to faithfully convey the verdict>" removes any size guidance for the agent. Since summary is meant to be a verdict headline that gets embedded into the parent ship comment (line 188 → orchestrator parent humanMessage), it may be worth nudging the agent toward, e.g., "1–3 sentences; place longer reasoning in TRIAGE.md" so the field stays useful as a one-glance reason while remaining uncapped at the schema level. The TRIAGE.md template at lines 297–298 already calls for "one-paragraph summary", so the JSON instruction is now slightly out of step with the markdown instruction.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/workflows/handlers/triage.ts` at line 320, Update the open-ended JSON
prompt guidance for the "summary" field to include a soft length hint (e.g.,
"1–3 sentences; place longer reasoning in TRIAGE.md") so that the generated
verdict remains a concise one-glance headline; modify the string used for the
"summary" instruction in triage.ts (the `"summary": "<as long as needed to
faithfully convey the verdict>"` entry) to include this hint and ensure it
references TRIAGE.md's one-paragraph guidance and the orchestrator's parent
humanMessage so the instructions stay consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/workflows/handlers/triage.ts`:
- Line 74: Add a defensive ceiling to the verdict summary to prevent extremely
large GitHub comments: in src/workflows/handlers/triage.ts constrain
verdict.summary (the z.string() schema) with a generous .max(20000) so that when
it is interpolated into result.reason (used by orchestrator.ts to build the
parent run humanMessage) it cannot exceed GitHub's comment size and risk
rejection; alternatively, if you prefer not to change the schema, ensure
truncation of verdict.summary before composing result.reason in the same triage
handler (truncate to ~20k chars and append an ellipsis) so orchestrator.ts
receives a bounded humanMessage.
- Line 320: Update the open-ended JSON prompt guidance for the "summary" field
to include a soft length hint (e.g., "1–3 sentences; place longer reasoning in
TRIAGE.md") so that the generated verdict remains a concise one-glance headline;
modify the string used for the "summary" instruction in triage.ts (the
`"summary": "<as long as needed to faithfully convey the verdict>"` entry) to
include this hint and ensure it references TRIAGE.md's one-paragraph guidance
and the orchestrator's parent humanMessage so the instructions stay consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0307942b-d574-4876-ab6a-7a3e2a69a73b

📥 Commits

Reviewing files that changed from the base of the PR and between b90a9fc and b90d522.

📒 Files selected for processing (1)
  • src/workflows/handlers/triage.ts

…hema

Removes the "one-paragraph" framing — summary is now uncapped and may
span multiple paragraphs when the verdict honestly requires it. Notes
where the field is interpolated downstream so future readers know why
length matters.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@chrisleekr
chrisleekr merged commit ed3c657 into main Apr 26, 2026
12 checks passed
@chrisleekr
chrisleekr deleted the fix/triage-summary-uncapped branch April 26, 2026 04:10
chrisleekr pushed a commit that referenced this pull request Apr 26, 2026
## [1.3.2](v1.3.1...v1.3.2) (2026-04-26)

### Bug Fixes

* **triage:** remove 500-char cap on verdict summary ([#60](#60)) ([ed3c657](ed3c657))
@chrisleekr

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.3.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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