Compare commits
6 Commits
feat/claud
...
worktree-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afa1c03d5a | ||
| d6806f386f | |||
|
|
1171d965e8 | ||
| 2925d86447 | |||
|
|
ce9c968301 | ||
| db8b4d0406 |
@@ -110,7 +110,7 @@ job "blaaai" {
|
|||||||
template {
|
template {
|
||||||
data = <<EOT
|
data = <<EOT
|
||||||
# Subscription auth for the claude CLI (generate with `claude setup-token`)
|
# Subscription auth for the claude CLI (generate with `claude setup-token`)
|
||||||
CLAUDE_CODE_OAUTH_TOKEN={{ key "blaaai/claude_oauth_token" }}
|
CLAUDE_CODE_OAUTH_TOKEN={{ key "blaaai/claude_auth_token" }}
|
||||||
# Kept for BLAAAI_BACKEND=api fallback
|
# Kept for BLAAAI_BACKEND=api fallback
|
||||||
ANTHROPIC_API_KEY={{ key "blaaai/anthropic_api_key" }}
|
ANTHROPIC_API_KEY={{ key "blaaai/anthropic_api_key" }}
|
||||||
HARBOR_ROBOT_TOKEN={{ key "blaaai/harbor_robot_token" }}
|
HARBOR_ROBOT_TOKEN={{ key "blaaai/harbor_robot_token" }}
|
||||||
@@ -120,7 +120,7 @@ EOT
|
|||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 1000
|
cpu = 500 # autobox CPU is nearly full; reservation is a floor, procs still burst
|
||||||
memory = 1024 # claude CLI (Node) + chromium need more headroom than the API client
|
memory = 1024 # claude CLI (Node) + chromium need more headroom than the API client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
score.py
8
score.py
@@ -88,9 +88,15 @@ def _call_cli(prompt: str) -> tuple[str, int, int, float]:
|
|||||||
"--max-turns", str(CLI_MAX_TURNS),
|
"--max-turns", str(CLI_MAX_TURNS),
|
||||||
"--disallowed-tools", "Bash,Edit,Write,Read,WebSearch,WebFetch",
|
"--disallowed-tools", "Bash,Edit,Write,Read,WebSearch,WebFetch",
|
||||||
]
|
]
|
||||||
|
# ANTHROPIC_API_KEY in the env takes precedence over the OAuth token and makes
|
||||||
|
# the CLI do API-key auth (401 "Invalid API key"). Strip it so the subscription
|
||||||
|
# token is used; the api backend still sees it via os.environ.
|
||||||
|
cli_env = {k: v for k, v in os.environ.items() if k != "ANTHROPIC_API_KEY"}
|
||||||
|
|
||||||
last_err = ""
|
last_err = ""
|
||||||
for attempt in range(CLI_RETRIES):
|
for attempt in range(CLI_RETRIES):
|
||||||
proc = subprocess.run(cmd, input=prompt, capture_output=True, text=True, timeout=CLI_TIMEOUT)
|
proc = subprocess.run(cmd, input=prompt, capture_output=True, text=True,
|
||||||
|
timeout=CLI_TIMEOUT, env=cli_env)
|
||||||
if proc.returncode != 0 or not proc.stdout.strip():
|
if proc.returncode != 0 or not proc.stdout.strip():
|
||||||
last_err = f"exit {proc.returncode}: {(proc.stderr or proc.stdout)[:300]}"
|
last_err = f"exit {proc.returncode}: {(proc.stderr or proc.stdout)[:300]}"
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user