Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

Add opt-in one-per-turn queue drain - #18

Merged
yjuyjuy merged 7 commits into
masterfrom
fm/queue-one-per-turn
Aug 14, 2026
Merged

yjuyjuy merged 7 commits into
masterfrom
fm/queue-one-per-turn

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Problem

Queued messages are all drained together: process_queued_messages takes the whole queued_messages vec and join("\n\n")s it into a single user turn. Some workflows want each queued message delivered as its own turn instead.

Fix (opt-in, default off)

Add a mode that drains one queued message per turn, off by default so the existing combine-on-send behavior is unchanged.

  • config: new features.queue_drain_one_per_turn (default false), plumbed into the App session field (seeded in both constructors) and documented in the default config template.
  • input.rs: process_queued_messages now gets its per-iteration batch from a new take_next_queued_batch helper. In combine mode it takes the whole queue (unchanged); in one-per-turn mode it pops only the first queued message, leaving the rest for later while-loop iterations so each is sent as its own turn. Pending hidden [SYSTEM: ...] reminders ride with the batch either way (a reminder is not itself a user turn).
  • toggle: Ctrl+N flips the mode per session, mirroring the Ctrl+T queue-mode toggle, registered as a known hotkey. (Ctrl+O was already the model-picker confirm, Ctrl+Y the fallback-switch key, so Ctrl+N was chosen.)
  • tests: cover whole-batch drain (default), first-message-only drain (one-per-turn), and the Ctrl+N toggle. Existing combine tests (test_queue_message_combines_on_send, test_multiple_queued_messages) unchanged.

Validation

  • cargo build -p jcode-config-types -p jcode-base -p jcode-tui clean
  • cargo clippy on the same crates clean (only pre-existing warnings)
  • targeted tests pass: test_queue_drain_combine_takes_whole_batch_by_default, test_queue_drain_one_per_turn_pops_first_message_only, test_ctrl_n_toggles_queue_drain_one_per_turn, test_queue_message_combines_on_send, test_multiple_queued_messages, plus test_generated_default_config_* (default template still parses)
  • cargo build -p jcode --bin jcode clean

1jehuang and others added 7 commits August 13, 2026 12:46
By default, every queued message is drained together and joined into a
single request. Some workflows want each queued message delivered as its
own turn instead. Add an opt-in mode that does that, off by default so
the existing combine-on-send behavior is unchanged.

- config: new `features.queue_drain_one_per_turn` (default false), plumbed
  into the App session field and documented in the default config template.
- input.rs: `process_queued_messages` now takes its per-iteration batch via
  `take_next_queued_batch`. In combine mode it takes the whole queue (as
  before); in one-per-turn mode it pops only the first queued message,
  leaving the rest for later loop iterations so each is sent as its own
  turn. Pending hidden `[SYSTEM: ...]` reminders ride with the batch either
  way, since a reminder is not itself a user turn.
- toggle: Ctrl+N flips the mode per session, mirroring the Ctrl+T queue-mode
  toggle, and is registered as a known hotkey.
- tests: cover whole-batch drain (default), first-message-only drain
  (one-per-turn), and the Ctrl+N toggle. Existing combine tests unchanged.

Validated: cargo build/clippy -p jcode-config-types -p jcode-base -p jcode-tui
clean, targeted tests pass, cargo build -p jcode --bin jcode clean.
# Conflicts:
#	scripts/code_size_budget.json
# Conflicts:
#	scripts/code_size_budget.json
# Conflicts:
#	scripts/code_size_budget.json
@yjuyjuy
yjuyjuy merged commit 32d256b into master Aug 14, 2026
10 of 11 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants