Problem
The worker HTTP server currently returns HTTP 500 whenever the worker result is { ok: false }.
Relevant code:
response.writeHead(result.ok ? 200 : 500, { "content-type": "application/json" });
The AWS AgentCore adapter expects to parse structured worker JSON, preserve worker-emitted events, and then handle ok:false.
Relevant adapter code:
adapter-aws-agentcore/src/index.ts:273-279
Impact
AgentCore/SDK layers may treat non-2xx responses as transport/runtime failures before the adapter can parse the JSON body. That can lose structured events, artifacts, and error details.
Suggested fix
- Return HTTP 200 for valid application-level failures with
{ ok:false, ... }.
- Reserve 4xx/5xx for malformed requests, unsupported routes, or server crashes.
- Alternatively, make the adapter parse non-2xx response bodies if AgentCore exposes them.
Acceptance criteria
- Worker application failure preserves JSON body and worker events for adapter handling.
- Tests cover a worker returning
{ ok:false, events:[...] } and adapter/core seeing those events.
Problem
The worker HTTP server currently returns HTTP 500 whenever the worker result is
{ ok: false }.Relevant code:
src/server.ts:34-39The AWS AgentCore adapter expects to parse structured worker JSON, preserve worker-emitted events, and then handle
ok:false.Relevant adapter code:
adapter-aws-agentcore/src/index.ts:273-279Impact
AgentCore/SDK layers may treat non-2xx responses as transport/runtime failures before the adapter can parse the JSON body. That can lose structured events, artifacts, and error details.
Suggested fix
{ ok:false, ... }.Acceptance criteria
{ ok:false, events:[...] }and adapter/core seeing those events.