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

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

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

Visibility: public

Requested revision: a9914de7adad9c15d809ebc901f196283a05e062

Requested commit: a9914de7adad9c15d809ebc901f196283a05e062

Commit: a9914de7adad9c15d809ebc901f196283a05e062

Tree: 3144589e351da9fcd1c41bfbef4af98c5a70ed72

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

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

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