# fix\(server\): a remote task waits for its thread's delegated work · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/a511bd686f10dd6a0bd5c688fa585ed8b724ae6e)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: a511bd686f10dd6a0bd5c688fa585ed8b724ae6e

Requested commit: a511bd686f10dd6a0bd5c688fa585ed8b724ae6e

Commit: a511bd686f10dd6a0bd5c688fa585ed8b724ae6e

Tree: f9e581229a09ec76563d16d4c85d53767bd1279b

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
fix(server): a remote task waits for its thread's delegated work

When the task's run on the linked environment ended, the follower completed
the task with that run's reply, even while the thread there still waited on
its own subagents, background tasks or a completion delivery that would wake
it for the real answer. A local task waits for that work and takes its
result from the run that answered after it.

t3_thread_wait takes an optional untilDelegatedWorkSettled. With it, the wait
also blocks until delegatedTaskProgress reports result_available for the
thread, waking on task, provider-thread and run updates, and reports that
result run as resultRun. The follower passes it and reads the result from
resultRun. Both fields are optional: an older peer ignores the input and
answers as before, and the follower then falls back to the launched run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

```

## Parents

- [9f4243ecfe07a15960a82685dbdaf20fd1e078a2](https://git.cafe/pingdotgg/t3code/commit/9f4243ecfe07a15960a82685dbdaf20fd1e078a2?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/a511bd686f10dd6a0bd5c688fa585ed8b724ae6e?format=markdown)
