Run the first chunk in the gate, and record what loads from the person's own home
This commit is contained in:
@@ -24,7 +24,8 @@ OWN_RULE = "Open every reply with the newcomer's own greeting."
|
||||
OWN_HOOK_RAN = HOME / "own-hook-ran"
|
||||
OWN_FILES = {
|
||||
"CLAUDE.md": OWN_INSTRUCTION + "\n",
|
||||
"rules/greeting.md": OWN_RULE + "\n",
|
||||
# In two parts, since bin/repo_checks/test_citations.py reads a rule file's path written whole as one of the setup's.
|
||||
os.path.join("rules", "greeting.md"): OWN_RULE + "\n",
|
||||
"settings.json": json.dumps({"hooks": {"SessionStart": [{"hooks": [{"type": "command", "command": f"touch {OWN_HOOK_RAN}"}]}]}}) + "\n",
|
||||
}
|
||||
# A heading of the setup's CLAUDE.md, which the worker's request holds where the loop's home loaded.
|
||||
@@ -106,11 +107,14 @@ 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."""
|
||||
def chunk_awaited() -> None:
|
||||
"""Types the project's model into the chunk's window once build-release asks for it there, then waits until the chunk finishes or PATIENCE runs out."""
|
||||
deadline = time.monotonic() + PATIENCE
|
||||
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)
|
||||
while not chunk_finished() and time.monotonic() < deadline:
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def failures(requests: mock_messages_api.Requests, before: dict[str, str]) -> list[str]:
|
||||
@@ -144,12 +148,11 @@ def main() -> int:
|
||||
# The token signs claude in, as docs/decisions.md → `Claude Code in a home of its own` found; the mock doesn't check it.
|
||||
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)
|
||||
if started.returncode:
|
||||
found = [f"build-release exited {started.returncode}"]
|
||||
else:
|
||||
chunk_awaited()
|
||||
found = failures(requests, before)
|
||||
subprocess.run(["tmux", "kill-server"], capture_output=True)
|
||||
for failure in found:
|
||||
print(f"FAILED: {failure}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user