Skip to content

Thread tools: safe defaults for three known traps (queue send, settling a role thread, reply then tool calls) #1222

Backlog

Description

@scuttletoby

What: three thread-tool traps that every new orchestrator session must be told about in writing today. Give each one a safe default instead:

  • t3_thread_send with mode "queue" to a running child either delivers at the end of the child's turn or says plainly that it will not. Today the written rule is "always steer, never queue".
  • t3_thread_organize refuses to settle the caller's own thread when that thread holds a role (Calm sidebar and thread roles: show only the assistant and the project orchestrators #878).
  • A reply the user must read is not reduced to a one-line summary when tool calls follow it in the same turn. Today the written rule is "make every tool call before the answer, none after".

Evidence: three standing written rules, each added after the trap was hit.

Done when: each default has a test, and the written rules can be deleted.

Related: #878.

🤖 Generated with Claude Code

Activity

  1. added
    area:agents
    size:medium
    type:feature
    on Nov 29, 2026
  2. scuttletoby commented on Nov 29, 2026

    @scuttletoby
    OwnerAuthor

    Claim: a writer from the minors sweep is taking item 2 (t3_thread_organize refuses to settle the caller's own thread while it holds a role), branch fork/1222-role-settle-refusal. It needs two new seam lines in apps/server/src/mcp/toolkits/thread/handlers.ts, so a list-only announce PR comes first. Items 1 (queue send to a running child) and 3 (a reply followed by tool calls) are not in this round.

    🤖 Generated with Claude Code

  3. scuttletoby commented on Nov 30, 2026

    @scuttletoby
    OwnerAuthor

    Item 1 (queue send to a running child): I traced it on main 40cd618 with an in-process test built on apps/server/src/mcp/TaskCancelUsageLimit.integration.test.ts. The parent delegates a task, the child's turn is running, and the parent calls t3_thread_send with mode: "queue". The send answers delivery: "queued". Then the child's turn ends:

    child turn ends as the queued follow-up the task
    completed starts at once running
    interrupted starts at once running
    failed (provider_error) stays queued, queueHeld: true, never runs failed

    So the trap is the failed case. When a turn fails, Orchestrator.ts holds every queued run (the providerFailed branch near the queueHeld: true writes). The task goes failed and the parent's completion wake (delegatedCompletionWakeDetail) does not mention the follow-up, so the parent thinks it was sent. A person can still run it by resuming the child thread, outside any task.

    Owner question (item 1 only), before anyone builds it:

    1. (Recommended) Cancel the parent's held follow-ups when the task fails, and say so in the wake. The wake for a failed task adds a line such as "Your queued message to this task did not run and was cancelled: …". This matches task_cancel, which already cancels the follow-ups the parent queued in the child. The parent resends, which starts a fresh task. Nothing is left behind for a later Resume to run twice.
    2. Keep them held (as now) and say so in the wake. The line tells the parent that the message is held in the child thread and to cancel it with t3_queue before resending. If the parent skips that step and someone resumes the child, it runs twice.

    Either way, the change goes in Orchestrator.ts, an upstream file on fork-checks' UPSTREAM_FILES. So it needs a list-only seam announce PR first, and the owner has to merge it. I am not claiming item 1, and items 2 and 3 are untouched by this comment. Item 3 (a reply followed by tool calls) is in upstream web timeline code and needs a rule for which text counts as "the reply"; it is not small either.

    🤖 Generated with Claude Code

  4. scuttletoby commented on Nov 30, 2026

    @scuttletoby
    OwnerAuthor

    Orchestrator decision: option 1. When the task fails, cancel the parent's held follow-ups the same way task_cancel does, and say so in the end-of-task message. Next step: the seam announce PR for the upstream file, then the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentssize:mediumtype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions