Skip to content

Add threads send with configurable busy-thread injection - #2

Open
jarekbird wants to merge 2 commits into
MajesteitBart:mainfrom
jarekbird:feat/send-existing-thread
Open

Add threads send with configurable busy-thread injection#2
jarekbird wants to merge 2 commits into
MajesteitBart:mainfrom
jarekbird:feat/send-existing-thread

Conversation

@jarekbird

@jarekbird jarekbird commented Sep 7, 2026

Copy link
Copy Markdown

Adds t3code threads send --thread-id <id> so scripts can continue an existing T3 conversation or inject context into active work. Previously the CLI always created a fresh thread. The command accepts exactly one of --prompt, --prompt-file, or --stdin, plus --open, --dry-run, and --if-busy reject|inject.

  • --if-busy reject (default) returns THREAD_BUSY without dispatching when a turn is active or pending.
  • --if-busy inject sends immediately even when busy, allowing T3 and its provider to incorporate the prompt into active work. It does not introduce a CLI queue or send an interrupt command.

Only thread.turn.start is dispatched. The existing thread's model/provider options, workspace, title, permissions, and interaction mode are preserved; creation defaults do not override the target. Missing, deleted, and archived targets still fail explicitly in either mode. Dispatch failure never deletes the existing thread. Temporary authentication uses the existing issue/revoke lifecycle.

Validation:

  • pnpm check: typecheck, all 41 tests, and build pass. On the live host, ran with T3CODE_HOME unset because the existing config-defaults test assumes no environment override.
  • Service tests cover settings preservation, literal prompt text, dry-run, snapshot fallback, stopped sessions, invalid input, unavailable targets, failure without deletion, and both behaviors across busy states.
  • Live T3 0.0.39 / Codex test: a follow-up recalled a marker from the previous turn. Stopped the test provider session and verified recall again after resumption.
  • Live busy-thread test: started a turn that waited 30 seconds; both default and explicit reject returned THREAD_BUSY; injection dry-run did not dispatch; explicit injection changed the requested final response. The agent returned the injected marker in the same active turn ID, with the message visible in the existing conversation. A transient auth CLI failure during status polling was followed by a successful read confirming completion.
  • Built CLI checks also covered prompt/file dry-runs, conflicting prompt sources, blank prompts, and a missing thread.

Reject-mode busy detection is a snapshot preflight, not an atomic lock; concurrent callers must serialize requests when that matters. Injection behavior can differ by provider and turn type. Success reports dispatch acceptance rather than agent completion; downstream failures remain possible. These limits and ambiguous-retry behavior are documented. A full T3 server restart was not part of the live test.

@jarekbird jarekbird changed the title Add threads send to continue existing T3 conversations Add threads send with configurable busy-thread injection Sep 7, 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