t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Subagent thread IDs are very long and nested, wastes tokens and increases mistakes

Open a2mw opened this issue 1 month ago • 0 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

packages/contracts or packages/shared

Steps to reproduce

Use a subagent and then copy its thread ID for use in t3_thread_send or similar, it will have the long and unsuitable path as described in Actual behavior.

Expected behavior

To give each thread a short opaque ID, e.g. thr_<8–12 chars>, and keep the deterministic provider-derived key as an internal lookup. Use only the short ID in tool inputs and outputs.

Agents need these IDs to message a subagent again with t3_thread_send/t3_thread_read, especially after compaction, when the original reference is gone. A ~200-character ID that is mostly percent-escapes:

  • costs tokens every time it's quoted, read or passed back
  • is easy for a model to copy incorrectly (a dropped or mangled %3A means thread_not_found)

Actual behavior

Thread IDs for native subagents are built by nesting and URL-encoding the parent's full provider-thread ID. The exact structure of the ID from a Claude Agent subagent:

thread:provider:claudeAgent:native-thread:provider-thread%3Aprovider%3AclaudeAgent%3Aprovider-instance%3AclaudeAgent%3Anative-thread%3A123e4567-e89b-42d3-a456-426614174000%3Aa0123456789abcdef

Decoded, that's thread:provider:claudeAgent:native-thread: wrapped around the whole provider-thread:provider:claudeAgent:provider-instance:claudeAgent:native-thread::. Each : in the inner ID becomes %3A, which adds even more length.

Impact

Minor bug or occasional failure

Version or commit

No response

Environment

Desktop 0.1.5 (macOS).

Logs or stack traces

Code reference: deriveThreadFromProviderThread in packages/provider-core/src/server/IdAllocator.ts on main.

Screenshots, recordings, or supporting files

No response

Workaround

No response

a2mw avatar Oct 31 '26 11:10 a2mw