# feat\(server\): delegate_task to a linked environment · pingdotgg/t3code

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

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

Visibility: public

Requested revision: 185671afb1d38f6264902d260c7e06e1e6cd46a0

Requested commit: 185671afb1d38f6264902d260c7e06e1e6cd46a0

Commit: 185671afb1d38f6264902d260c7e06e1e6cd46a0

Tree: 6ba35d432983801168c58d3b1246deb360ad4165

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
feat(server): delegate_task to a linked environment

delegate_task takes target.environmentId (and optionally target.projectId).
The child then runs as an ordinary thread in the linked environment,
launched through the link with a key derived from the caller's
clientRequestId, in the project there with this thread's repository unless
one is named.

The parent here records the task with delegated_task.remote.request: its
node, subagent row and turn item, with remoteChild instead of a local child
thread. RemoteDelegation follows the thread there and completes the task
with delegated_task.remote.complete, which reuses the parent half of a local
finalize, so the parent wakes as it would for a local child. Open remote
tasks are followed again at startup. A revoked or expired link fails the
task with that reason; any other error backs off, up to five minutes.

task_status and mode=wait answer from the row, task_cancel interrupts the
thread there and completes the task as cancelled, and restart recovery no
longer treats a remote task as abandoned provider work.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

```

## Parents

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

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