Skip to content

P0: Return structured ok:false worker failures without transport 500 #6

@vamgan

Description

@vamgan

Problem

The worker HTTP server currently returns HTTP 500 whenever the worker result is { ok: false }.

Relevant code:

  • src/server.ts:34-39
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions