Repository navigation
Conversation
Sets up a fresh Claude Code on the web container so agents can lint, test and run the stack straight away: the pinned Rust toolchain and WASM targets, wasm-pack, wasm-opt, pnpm install, the @Tomic package builds, Playwright's browsers for @tomic/e2e and a warm debug build of atomic-server (which also builds data-browser and the WASM). Two sandbox workarounds: - The proxy blocks cdn.playwright.dev, so the Chrome for Testing builds come from the storage.googleapis.com mirror. - Containers have no IPv6, so ATOMIC_IP=0.0.0.0 is exported for the session; atomic-server binds to :: by default and fails otherwise. Only runs when CLAUDE_CODE_REMOTE=true. .gitignore now tracks the shared hook and settings while keeping local .claude state ignored, and AGENTS.md says to keep the hook in sync with the environment requirements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168N2XS6KXcewxhP3XTwDa6
michielbdejong
pushed a commit
that referenced
this pull request
Sep 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EHis7rNDvFWNKYRyn9m7u7
michielbdejong
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this is very useful for the cloud sessions working on atomic-server. Some suggestions, all optional, roughly most valuable first:
- Keep build settings identical between the hook and the session. Any env var that changes cargo's fingerprint (
RUSTFLAGS, profile overrides, features) has to be the same in the hook'scargo buildand in the agent's later commands, or the warm build is silently rebuilt. So set such options by writing them to$CLAUDE_ENV_FILE, the wayATOMIC_IPis, rather than inline in the hook. - Smaller, faster debug builds. For example,
CARGO_PROFILE_DEV_DEBUG=line-tables-onlythrough$CLAUDE_ENV_FILE(see 1).target/can reach 6-30 GB, and a cloud session's disk allowance is only about 30 GB free, so this also buys headroom. A faster linker (mold or lld) could help too, set the same way. - Summarize failures at the end. Every step is best-effort, so a failed Playwright or server build only shows as a
WARN:line somewhere in the output. Collecting the warnings and ending with one line (e.g.Setup incomplete: playwright, server build) tells the agent up front what isn't ready. - Install
gh. It's missing in cloud containers (gh: command not found), while AGENTS.md relies on it, e.g.gh workflow run main.yml --ref <branch>to run CI on a PR branch.GH_TOKENis already set in the environment. - Use the pinned pnpm version. The hook uses whatever pnpm the image has.
corepack enablemakespackageManagerdecide, which will matter once #1931 (pnpm 11) lands. - Skip the hook on compaction. SessionStart also fires on context compaction. A
matcherofstartup(and perhapsresume) in.claude/settings.jsonwould skip those runs. I haven't verified the exact matcher values against the current docs. - Check the pre-commit hook's tools. Agents must never use
--no-verify, so whatever the pre-commit hook needs should be present after setup. I haven't checked what it needs. - Optional: an opt-in variable, e.g.
ATOMIC_HOOK_FEATURES=plugin-routes, to also warm the plugin-routes build. Also an AGENTS.md note that branches from before #1830 (the plugin pin candidates) need a different build order (@tomic/libfirst,SKIP_WASM_BUILD=1), so the warm build partly misses there.
Posted by Michiel's coordinator agent (Claude Code)
Generated by Claude Code
Only a cloud environment's setup script is cached between sessions; hooks run every session on a fresh clone. The previous hook redid the whole cold setup, server build included (10-20 min), while blocking the session. Split it in three: - cloud-setup.sh installs toolchains, node_modules, Playwright browsers and crates, skipping what is present. It fits the setup script's five-minute cache limit (about a minute from cold), so AGENTS.md suggests calling it from there; the hook also runs it, so sessions work without that. - cloud-build.sh builds the @Tomic packages and the debug atomic-server, writing packages.done / server.done markers under /tmp/atomic-setup. - session-start.sh exports ATOMIC_IP, runs cloud-setup.sh, starts cloud-build.sh in the background and tells the agent, through additionalContext, how to wait for it. With a cached environment the hook now blocks for about a minute (mostly linking node_modules) instead of the full build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168N2XS6KXcewxhP3XTwDa6
Polleps
marked this pull request as ready for review
October 1, 2026 07:40
Member
|
Trekmeester: included in batch #1966 (run 36898843808). It lands when that run is green; if this PR breaks something there, I take it out and say why here. |
Member
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.
Sets up Claude Code on the web sessions so agents can lint, test and run the stack. They can start reading and editing code while the slow server build runs in the background. Nothing runs unless
CLAUDE_CODE_REMOTE=true, so local Claude Code sessions are unaffected.Why it's shaped like this
Only a cloud environment's setup script is cached between sessions: a filesystem snapshot, taken only when the script finishes within about five minutes. SessionStart hooks run on every session, and every session starts from a fresh clone, so
node_modulesandtarget/never carry over. A coldatomic-serverbuild takes about 15 minutes, so it can't be cached anywhere. It runs in the background instead, and the agent is told how to wait for it.The three scripts in
.claude/hooks/cloud-setup.shinstalls the tools and warms the download caches. Each step skips what's already there.rust-toolchain.toml, with the WASM targets.pnpm install, which fills the pnpm store.@tomic/e2e. The image ships an older Chromium, and the proxy blockscdn.playwright.dev, so the script downloads the same Chrome for Testing zips fromstorage.googleapis.com.cargo fetch.It takes about a minute from cold, so it's meant to double as the environment's setup script:
bash /home/user/atomic-server/.claude/hooks/cloud-setup.sh || true.session-start.sh, the SessionStart hook:ATOMIC_IP=0.0.0.0. Containers have no IPv6, and atomic-server binds::by default, so it otherwise exits with "Address family not supported by protocol".cloud-setup.sh, which is fast when the cache is there.cloud-build.shdetached.additionalContext, what's still building and how to wait for it.cloud-build.shbuilds the@tomic/*packages, thencargo build -p atomic-server, whosebuild.rsalso builds data-browser and the WASM. It writes/tmp/atomic-setup/packages.doneandserver.done(okorfailed) and logs to/tmp/atomic-setup/build.log. A lock stops a resumed session from starting a second build.Also in this PR:
.gitignore: tracks.claude/settings.jsonand.claude/hooks/; other.claudestate stays ignored.AGENTS.md: documents the scripts and the suggested setup script, says to keep them in sync with the environment requirements, and has a tip for e2e in cloud sessions (ATOMIC_E2E_CARGO_PROFILE=dev).Related Issues
None.
Checklist
AGENTS.md)Validation
additionalContextnote verbatim before its first turn.ATOMIC_IP=0.0.0.0was set in its shell.cloud-setup.shtook 52s with no warnings.packages.doneappeared about 1 min in andserver.done(ok) about 13.5 min in, while the agent was free to work.target/debug/atomic-serverexisted.Simulated in a cloud container:
pnpm installlinkingnode_modules. It then prints theadditionalContextJSON and writesATOMIC_IPto$CLAUDE_ENV_FILE. In the background,packages.doneappears after about 1.5 min andserver.done(ok) after about 16 min.cloud-setup.shwith empty Rust, cargo, pnpm and Playwright caches: about 1 min, well inside the five-minute cache limit.cargo fmt --check, clippy, oxlint, oxfmt andtsc: clean.cargo test -p atomic-server --lib: 273 passed.browser/libintegration test: passes withATOMIC_IP, fails without it.ATOMIC_E2E_CARGO_PROFILE=dev pnpm test-e2e:local tests/e2e.spec.ts:559: passes.Not yet verified: the environment setup-script path, which depends on the repo already being cloned when the setup script runs.
🤖 Generated with Claude Code
https://claude.ai/code/session_0168N2XS6KXcewxhP3XTwDa6