Repository navigation
Install the emitter in the UK Modal launcher's image - #1758
Merged
Merged
Conversation
The launcher's image installs only uv, so run_uk_cut.py's pre-flight, which starts the separately installed microcosm-emitter to check write access, refuses every Modal run. These tests ask the image to install microcosm-emitter at or above the release minimum_emitter_version.json names, as the US Modal image does, to point the build at it, to refuse a minimum file it cannot read, and to say in the plan what it installs. They fail on this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
run_uk_cut.py's preflight starts the separately installed microcosm-emitter to check write access (#1460), and the workspace lock pins only its interface (#1410), so the launcher's image, which installed only uv, stopped every Modal run there. As the US Modal image does, the image now installs microcosm-emitter at or above the release minimum_emitter_version.json names in the launching checkout, into /usr/local/bin outside the environment the container syncs, runs its version so a command that cannot run fails the image build, and sets MICROCOSM_EMITTER_COMMAND to it. The launcher refuses a minimum file it cannot read, and its plan names the requirement. The container defines the image without reading the checkout, as before. Closes #1757. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oading Review round 1 of #1758 found that the new emitter install step, which resolves the emitter's dependencies without hashes, runs with uv 0.11.7 and the cached base's pip 25.3 and CA store, all of which trust the compromised eMudhra (emSign) roots; the US Modal image left them for that reason. These tests ask the UK image for the US image's measures in the same order (ca-certificates upgrade, the hash-pinned pip bootstrap, uv at the US image's version), for UV_PYTHON_DOWNLOADS=never, and for the plan to refuse a commit whose minimum emitter release is above the launching checkout's or cannot be read. Two more check that the two launchers agree on the emitter requirement and command. The image-chain, ordering, download, and both refusal tests fail on this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1758: the new emitter install resolves the emitter's dependencies without hashes, and the image downloaded with uv 0.11.7, the base's pip 25.3 and the base's CA store, which all trust the compromised eMudhra (emSign) roots; code swapped in there would run with HF_TOKEN and the signing key. As in the US Modal image, the image now upgrades ca-certificates, replaces pip with the hash-pinned 26.2.2 before any other download, installs uv 0.13.4, and sets UV_PYTHON_DOWNLOADS=never. The plan also reads the cloned commit's minimum_emitter_version.json with git show and refuses a commit whose minimum is above the launching checkout's, which preflight would otherwise refuse in the paid container with upgrade advice that cannot apply to an image. docs/orrery-publication.md now says which of the two Modal images each sentence describes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 of #1758: git show exits 128 alike for a path the commit lacks and for a commit git cannot read, and the plan took either as "no minimum file", so it could let through a commit it should refuse. The stand-in git now answers ls-tree too, and a new test expects the plan to refuse an unreadable commit. The certificate-authority test also asks for the US image's certifi floor on the image's own Python. Both fail on this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 of #1758: git show exits 128 alike for a path the commit lacks and for a commit git cannot read, so the plan took an unreadable commit as one without a minimum file and let it through. It now asks git ls-tree first, which lists nothing for a missing path, and refuses when either command fails. The image's pip install also asks for certifi 2026.10.19 or later, as the US image does, so the image's own Python, which Modal's client runs on, drops the eMudhra roots too and the docs' "as the US image does" holds. The build adapter's comment and docs/orrery-publication.md now name both launchers and say when Modal rebuilds the emitter's layer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
marked this pull request as ready for review
November 26, 2026 17:53
This was referenced Nov 26, 2026
juaristi22
reviewed
Nov 27, 2026
juaristi22
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at bd1a22381: the image's emitter install and version check work as written (replayed with uv 0.13.4 on Python 3.13, which installs 0.18.0), the pinned pip wheel's sha256 matches PyPI's, the plan's commit check reads the right file with real git even when launched from tools/, and the 30 tests pass here, so I have nothing to raise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1757. Tracked as task 5d · 2 of the "1. Collector/Emitter" project.
What changes
tools/modal_uk_cut.pyrunstools/run_uk_cut.py allin a Modal container. Its image installed only uv.run_uk_cut.py's preflight starts the separately installedmicrocosm-emitterto check write access (#1460), and the workspace lock pins onlymicrocosm-emitter-interface(#1410), so every Modal run stopped at preflight, with or without--publish.The image now installs the emitter as the US Modal image does (
image_emitter_requirement()andimage_build_commands()intools/modal_us_stage_plan.py):UV_TOOL_BIN_DIR=/usr/local/bin uv tool install 'microcosm-emitter>=X.Y.Z', whereX.Y.Zis the releasepackages/microcosm-build/src/microcosm/build/minimum_emitter_version.jsonnames in the launching checkout (0.17.0 onmaintoday). The emitter sits outside the environment the container syncs at run time. Modal reuses the layer while the minimum, every earlier image step and Modal's image builder version are unchanged, so an image keeps the release it was first built with until one of those changes./usr/local/bin/microcosm-emitter version, so a command that cannot run fails the image build rather than the paid run.MICROCOSM_EMITTER_COMMAND=/usr/local/bin/microcosm-emitter, which the build's interface reads to find the emitter (it also searchesPATH).emitter_requirement()refuses a missing file, or one that does not hold{"minimum_emitter_version": "X.Y.Z"}, naming the file./rootwithout a checkout, so, as before for the registry's copy, the image definition there skips the install and the copy and reads no file.python tools/modal_uk_cut.py --commit … --label …now names the emitter requirement in its plan, and refuses a commit whoseminimum_emitter_version.json(read withgit show) names a higher release than the launching checkout's. Preflight would otherwise refuse the image's emitter in the paid container, with upgrade advice that cannot apply to an image. A commit without the file (before Record how many telemetry events a Modal stage's emitter left undelivered #1522) kept an older minimum in code, so it passes. The plan tells a missing file from an unreadable commit withgit ls-treefirst, sincegit showexits 128 for both, and refuses a commit whose tree or file it cannot read.changelog.d/emudhra-ca-trust.fixed.md):apt_installnamesca-certificates, so the CA store git and the standard library read is upgraded; a hash-pinned pip 26.2.2 replaces the base's pip 25.3 before any other download; uv rises from 0.11.7 to 0.13.4; and the image's own Python, which Modal's client runs on, gets certifi 2026.10.19 or later.UV_PYTHON_DOWNLOADS=neverkeeps uv on the image's Python 3.13. They also fix exposures the image already had (the uv download and the clone), and they cover the emitter's HTTPS calls, which are new here. The tests compare the uv version, the certifi floor, the pip bootstrap command and the emitter requirement and command withtools/modal_us_stage_plan.py's, so the two launchers cannot drift apart unnoticed.The emitter trades the run's
HF_TOKENfor its own collector session, as on a workstation (microcosm_emitter.core.auth), so no new secret or collector token is needed.Minimum releases at launch and in the build. The image's install step takes its minimum from the launching checkout, and the build enforces the minimum of the commit it clones. The plan refuses a commit whose minimum is higher, so the launcher's docstring and
docs/uk-cut-anyone.mdsay to launch from a checkout at or after the commit. The US runner has the same split (docs/orrery-publication.md, which now says which image each sentence describes).Docs:
docs/uk-cut-anyone.md(the Modal section),README.mdanddocs/orrery-publication.md(which Modal images read the minimum file), andchangelog.d/1757-uk-modal-launcher-emitter.fixed.md.Tests
In
packages/microcosm-build/tests/engine_free/uk/test_modal_uk_cut.py, against the stand-inmodalmodule the file already uses. First pair: red commit634fb42b5, changee376b4e5c. Review round 1: red commitbb2823ad1, fix9b09e7f38. Review round 2: red commitf24ebf919, fixbd1a22381.test_the_image_carries_the_registry_for_the_container(changed: the registry's copy now follows the install step)add_local_filecalled 0 times on the new chaintest_the_image_installs_the_emitter_at_the_builds_minimum_releaserun_commandssteptest_the_build_is_pointed_at_the_installed_emitterMICROCOSM_EMITTER_COMMANDmissing from the image environmenttest_an_unreadable_minimum_release_stops_the_image_definition(6 cases)DID NOT RAISE SystemExittest_the_plan_names_the_emitter_the_image_installstest_the_container_defines_the_image_without_the_checkouttest_the_image_carries_the_registry_for_the_container(changed again: the pip bootstrap step is now in the chain)bb2823ad1: assertion, noadd_local_fileon the new chaintest_the_image_trusts_no_compromised_certificate_authoritybb2823ad1: assertion,pip_installwhere the pip bootstrap belongstest_uv_never_downloads_a_python_in_the_imagebb2823ad1: assertion,UV_PYTHON_DOWNLOADSmissingtest_the_plan_refuses_a_commit_that_needs_a_newer_emitter,test_the_plan_refuses_a_commit_whose_minimum_it_cannot_readbb2823ad1:DID NOT RAISE SystemExittest_the_plan_refuses_a_commit_whose_tree_it_cannot_read(new),test_the_image_trusts_no_compromised_certificate_authority(changed: the certifi floor)f24ebf919:DID NOT RAISE SystemExit; assertion, no certifi requirementtest_the_launchers_agree_on_the_emitter,test_the_plan_accepts_a_commit_the_image_emitter_satisfies(3 cases)test_planning_contacts_no_modal_service,test_missing_credentials_are_asked_for_one_command,test_the_plan_names_the_emitter_the_image_installs,test_the_image_installs_the_emitter_at_the_builds_minimum_release,test_the_container_defines_the_image_without_the_checkout(changed: their stand-ingitnow answersgit ls-treeandgit show, or they select the emitter's install step by its text)Nothing ran on Modal. The tests check the image definition, not a built image. The round 1 and round 2 tests ran only before their fixes, where they fail as listed; CI runs them on the fixes. The round 2 reviewer ran all 21 cases at
9b09e7f38and they passed.Known gaps, not changed
~/.cache, as in the US runner. Hand-overs still queued when the container exits are lost with it. Moving them onto the volume would mean pointingXDG_CACHE_HOMEthere, which would also move the uv and Hugging Face caches.docs/uk-cut-anyone.mddescribes.run_uk_cut.py's assemble, publish and promote steps are broken separately until Publish run_uk_cut.py builds through the emitter and refuse new direct Hugging Face imports #1743 merges.Deployment
This changes a Modal image definition. Every environment variable and secret the changed code reads or declares:
MICROCOSM_EMITTER_COMMAND(new)modal.Image.envin_image(); a fixed path, not a credentialcut()'senv(copied fromos.environ) →run_uk_cut.py→microcosm-emitter-interfacein the build and the preflight. Verified in tests on the definition only; not on a built imageUV_TOOL_BIN_DIR(new)UV_LINK_MODE,PYTHONDONTWRITEBYTECODEHF_TOKENmodal run, sent as an ephemeral secret (modal.Secret.from_dict) only withMICROCOSM_UK_CUT_MODAL_RUN=1(unchanged)cut()'senv→run_uk_cut.py→ the emitter, its child process, which writes to the Hub with it and exchanges it for a collector session. Withheld fromuv sync. The emitter's use of it on Modal is unverified (never run)MICROCOSM_UK_TERMINAL_GATE_SIGNING_KEYHF_TOKEN; preflight removes it from the environment while the emitter starts, and the runner gives it only to the steps that sign or verifyMICROCOSM_UK_CUT_MODAL_RUNUV_PYTHON_DOWNLOADS(new)modal.Image.envin_image();never, not a credentialuv syncand any later uv call; verified on the definition onlyThe launcher sets no collector-token variables (
MICROCOSM_COLLECTOR_TOKEN,MICROCOSM_COLLECTOR_TOKEN_EXPIRES_AT,MICROCOSM_COLLECTOR_ORIGIN), noXDG_CACHE_HOMEand noMICROCOSM_TELEMETRY_REQUIRED, as before.Review
Round 1 (head
e376b4e5c): one high-priority bug, fixed. The emitter install resolved unhashed dependencies with uv 0.11.7, the base's pip 25.3 and an old CA store, all trusting the compromised eMudhra roots, so code swapped in there would run withHF_TOKENand the signing key. The test isbb2823ad1and the fix9b09e7f38, as above. Of its code-quality points, the following are also done in9b09e7f38:docs/orrery-publication.mddrift is fixed;UV_PYTHON_DOWNLOADS=neveris set.The parsing stays duplicated in the UK launcher rather than shared, so the container needs no copy of the US plan module; the equality tests cover it.
Round 2 (head
9b09e7f38): one low-priority bug, fixed. The plan took anygit showfailure as "no minimum file", so an unreadable commit got through; the test isf24ebf919and the fixbd1a22381. Its code-quality points are also done inbd1a22381: the certifi floor, the build adapter's comment, and when Modal rebuilds the emitter's layer.Round 3 (head
bd1a22381): no bugs. It checkedgit ls-treeandgit showagainst real git (a present file, a commit before Record how many telemetry events a Modal stage's emitter left undelivered #1522, a missing commit), ran all 22 cases (pass), and found the certifi floor does not conflict with Modal's own client packages. Its code-quality points are left, so as not to restart CI again for them:gitchecks neither argument order nor working directory. The real call depends on both: run fromtools/,git ls-treewould list nothing and the plan would let the commit through. Adding--full-tree, one constant for the repository root, and a stand-in that checks the exact argv andcwdwould harden it. Also, no test coversls-treelisting the file whilegit showfails.plan()insidemodal rundoesn't mention credentials. It doesn't say the credentials already reached Modal, unlikemain()'s own refusal. That isn't a defect, since the operator opted in and passed--run.docs/uk-cut-anyone.mdkeeps its earlier item "The app and its image, built from the pushed commit". The image is defined by the launching checkout, and the container clones the commit at run time. That item predates this PR, but the new bullet beside it makes the difference visible.Found, not changed
tools/modal_rebuild_uk_chronicle_artifact.py) has the same certificate exposure: uv 0.11.7 through the base's pip, noca-certificatesupgrade, withHF_TOKENon a deliberate upload. It is outside this PR.What the merge waits for
Nothing in the tracker. Anthony marks it ready and merges it. Text conflicts are possible with #1743 and #1538 in
docs/uk-cut-anyone.md; #1743's hunks there end before the Modal section. Whichever merges second resolves them.🤖 Generated with Claude Code