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

Queue skill invocations mid-turn instead of rejecting them - #17

Merged
yjuyjuy merged 6 commits into
masterfrom
fm/fix-skill-queue-routing
Aug 14, 2026
Merged

yjuyjuy merged 6 commits into
masterfrom
fm/fix-skill-queue-routing

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Problem

Typing a /skill prompt while a turn is running throws "Already processing a message" instead of queueing. The server busy guard (client_lifecycle.rs start_processing_message) correctly rejects a Request::Message mid-turn, but the TUI force-submits a slash skill invocation as a new turn rather than routing it through queue_mode like ordinary text.

A skill invocation that carries a trailing prompt (/foo do the thing) is a real model turn: the skill activates and the prompt is sent. So mid-turn it should queue (or interleave) exactly like a plain message.

Fix (enqueue-time skill activation)

A queued message drains as a plain user turn, and the skill prompt reaches the model only through active_skill at turn-build time. So a queued /skill prompt must activate the skill now (persisting in active_skill until the drain) and queue only the trailing prompt.

  • input.rs: send_action keeps immediate submit for ! shell and every builtin/local slash command, but routes a registered skill-with-prompt invocation through queue_mode (input_is_queueable_skill_turn). queue_message activates the skill and queues only the trailing prompt (activate_queued_skill_and_extract_prompt). A bare /skill (no prompt, pure activation) and an unknown slash keep their immediate behavior.
  • remote/input_dispatch.rs: submit_remote_slash_input (the remote repro path) queues the trailing prompt under the already-active skill in queue mode, or interleaves it otherwise, instead of always submitting immediately.
  • tests: add queue-when-processing coverage for a registered skill-with-prompt, and confirm a bare activation is not queued.

Validation

  • cargo build -p jcode-tui clean
  • cargo clippy -p jcode-tui clean (only pre-existing warnings)
  • targeted tests pass: skill_invocation_with_prompt_queues_when_processing_in_queue_mode, bare_skill_activation_is_not_queued_while_processing, test_skill_invocation_not_queued, skill_invocation_with_prompt_activates_and_submits_in_one_turn
  • cargo build -p jcode --bin jcode clean

1jehuang and others added 6 commits August 13, 2026 12:18
A `/skill prompt` typed while a turn is running was force-submitted as a
new server Message, which the server rejects with "Already processing a
message" (client_lifecycle.rs start_processing_message). A skill
invocation that carries a trailing prompt is a real model turn, so it
should follow queue_mode like ordinary text rather than force-submitting
into the busy turn.

Because a queued message drains as a plain user turn and the skill
prompt reaches the model only through active_skill at turn-build time, a
queued `/skill prompt` must activate the skill at enqueue time and queue
only the trailing prompt (active_skill persists to the drain).

- input.rs: send_action keeps immediate submit for `!` shell and every
  builtin/local slash command, but routes a registered
  skill-with-prompt invocation through queue_mode
  (input_is_queueable_skill_turn). queue_message activates the skill and
  queues only the trailing prompt
  (activate_queued_skill_and_extract_prompt). A bare `/skill` with no
  prompt and an unknown slash keep their immediate behavior.
- remote/input_dispatch.rs: submit_remote_slash_input, the remote repro
  path, queues the trailing prompt (or interleaves it outside queue
  mode) under the already-active skill instead of always submitting.
- tests: add queue-when-processing coverage for a registered
  skill-with-prompt and confirm a bare activation is not queued.

Validated: cargo build/clippy -p jcode-tui clean, targeted tests pass,
cargo build -p jcode --bin jcode clean.
# Conflicts:
#	scripts/code_size_budget.json
@yjuyjuy
yjuyjuy merged commit 3afcb47 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