diff --git a/first-chunk-e2e/first_chunk.py b/first-chunk-e2e/first_chunk.py index 02c63546..44291016 100644 --- a/first-chunk-e2e/first_chunk.py +++ b/first-chunk-e2e/first_chunk.py @@ -21,6 +21,9 @@ CONFIG = HOME / ".config/build-release/first-project/config.toml" OWN_INSTRUCTION = "Sign every reply as the newcomer's own claude." # A heading of the setup's CLAUDE.md, which the worker's request holds where the loop's home loaded. SETUP_INSTRUCTION = "## Working loop" +# What build-release asks a project's first chunk, and the model the newcomer types: one on the shipped routing ladder. +MODEL_QUESTION = "name claude --model takes:" +MODEL = "claude-opus-5-5" # How long the chunk may take. One on the mock takes under a minute. PATIENCE = 300 README = """# first-project @@ -95,6 +98,13 @@ def windows() -> str: return "\n".join(subprocess.run(["tmux", "capture-pane", "-p", "-J", "-S", "-200", "-t", pane], capture_output=True, text=True).stdout.strip() for pane in listed) +def model_typed(deadline: float) -> None: + """Types the project's model into the chunk's window once build-release asks for it there.""" + while MODEL_QUESTION not in windows() and time.monotonic() < deadline: + time.sleep(1) + subprocess.run(["tmux", "send-keys", "-t", "loop-first-project:", MODEL, "Enter"], capture_output=True) + + def failures(requests: mock_messages_api.Requests, before: dict[str, str]) -> list[str]: """Each way the run broke what it checks.""" found = [] @@ -122,6 +132,8 @@ def main() -> int: env = {**os.environ, "ANTHROPIC_BASE_URL": f"http://127.0.0.1:{server.server_port}", "CLAUDE_CODE_OAUTH_TOKEN": "mock-token"} started = subprocess.run([str(CLONE / "bin" / "build-release"), "Write a note of what the project is for."], cwd=PROJECT, env=env, stdin=subprocess.DEVNULL) deadline = time.monotonic() + PATIENCE + if started.returncode == 0: + model_typed(deadline) while started.returncode == 0 and not chunk_finished() and time.monotonic() < deadline: time.sleep(1) found = [f"build-release exited {started.returncode}"] if started.returncode else failures(requests, before)