Skip to content

feat(tui): configurable model-visible read/tool-result budgets (#5367) - #5405

Draft
Hmbown wants to merge 1 commit into
mainfrom
cursor/configurable-tool-result-limits-4b37
Draft

feat(tui): configurable model-visible read/tool-result budgets (#5367)#5405
Hmbown wants to merge 1 commit into
mainfrom
cursor/configurable-tool-result-limits-4b37

Conversation

@Hmbown

@Hmbown Hmbown commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

Self-hosted long-context DeepSeek V4 users hit conservative per-result ceilings (read 50 KiB, hidden read_file 16 KiB, tool-result context/wire 12 000 chars) and pay ~20 extra reads on a ~64 KiB file. They want optional larger individual-result budgets, not global compaction off (#5367, requested by @hxfhd).

This extends the existing [workshop] / WorkshopConfig table (already deserialized) with two optional keys. Absent keys keep today's constants via .unwrap_or.

Keys added

  • read_result_max_bytes — model-visible read / hidden read_file byte budget. Unset: read stays 50 KiB; read_file stays 16 KiB (including the small-file fast path).
  • tool_result_max_bytes — character budget for one tool result on the context path and the Chat Completions wire. Unset: 12 000 chars (48 000 on routes whose window is ≥ 500K). Setting this overrides both hard ceilings. Does not disable session compaction or change the 4K+4K excerpt.

Threaded Config → Engine / App / DeepSeekClient into compact_tool_result_for_route, compact_tool_result_for_wire, and file.rs READ_MAX_BYTES / MAX_VISIBLE_BYTES / SMALL_FILE_BYTES. HarnessProfile is unchanged (preview schema, not consumed at runtime).

Documented in docs/CONFIGURATION.md and config.example.toml.

Testing

  • cargo fmt --all -- --check (ran cargo fmt on this change)
  • cargo clippy --workspace --all-targets --all-features --locked (warning-free under the CI allow list)
  • cargo test --workspace --all-features --locked

Targeted (in progress after this draft):

  • cargo test -p codewhale-tui --lib workshop_result_budgets_default_absent_and_parse_when_set configured_tool_result_budget_keeps_large_file_read_on_small_context_model v4_keeps_large_file_reads_but_compacts_noisy_shell_output evidence_bounded_preview_is_not_recompacted registry_catalog_bypasses_generic_tool_result_compaction contract_read_ --locked

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes
  • Harvested/co-authored credit uses a GitHub numeric noreply address

No bot/tool Co-authored-by. Issue reporter @hxfhd is credited in the commit body (issue-only; no code).

v098-final harvest

This is a maintainer-authored branch from current main (5ac75add4), not a community PR rewrite. Harvest by cherry-pick or merge onto the v098-final landing branch; keep authorship. Changelog should credit @hxfhd as the requester (#5367). Do not use Harvested from PR #N by @… unless harvesting a community PR. After it reaches main, close #5367 with credit to @hxfhd. Do not tag or publish from this lane.

Open in Web Open in Cursor 

…5367)

Extend existing [workshop] / WorkshopConfig with optional
read_result_max_bytes and tool_result_max_bytes. Absent keys keep the
current conservative constants (read 50 KiB, hidden read_file 16 KiB,
tool-result context/wire 12 000 chars or 48 000 on ≥500K windows).

Thread Config → Engine / App / DeepSeekClient into
compact_tool_result_for_route, compact_tool_result_for_wire, and
file.rs READ_MAX_BYTES / MAX_VISIBLE_BYTES / SMALL_FILE_BYTES via
unwrap_or. HarnessProfile is unchanged.

Requested by @hxfhd in #5367. Agent assistance used for implementation;
verification still pending.

Co-authored-by: Hunter Bown <Hmbown@users.noreply.github.com>
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.

Feature Request: Configurable model-visible read/tool-result size limits for self-hosted long-context models

2 participants