Skip to content

fix(executor): return full inspect payload from expectState to avoid …#42

Open
harshjainnn wants to merge 1 commit into
BitMiracle-AI:mainfrom
harshjainnn:fix/executor-single-container-inspect
Open

fix(executor): return full inspect payload from expectState to avoid …#42
harshjainnn wants to merge 1 commit into
BitMiracle-AI:mainfrom
harshjainnn:fix/executor-single-container-inspect

Conversation

@harshjainnn

Copy link
Copy Markdown

What & why

expectState in executor/docker.ts performs a full ContainerInspect but discards everything except the container id. resolvePortTarget then inspects the same container again immediately after, just to read NetworkSettings — data the first call already had. Since resolvePortTarget runs once per proxied HTTP request and once per WebSocket upgrade, this added one extra Docker Engine round-trip (plus JSON parsing) to every proxied connection.

expectState now returns the full ContainerInspectInfo payload instead of just the id. All ~16 existing call sites are updated to read .Id off the returned object. resolvePortTarget reads NetworkSettings from the same payload instead of calling .inspect() again. The rejection-message contract (contract/lifecycle.ts:233-241) is untouched and remains sole-sourced inside expectState — this removes a call rather than duplicating logic.

Closes #35

Checklist

  • pnpm build && pnpm typecheck && pnpm lint && pnpm test passes locally (build first — the e2e suite runs the built daemon)
  • Behavior changes come with tests that fail without the change
  • User-facing changes to @dormice/shared / sdk / cli have a changeset (pnpm changeset)
  • README updated if this changes documented behavior

…duplicate container inspect

expectState already performs a full ContainerInspect internally but only
returned the container id, forcing resolvePortTarget to inspect the same
container a second time just to read NetworkSettings. This doubled the
Docker Engine round-trip on every proxied HTTP request and WebSocket
upgrade in sandbox-proxy.

expectState now returns the full ContainerInspectInfo payload. All
existing call sites are updated to read .Id off the returned object.
resolvePortTarget reads NetworkSettings from the same payload instead
of calling .inspect() again. The rejection message contract remains
sole-sourced in contract/lifecycle.ts.
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.

executor: resolvePortTarget inspects the same container twice

1 participant