Skip to content

A companion answers for its own session ​

What changes ​

  • Companions, every runtime: a companion's session is its own when its stored parent is the companion's parent. An answer about one that is not carries errorDetail.code: 'state_child_session_taken':
    • companion__sendMessage: { delivered: false, reason: 'child_entry_failed', errorDetail };
    • companion__waitForResult and a blocking park: { name, status: 'failed', message, errorDetail } (companionWaitResultSchema()'s failed arm gains an optional errorDetail);
    • a spawn of the name: { status: 'not_spawned', reason: 'child_entry_failed', errorDetail }. A live or interrupted ref over it is released failed; a completed ref keeps its word.
  • agent-server (breaking): a bound /resume of another delegation's session answers 409 state_child_session_taken, with or without a request key. It answered 409 state_run_start_conflict with cause: 'child_binding_mismatch'. A /resume with no binding on a bound session still answers child_binding_mismatch. The CF Durable Object already answered state_child_session_taken.
  • Remote starts: a keyed, bound /start whose dispatch could not be named after its commit answers 503 transport_error; a parent re-sends a keyed start's retryable transport_error with the same key, within KEYED_START_RESENDS, and the repeat is answered from the key.

What to do ​

  1. A caller of agent-server's /resume that matched child_binding_mismatch for a bound resume of another delegation: match code === 'state_child_session_taken'.
  2. Code that reads a companion's failed answers: read errorDetail?.code to tell a session that is not the companion's own from a failed child.

Released under the MIT License.