docs/tui-stream-chunking-tuning.md
This document explains how to tune adaptive stream chunking constants without changing the underlying policy shape.
Use this guide when adjusting queue-pressure thresholds and hysteresis windows in
codex-rs/tui/src/streaming/chunking.rs, and baseline commit cadence in
codex-rs/tui/src/app.rs.
This guide is about tuning behavior, not redesigning the policy.
Smooth mode drains one line per baseline tick.CatchUp mode drains queued backlog immediately.codex_tui::streaming::commit_tickSee docs/tui-stream-chunking-validation.md for the measurement process.
Tune for all three goals together:
Smooth <-> CatchUp chatter)COMMIT_ANIMATION_TICK (tui/src/app.rs)
ENTER_QUEUE_DEPTH_LINES, ENTER_OLDEST_AGE
EXIT_QUEUE_DEPTH_LINES, EXIT_OLDEST_AGE
EXIT_HOLD
REENTER_CATCH_UP_HOLD
SEVERE_QUEUE_DEPTH_LINES, SEVERE_OLDEST_AGE
Tune in this order to keep cause/effect clear:
ENTER_*, EXIT_*)EXIT_HOLD, REENTER_CATCH_UP_HOLD)SEVERE_*)COMMIT_ANIMATION_TICK)Change one logical group at a time and re-measure before the next group.
ENTER_QUEUE_DEPTH_LINES and/or ENTER_OLDEST_AGESmooth -> CatchUp -> Smooth chatter:
EXIT_HOLDREENTER_CATCH_UP_HOLDEXIT_*)ENTER_QUEUE_DEPTH_LINES and/or ENTER_OLDEST_AGEREENTER_CATCH_UP_HOLDENTER_QUEUE_DEPTH_LINES and/or ENTER_OLDEST_AGESEVERE_*) to bypass re-entry hold soonercargo test -p codex-tui passes.CatchUp.