Skip to content

Comments

[DONOTMERGE] Workerd interceptOutboundHttp integration#6161

Draft
gabivlj wants to merge 2 commits intomainfrom
gv/mild-bugs
Draft

[DONOTMERGE] Workerd interceptOutboundHttp integration#6161
gabivlj wants to merge 2 commits intomainfrom
gv/mild-bugs

Conversation

@gabivlj
Copy link
Contributor

@gabivlj gabivlj commented Feb 24, 2026

No description provided.

Copy link
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

This PR improves sidecar container recovery by: (1) destroying stale sidecars before creating new ones in ensureSidecarStarted, (2) accepting 304/409 from Docker's start endpoint, and (3) testing idempotency after abort.

Two issues found, ranked by severity:

JSG_REQUIRE(response.statusCode == 204, Error,
"Starting network sidecar container failed with: ", response.body);
JSG_REQUIRE(response.statusCode == 204 || response.statusCode == 304 || response.statusCode == 409, Error,
"Starting network sidecar container failed with: ", response.statusCode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message lost the response body — the old code had response.body, which contains Docker's human-readable error. With only response.statusCode, a failure here produces something like "Starting network sidecar container failed with: 500" which is much harder to debug than the original which would include Docker's error JSON.

Suggested change
"Starting network sidecar container failed with: ", response.statusCode);
"Starting network sidecar container failed with: ", response.statusCode, " ", response.body);

network, kj::str(dockerPath), kj::HttpMethod::POST, kj::mv(endpoint), kj::str(""));
JSG_REQUIRE(response.statusCode == 204, Error,
"Starting network sidecar container failed with: ", response.body);
JSG_REQUIRE(response.statusCode == 204 || response.statusCode == 304 || response.statusCode == 409, Error,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: accepting 409 ("container conflict") silently seems risky — Docker returns 409 when the container is paused, restarting, or otherwise in a bad state. Since the line above freshly creates the sidecar, getting 409 here would indicate something genuinely wrong.

If you need 409 for the recovery path (stale container left running), the new destroySidecarContainer call before createSidecarContainer should already handle that. Consider dropping 409, or at minimum adding a comment explaining when 409 is expected.

@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 24, 2026

I'm Bonk, and I've done a quick review of your PR.

This PR improves sidecar container recovery by destroying stale sidecars before creating new ones in ensureSidecarStarted, accepting 304/409 from Docker's start endpoint, and testing idempotency after abort.

Two issues posted as review comments:

  1. Error message regression (container-client.c++:705): The error message dropped response.body, losing Docker's human-readable error detail. Suggestion provided to restore it.

  2. Accepting 409 may mask real problems (container-client.c++:704): Since the new destroySidecarContainer call before createSidecarContainer should handle stale containers, getting 409 right after a fresh create would indicate something genuinely wrong. Worth reconsidering or at least documenting when 409 is expected.

github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant