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

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

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

Visibility: public

Requested revision: c87d1f54fd12de75bbd874ac703e4111d97739f6

Requested commit: c87d1f54fd12de75bbd874ac703e4111d97739f6

Commit: c87d1f54fd12de75bbd874ac703e4111d97739f6

Tree: 72d1f8d9e1c08ec0d1605a412cd1f9a085a8babd

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

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

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