Add cloud session bootstrap for eval runbook inputs - #1193
Open
charlesyhuang wants to merge 2 commits into
Open
Conversation
The eval runbooks are written against a laptop: a venv at a ~ path, agent CLIs on PATH, secrets in ~/.env. A Claude Code cloud session has none of those, so every one of those steps fails verbatim and each session re-derives the same setup by hand. Add a remote-only SessionStart hook that rebuilds what can be rebuilt -- syncs oddish/ with the documented --extra server, puts the venv on PATH, and bridges configured credentials into ~/.env in a marked block -- then reports one status line per runbook input so a session starts knowing what it has and which secrets are absent. It never invents a credential and always exits 0, so a partial bootstrap degrades a session instead of blocking it. Document the rest in docs/cloud-session-setup.md, since some inputs cannot be rebuilt from inside the container: secrets belong to the environment's variable config, and laptop-only scripts have to reach a repo before a session can see them. Record that oddish has no ~/.oddish credentials file -- config.py reads ODDISH_API_KEY/ODDISH_API_URL from the environment and nothing else -- so that hunt ends at the docs. The hook is not registered in .claude/settings.json here; enabling a hook that auto-runs for everyone who clones the repo is a call for a human to make, and the snippet to do it is in the doc. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NSorCmyqJqywkZF6cKku6n
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6203df8. Configure here.
Two defects found in review, both confirmed in a container. The two PATH exports were appended in sequence, so the second prepended onto the result of the first and ~/.local/bin landed ahead of the venv. That directory ships its own pytest, ruff, black, and mypy -- exactly the tools this repo tests and lints with -- so `pytest` resolved to the user-local copy instead of the project's. Emit a single export with the venv first. SessionStart also fires on resume, clear, and compact, and CLAUDE_ENV_FILE persists across those firings, so the unguarded append stacked another PATH prefix every time a session compacted. Write the line at most once; three consecutive firings now leave one. The uv sync still runs on every firing. That is deliberate: it costs about a second once the cache is warm, and it repairs a venv that is broken or partially installed -- the state that produced the ModuleNotFoundError which pinned --extra server in the first place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NSorCmyqJqywkZF6cKku6n
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.



Problem
The eval runbooks are written against a laptop — a venv at a
~path, agent CLIs onPATH, secrets in~/.env. A Claude Code cloud session has none of that, so those steps fail verbatim and every session re-derives the same setup by hand.Auditing the SWE-Marathon runbook's inputs against a fresh container, most turn out not to need porting so much as translating:
~/oddish/oddish/.venv/bin/oddishuv syncrebuilds it~/.grok/bin/grokXAI_API_KEYvia~/.env~/.envexists~/.oddishcredentials~/cyberpipeline/*.shThe
~/.oddishone is worth calling out:oddish/src/oddish/cli/config.py(get_api_key,get_api_url) readsODDISH_API_KEY/ODDISH_API_URLfrom the environment and nothing else. There is no credentials file and nooddish login, so looking for a dotfile to copy is a dead end.Changes
.claude/hooks/session-start.sh— a remote-only SessionStart hook that rebuilds what can be rebuilt:uv sync --frozen --extra serverinoddish/, producingoddish/.venv/bin/oddish. The--extra servermatches AGENTS.md's documented setup; without it the test suite cannot importsqlalchemy.~/.grok/bin, and~/.local/binonPATHvia$CLAUDE_ENV_FILE~/.envfor scripts thatsourceit, inside a marked block so anything else in the file survivesIt is idempotent, guarded on
CLAUDE_CODE_REMOTEso it no-ops on a laptop, and always exits 0 — a partial bootstrap should degrade a session, not block it. It never invents a credential: an unset variable is reported, not fabricated.AWS_*is deliberately excluded, since the log-bucket credentials are short-lived STS tokens with their own refresh cycle (runbook §6).docs/cloud-session-setup.md— the parts that cannot be automated from inside the container: which variables to set on the environment and where, why trial credentials are Modal secrets rather than session variables, that laptop-only scripts have to reach a repo before a session can see them, and the grok install command for when a session actually needs it.docs/swe-marathon-eval-runbook.md— a pointer from §0 prereqs, where these inputs are first assumed.Not included
The hook is not registered in
.claude/settings.json. That file makes it auto-run for everyone who clones the repo, which is a call for a human to make rather than something to land silently; the snippet is in the doc. Until it is registered the hook is inert.Validation
PATHwritten,~/.envwritten0600✅~/.envsurvives ✅source ~/.envintact, including quotes,$, and spaces ✅CLAUDE_CODE_REMOTEunset — no output, no files created ✅pytest tests/test_links.pyagainst the venv the hook builds: 34 passed ✅ (fails withModuleNotFoundError: sqlalchemywithout--extra server, which is what pinned that flag)pre-commit run --files <changed>: all hooks pass ✅bash -n: clean ✅ (shellcheck is not installed in this container)Not validated: the grok install command in the doc. Fetch-and-run was blocked by this session's permission policy, so it is transcribed from
OddishGrokBuildAgent.install()rather than executed.Generated by Claude Code
Note
Low Risk
Mostly docs and an opt-in bootstrap script that is not registered yet. Credential bridging is careful (names only in logs, marked rewrite, 0600 perms) and does not change product auth.
Overview
Adds a remote-only SessionStart hook so Claude Code cloud sessions can run eval runbooks without a manual laptop-style setup pass.
.claude/hooks/session-start.shrebuilds the missing pieces onCLAUDE_CODE_REMOTE=true: syncs theoddishvenv with--extra server, prepends it toPATHvia$CLAUDE_ENV_FILE, and bridges configured API keys into a marked~/.envblock (mode0600). It reports status and missing secrets by name only, never invents credentials, and always exits 0 so a partial bootstrap degrades rather than blocks the session.Also adds
docs/cloud-session-setup.mdcovering environment variable setup, why trial keys stay as Modal secrets, and on-demand grok install, plus a pointer from the SWE-Marathon runbook prereqs. The hook is not registered in.claude/settings.jsonyet.Reviewed by Cursor Bugbot for commit 09ee550. Bugbot is set up for automated code reviews on this repo. Configure here.