Skip to content

fix: #363's leftovers: pin ensure_exec_listener's newline, and correct the MI1 citations - #838

Merged
webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/i363-leftovers
Nov 17, 2026
Merged

webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/i363-leftovers

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #363

#833 took this issue's two multi-tenant boot refusals. This PR does the rest, so every box can be ticked.

What changed and why

  • Test pin, ensure_exec_listener's end_with_newline call (deploy/vm/setup-vm.sh, now at :665). setup-vm.test.sh gains a pre-MI1 migration fixture whose relay.env ends with SH_RELAY_TOKEN=keep and no final newline. The test checks two things after the migration: SH_RELAY_TOKEN is still exactly keep, and MOCA_RELAY_EXEC_ADDR=127.0.0.1:9444 is on its own line. This mirrors the existing ensure_exec_token no-newline case.
  • Spec, the amendment and the R3 row (docs/specs/2026-09-28-moca-multi-user-isolation-design.md):
    • "the solve and verdict leaves" now names the converge leaf (realProduceVerdict);
    • the prompt leaf is described as running its R3 check itself (runPromptLeaf calls assertServerSandbox) with its R4 lockdown still through executeTurn;
    • the R3 row's test column adds the prompt-leaf test in harness/test/run-leaf.test.ts ("refuses a server-mode prompt leaf with no sandbox itself, even with executeTurn injected").
  • Spec, the relay cites: makeDefaultValidateToken is now packages/sandbox-relay/src/main.ts:501-538 (its doc comment from :490), and makeExecTokenValidator is :113-142.
  • deploy/vm/README.md: "(step 3 below)" now points at step 8 and the paragraph after it ("A re-run restarts what it owns"). The issue said step 7. The steps were renumbered since it was filed, and the restarts are now step 8.

Already resolved on main (no change here)

  • GET write-back race on /workloads: ticked in the issue; GET no longer writes back.
  • claimName's || multi term: claimName is no longer in packages/server/src (git grep -n claimName -- packages/server/src finds nothing), so the term and its test are gone.
  • handleCreateWorkload's "wherever callers are told apart": that wording is no longer in packages/server/src.
  • Spec :94's run-turn.ts:836-848 cite: the spec no longer cites run-turn.ts line numbers.

Validation

  • deploy/vm/tests/setup-vm.test.sh passes under bash 5 and under macOS's /bin/bash 3.2. It shows ok - ensure_exec_listener appends on its own line to a relay.env with no final newline.
  • Failing-then-passing, as the issue's "Done when" asks: with only the end_with_newline "$relay" line at setup-vm.sh:665 deleted, the suite fails with FAIL: migrating a relay.env with no final newline changed SH_RELAY_TOKEN. Before this PR, deleting that line left the suite green.
  • shellcheck -S warning (shellcheck-py 0.10.0.1) is clean on the test. Prettier and check-doc-links.py (0 broken links) pass, and so does pre-commit.

Every commit is signed off (DCO).

Assisted-By: Claude Code

…d correct the MI1 citations

- setup-vm.test.sh: a pre-MI1 migration fixture whose relay.env has no final newline, so deleting
  ensure_exec_listener's end_with_newline call now fails the suite.
- MI1 spec: the amendment and the R3 row name the converge leaf (realProduceVerdict) and say the
  prompt leaf runs its R3 check itself (R4 still through executeTurn); the relay cites are
  main.ts:501-538 and :113-142.
- deploy/vm/README.md: the restarts are step 8 and the paragraph after it, not step 3.

Closes rossoctl#363

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 17, 2026

@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.

Summary

Closes #363's leftovers. The new no-final-newline fixture pins ensure_exec_listener's end_with_newline "$relay" (setup-vm.sh:665): it asserts SH_RELAY_TOKEN=keep survives and MOCA_RELAY_EXEC_ADDR=127.0.0.1:9444 lands on its own line, mirroring the ensure_exec_token case. I checked the corrected cites against this head: makeExecTokenValidator is main.ts:113-142, makeDefaultValidateToken is :501-538 with its doc comment from :490, runPromptLeaf calls assertServerSandbox itself, the cited prompt-leaf test exists at run-leaf.test.ts:700, and the README's restarts are step 8 plus the "A re-run restarts what it owns" paragraph. One nit about wording.

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

| R2 | `applyModelGateway` seeds `ANTHROPIC_API_KEY` only with the constant sentinel, never a caller's token. A shared `prepareServerProcess()` runs in `startServer()`, the P6 worker and the async-run job (`leaf-job.ts`); under `multi` it deletes every provider credential pi can read from the environment (any `*_API_KEY`, `*_AUTH_TOKEN` or `*_OAUTH_TOKEN`, `HF_TOKEN`, `COPILOT_GITHUB_TOKEN`, Bedrock's `AWS_*` sources and `GOOGLE_APPLICATION_CREDENTIALS`), leaving the sentinel, and refuses `SH_LOCAL_TOOLS=1`, `SH_REQUIRE_AUTH` not `true`, `SH_MODEL_HEADERS` and a Vertex ADC file. `single` retains an operator's key | a token-less call after an authenticated one sees only the sentinel, and a caller credential on a non-Anthropic model throws — `harness/test/model-gateway.test.ts`; the multi scrub deletes the OAuth token, which outranks the sentinel, `single` keeps an operator key, and `multi` refuses all four — `packages/server/test/server-process.test.ts`; all three entry points call `prepareServerProcess` — `test/worker-boot.test.ts` |
| R3 | In server and worker mode, a turn with **no resolvable sandbox fails** rather than running tools in the worker. Local tools remain only in the CLI (`harness/src/cli.ts`), or behind an explicit `SH_LOCAL_TOOLS=1` that `multi` refuses | no sandbox → the turn fails before an agent session (and so any tool) is built — `harness/test/turn-require-sandbox.test.ts`; the guard, `assertServerSandbox`, in `test/select-sandbox.test.ts`; the solve and verdict leaves in `test/run-leaf.test.ts`; every server turn marked `serverMode`, `packages/server/test/server-process.test.ts` |
| R3 | In server and worker mode, a turn with **no resolvable sandbox fails** rather than running tools in the worker. Local tools remain only in the CLI (`harness/src/cli.ts`), or behind an explicit `SH_LOCAL_TOOLS=1` that `multi` refuses | no sandbox → the turn fails before an agent session (and so any tool) is built — `harness/test/turn-require-sandbox.test.ts`; the guard, `assertServerSandbox`, in `test/select-sandbox.test.ts`; the solve and converge leaves (`realProduceSolve`, `realProduceVerdict`) and the prompt leaf, which runs the guard itself, in `test/run-leaf.test.ts`; every server turn marked `serverMode`, `packages/server/test/server-process.test.ts` |
| R4 | In server and worker mode: `noExtensions: true`, `noContextFiles: true`, `noSkills: true`, `noPromptTemplates: true`, `noThemes: true` (a promoted bundle still delivers its skills and prompt templates through its own paths), the project untrusted (`projectTrusted: false`, so no project settings, `SYSTEM.md` or `APPEND_SYSTEM.md`), and `PI_CODING_AGENT_DIR` pointed at a fresh private per-process directory | planted project `SYSTEM.md`, `APPEND_SYSTEM.md`, `AGENTS.md`, extension file, `$HOME/.agents/skills` skill and agent-directory prompt template are not loaded by the real Pi loader, and are loaded outside server mode; a promoted bundle's skills still load — `harness/test/loader-lockdown.test.ts`; the same options on the solve and verdict leaves, `test/run-leaf.test.ts`; the private 0700 `PI_CODING_AGENT_DIR`, `packages/server/test/server-process.test.ts` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: The R3 row and the amendment now say "converge leaf (realProduceVerdict)", but R4's test column on this row still says "the same options on the solve and verdict leaves". You could rename it to "solve and converge leaves" here as well, so the two rows read the same.

@webchang
webchang merged commit 3f3a105 into rossoctl:main Nov 17, 2026
16 checks passed

@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.

Review: #363's leftovers — newline pin and MI1 citation fixes

Small, well-scoped cleanup. I verified the claims on head rather than taking the body's word for it:

  • Citations: makeExecTokenValidator at packages/sandbox-relay/src/main.ts:113 (through :142), makeDefaultValidateToken at :501 with its doc comment from :490 — all match. deploy/vm/README.md's "step 8 below, and the paragraph after it" correctly targets step 8 ("Enables and restarts sh-relay.service…") and the "A re-run restarts what it owns" paragraph.
  • R3 spec row vs code: runPromptLeaf does call assertServerSandbox itself (harness/src/run-leaf.ts:596), so the amended wording matches the code.
  • The new test: bash deploy/vm/tests/setup-vm.test.sh passes on head, including the new "ensure_exec_listener appends on its own line to a relay.env with no final newline" case.

No findings. The already-resolved-on-main list checks out (no claimName in packages/server/src, no run-turn.ts line cites in the spec).

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

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.

@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.

MI1 S1 follow-up: #350 round-3 review items (SH_MODEL_HEADERS, Vertex ADC, GET write-back race, pins, doc fixes)

4 participants