Skip to content

test(host): run java_mcp's container MCP scenario against Docker - #55

Merged
htcom-code merged 2 commits into
mainfrom
test/mcp-scenario-container
Nov 5, 2026
Merged

htcom-code merged 2 commits into
mainfrom
test/mcp-scenario-container

Conversation

@htcom-code

Copy link
Copy Markdown
Owner

Stacked on #54. Merge #54 first; this branch contains its commit.

Summary

Runs java_mcp/SCENARIO-container-mcp.md against the production protrus-host binary in OCI mode, with real Docker containers (design 20 §6).

Runner

  • When a manifest uses execution_mode: "oci", the runner prepares the host the way an operator would:
    • worker and gateway images (PROTRUS_OCI_WORKER_IMAGE reuses a prebuilt worker image; otherwise it builds Dockerfile.runtime)
    • an --internal network
    • a control secret the container user (65532) can read
    • a signed gateway profile published to the host's artifact store
  • Every container and the network are removed afterwards.
  • New actions:
    • container: docker inspect of the module's newest running container (404 if none).
    • kill_container: docker kill of that container.

Manifest container-mcp.json

step checks
S1 deploy → mode: container, routed through the proxy, list_runtimes mode container, the container is running
S2 HostConfig: ReadonlyRootfs, CapDrop: [ALL], no-new-privileges, PidsLimit 1024, Memory 512m
S4 forbidden capability → GATE_FAILED (policy), route 404, no container started
S5 update → v2, versions, rollback
S6 docker kill wk-calc: main and ip-echo keep serving, wk-calc 502
S7 auto-restart off: stays down; recovered by update
S7 opt-in worker.container.auto-restart on: wk-calc comes back by itself; ip-echo keeps serving and stays active with no sticky reason (the #54 regression)
Cleanup uninstall both; no module containers left

Not applicable:

  • S3: the unit-test gate is not ported (P*).
  • S6 packing: Rust does not pack modules into shared containers (P*), so this behaves like Java's modules-per-worker=1.
  • S8: transport only; the in-process scenario covers it.

Verification

With worker.container.auto-restart on, the OCI pair watcher reaped the
dead pair and then called DeploymentService::reconcile_stored, which
deploys every stored active record again. The live pairs of the other
modules were prepared a second time, failed with "runtime already
exists for module revision", and were left DEGRADED with a sticky
reason. Their uninstall then failed with "runtime does not exist".

Protean's container watcher restarts only the container that exited,
and the worker crash watch here already does the same through
redeploy_after_crash. The OCI trigger now calls
redeploy_reaped_after_crash: it redeploys that module's persisted
signed record without stopping the runtime it already reaped. When the
revision is no longer active there is nothing to restore.

Found by the container MCP scenario (S7 opt-in, then cleanup).

Tags: oci, gate, parity
Co-Authored-By: htjulia <htjulia1@gmail.com>
SCENARIO-container-mcp.md is the worker runbook plus the OS boundary:
hardened containers, docker kill as the crash, and the docker wait
self-heal behind worker.container.auto-restart. The runner now prepares
an OCI host the way an operator would: the worker and gateway images,
an internal network, a control secret the container user can read, and
a signed gateway profile in the host's artifact store. Two new actions
inspect and kill a module's newest container.

S1, S2 (read-only rootfs, CapDrop ALL, no-new-privileges, pids and
memory caps), S4, S5, S6, S7, S7 opt-in and cleanup pass. S7 opt-in
also checks that the neighbouring module keeps serving, which is the
regression the previous commit fixes. The test needs Docker and
builds the production worker image, so it is #[ignore] like the other
OCI tests. PROTRUS_OCI_WORKER_IMAGE reuses a prebuilt image.

Tags: host, scenario, oci
Co-Authored-By: htjulia <htjulia1@gmail.com>
Base automatically changed from fix/oci-restart-only-crashed to main November 5, 2026 04:10
@htcom-code
htcom-code merged commit 8a3fbac into main Nov 5, 2026
@htcom-code
htcom-code deleted the test/mcp-scenario-container branch November 5, 2026 04:11
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