Skip to content

fix: Pipeline improvements - reasoning truncation and dead code removal#367

Merged
justn-hyeok merged 1 commit intobssm-oss:mainfrom
HuiNeng6:fix/pipeline-improvements
Mar 28, 2026
Merged

fix: Pipeline improvements - reasoning truncation and dead code removal#367
justn-hyeok merged 1 commit intobssm-oss:mainfrom
HuiNeng6:fix/pipeline-improvements

Conversation

@HuiNeng6
Copy link
Copy Markdown
Contributor

@HuiNeng6 HuiNeng6 commented Mar 27, 2026

Fix two pipeline issues:

  1. compact-formatter.ts: Add '...' when reasoning is truncated

    • Before:
      easoning.slice(0, 200) cut mid-sentence
    • After:
      easoning.slice(0, 197) + '...' when truncated
  2. auto-approve.ts: Remove dead code block

    • The maxLines check was unreachable after
      onTrivialLines > 0
    • If nonTrivialLines > 0, statsCode must also be > 0

Fixes: #306
Fixes: #307

Summary by CodeRabbit

  • Bug Fixes
    • Refined trivial change detection in the auto-approval process for improved accuracy.
    • Enhanced text truncation logic for reasoning displays to properly include ellipsis when content is truncated.

- compact-formatter.ts: Add '...' when reasoning is truncated (was cutting mid-sentence)
- auto-approve.ts: Remove dead code block (maxLines check unreachable after nonTrivialLines>0)

Fixes: #306
Fixes: #307
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

📝 Walkthrough

Walkthrough

Removed unreachable dead code from auto-approve.ts that checked for blank-lines-only diffs with maxLines conditions. Updated compact-formatter.ts to conditionally append ellipsis when reasoning text exceeds 200 characters, fixing silent truncation.

Changes

Cohort / File(s) Summary
Pipeline Logic Fixes
packages/core/src/pipeline/auto-approve.ts, packages/core/src/pipeline/compact-formatter.ts
Removed logically unreachable maxLines condition in analyzeTrivialDiff that was dead code. Updated reasoning truncation to conditionally append ellipsis only when length exceeds 200 characters, preventing silent truncation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hopping through code with a keen rabbit's sight,
Dead branches pruned—the logic shines bright!
Ellipsis now appears when words overflow,
No more silent cuts, the truncation's aglow,
The pipeline bounces cleaner with each compiler's flow! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: reasoning truncation behavior and dead code removal in pipeline files.
Linked Issues check ✅ Passed Both linked issues are addressed: #306 resolved by adding ellipsis for truncated reasoning, #307 resolved by removing unreachable maxLines code block.
Out of Scope Changes check ✅ Passed All changes directly address the linked issues with no extraneous modifications to unrelated code.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
packages/core/src/pipeline/auto-approve.ts (1)

97-99: ⚠️ Potential issue | 🟠 Major

maxLines parameter is unused and should be removed from the function signature and configuration schema.

The analyzeTrivialDiff function accepts maxLines in its config parameter, and AutoApproveConfigSchema exposes it to users, but maxLines is never referenced in the function body. The triviality determination is based solely on file patterns and content types (imports, comments, blanks), not line count limits.

This creates a dead configuration option where users can set maxLines expecting it to limit trivial diff detection, but it has no effect on behavior.

Remove maxLines from:

  • Function signature at line 99
  • AutoApproveConfigSchema in packages/core/src/types/config.ts:219
  • Template defaults in packages/core/src/config/templates.ts:104
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/pipeline/auto-approve.ts` around lines 97 - 99, The config
option maxLines is unused—remove it from the analyzeTrivialDiff function
signature (delete the maxLines property from the config param in
analyzeTrivialDiff) and update the public config types and defaults: remove
maxLines from AutoApproveConfigSchema in the config types
(AutoApproveConfigSchema) and from the template defaults in
packages/core/src/config/templates.ts (the auto-approve template block). Also
search for any callers or tests referencing maxLines and update them to stop
passing or expecting it so types and runtime remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/core/src/pipeline/auto-approve.ts`:
- Around line 97-99: The config option maxLines is unused—remove it from the
analyzeTrivialDiff function signature (delete the maxLines property from the
config param in analyzeTrivialDiff) and update the public config types and
defaults: remove maxLines from AutoApproveConfigSchema in the config types
(AutoApproveConfigSchema) and from the template defaults in
packages/core/src/config/templates.ts (the auto-approve template block). Also
search for any callers or tests referencing maxLines and update them to stop
passing or expecting it so types and runtime remain consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb4aa756-5c07-47fd-a7c4-c569087fc64f

📥 Commits

Reviewing files that changed from the base of the PR and between 1b61dac and 707a961.

📒 Files selected for processing (2)
  • packages/core/src/pipeline/auto-approve.ts
  • packages/core/src/pipeline/compact-formatter.ts

Copy link
Copy Markdown
Collaborator

@justn-hyeok justn-hyeok left a comment

Choose a reason for hiding this comment

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

LGTM! Reasoning truncation adds '...' within 200-char budget. Dead code removal verified safe.

@justn-hyeok justn-hyeok merged commit 39fd68f into bssm-oss:main Mar 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants