Skip to content

Comments

refactor: extract shared truncateToolResult utility#13

Merged
KernelCode merged 1 commit intomainfrom
auto-improve-1771543823
Feb 20, 2026
Merged

refactor: extract shared truncateToolResult utility#13
KernelCode merged 1 commit intomainfrom
auto-improve-1771543823

Conversation

@KernelCode
Copy link
Owner

Summary

  • Extracted duplicated tool-result truncation logic (MAX_RESULT_LENGTH, LARGE_FIELDS, _truncateResult) from both agent.js and worker.js into a shared src/utils/truncate.js utility
  • Both OrchestratorAgent and WorkerAgent now delegate to truncateToolResult() — single source of truth
  • Zero behavior change; purely structural DRY refactoring

Test plan

  • Verify bot starts without import errors
  • Send a message that triggers a worker task and confirm tool results are still truncated correctly
  • Check logs for any truncation-related errors

🤖 Generated with Claude Code

…tion

Both OrchestratorAgent (agent.js) and WorkerAgent (worker.js) had identical
copies of MAX_RESULT_LENGTH, LARGE_FIELDS, and _truncateResult(). This extracts
the logic into src/utils/truncate.js — a single source of truth that both
classes now delegate to.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@KernelCode KernelCode merged commit dad8263 into main Feb 20, 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