Repository navigation
Description
EcsTaskProvider.call runs resolve (an ECS DescribeTasks) before both bind and invoke (packages/execution/src/ecsTaskProvider.ts): two control-plane calls per call.
For a resource-backed query, the one before invoke happens after the query has opened its company snapshot (Invocation.ts: bundle load → bind → snapshot → invoke). So it also lengthens how long the company connection is held. Primitive-free snapshots take no company connection. The hold is p50 218 ms against a guest run of p50 33 ms. This lookup is one contributor to that gap; it hasn't been measured on its own.
Caching the task's address on failure alone isn't safe. A stopped task's IP can be reassigned to a fresh, unbound spare that holds the same fleet secret. A management request sent to the cached address would then succeed against the wrong task: the request carries company and epoch but not the expected task, and post trusts the address. Today a fresh DescribeTasks rejects a stopped task before any request goes out.
Fix
- The receiver verifies identity. Management requests carry the expected task id, and the supervisor refuses before any side effect if it isn't that task.
EXECUTION_TASK_IDis already injected. Roll this out compatibly with older supervisors. - Then cache the endpoint. Once the supervisor verifies identity, cache the resolved endpoint per task (address, ARN, revision), bounded and with a TTL. Invalidate it on lifecycle changes, protocol refusals (including the identity refusal) and transport failures. Keep
Fleet.route's live binding checks. - Never replay a possibly executed mutation or action after re-resolving on a transport failure.
Tests:
- an identity mismatch refuses before bind or invoke has any effect;
- a cached endpoint is used across calls;
- a stopped task's reused address is refused and re-resolved;
- an uncertain invoke isn't replayed.
Activity