Skip to content

test(mock-anthropic): wait up to 30 s for the mock, and stop with its stderr if it never listens - #828

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/i826-mock-listen-wait
Nov 16, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/i826-mock-listen-wait

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #826

What changed and why

Validation

With a node wrapper first on the PATH:

Wrapper Test on main This branch
sleeps 12 s, then execs node 83 FAILs, listening on loopback first, then curl: (7) … port 80, as in CI PASS (15 s)
exits 1 with a message on stderr — 1 FAIL, then the mock is not listening; its stderr: and the message; exit 1 within 1 s
none PASS PASS

(A 6 s start still passed on main on this machine, because each sleep 0.1 there takes longer than 0.1 s. So the old wait was a little over 5 s of real time, as the CI timings show.)

  • The suite passes under bash 5 and under macOS's /bin/bash 3.2 (CI's deploy-scripts-bash32).
  • shellcheck -S warning (shellcheck-py 0.10.0.1) is clean, and pre-commit passes.

Every commit is signed off (DCO).

Assisted-By: Claude Code

… stderr if it never listens

The test waited 5 s (50 x 0.1 s) for the mock's 'listening' line. On a busy CI runner, node's cold
start outlasted that twice (rossoctl#760, rossoctl#772). The port then stayed empty, and every later check ran
curl against port 80, failing 80-odd checks with nothing about the cause. Wait up to 30 s, stop
early if the mock exits, and when it never listens fail once with its stderr.

Closes rossoctl#826

Assisted-By: Claude Code
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 16, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Clean fix for #826: the mock wait goes from ~5 s to up to 30 s, stops early when the mock process dies (kill -0), and — the part that matters most — when the port is never read the test now fails once with the mock's stderr instead of running 80-odd checks against curl's port-80 fallback. The checks themselves are untouched.

The loop, the early-exit and the stderr dump are all straightforward; shellcheck and the bash 3.2 CI job cover the portability concerns. No findings.

Author: webchang (MEMBER — maintainer)
Areas reviewed: Shell, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (deploy-scripts jobs pending at review time)

All checks pass. Ready for human review.

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

State marker for the review queue (full review posted separately on this SHA):

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approving. The 30 s wait with a kill -0 early exit fixes the cold-start flake in #826. Stopping with the mock's stderr when no port was read replaces the 80-odd cascading FAILs with the actual cause. The EXIT trap still cleans up on the new early exit, and the change is bash 3.2-clean.

Author: webchang (MEMBER, maintainer)
Areas reviewed: Shell (deploy test)
Agent/IDE config (.claude/.vscode): none
Commits: 1, all signed off: yes
CI status: passing

@pdettori
pdettori merged commit 870a695 into rossoctl:main Nov 16, 2026
16 checks passed
@pdettori pdettori added this to the v0.11.0 milestone Nov 17, 2026
webchang added a commit to webchang/moca that referenced this pull request Nov 17, 2026
Takes upstream main at 1a7f41e (19 merges since 032c8f6): the sandbox
idle lifetime across docs, control plane, clients and deploy (rossoctl#820, rossoctl#837,
rossoctl#842, rossoctl#843), grant redemption (rossoctl#822), the lease-check log line (rossoctl#824),
egress fixes (rossoctl#829, rossoctl#834), the mock wait (rossoctl#828), the deadline timer
(rossoctl#835), the create rollback (rossoctl#832), multi refusals and the rossoctl#363 leftovers
(rossoctl#833, rossoctl#838), the identity near-miss check (rossoctl#827), mocactl login errors
(rossoctl#836), the ghostunnel probes (rossoctl#830), refusal-burst deferral (rossoctl#831), a
sandbox-worker change (rossoctl#841) and the v0.11 doc truth (rossoctl#821).

Conflicts (one):

- deploy/sbx/README.md, the "Optional inputs" table. Upstream (rossoctl#843)
  rewrote the SBX_LIFETIME_DAYS row (the default idle lifetime, at most
  SBX_MAX_LIFETIME_DAYS) and added the SBX_MAX_LIFETIME_DAYS and
  SBX_LOWER_WORKSPACE_IDLE rows, which widened the table; the fork had
  added an SBX_GATE_RECORD_SCHEMA row at its end. Resolved by taking
  upstream's table whole and appending the fork's SBX_GATE_RECORD_SCHEMA
  row after SBX_PROFILE, then re-padding the table with prettier. The
  fork's env-file example line for SBX_GATE_RECORD_SCHEMA merged cleanly.

Merged without markers, checked: setup.sh keeps the fork's
SBX_GATE_RECORD_SCHEMA validation and its sbx-settings write (so it stays
in the settings hash) beside upstream's SH_SANDBOX_MAX_LIFETIME_SECONDS;
both ocp-sbx and ocp-combined patch-control-plane.yaml keep the optional
SH_GATE_RECORD_SCHEMA from sbx-settings beside the new optional
SH_SANDBOX_MAX_LIFETIME_SECONDS; setup.test.sh keeps the fork's cases
beside upstream's. The fork's RUNBOOK, README and template-onboarding
docs say nothing about sandbox lifetime, refusal bursts, login errors or
the create rollback, so none needed a correction; GUIDE.md is unchanged
and GUIDE.pdf is not regenerated.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mock-anthropic.test.sh fails intermittently in CI (the mock is not listening within the test's 5 s wait)

4 participants