-
Notifications
You must be signed in to change notification settings - Fork 0
chore(score): env-overridable scorer model + the Opus-vs-Sonnet calibration finding #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,19 @@ MD="$1"; STATE="$2"; RUBRIC="$3"; SCHEMA="$4"; OUT="$5" | |
| # budget ($6) accepted for API parity but unused — OpenClaw manages quota | ||
| BUDGET="${6:-1.50}" | ||
|
|
||
| AGENT="${CLAWDND_SCORER_AGENT:-clawdnd-qa}" | ||
| MODEL="${CLAWDND_SCORER_MODEL:-openai/gpt-5.4}" | ||
| # Default agent = `main` (the canonical gateway agent; the old `clawdnd-qa` default isn't configured on | ||
| # every host). By DEFAULT pass NO --model override (use the agent's native model, e.g. main=gpt-5.5) — | ||
| # many gateway agents REJECT a foreign model override ("Model override … is not allowed for agent"). | ||
| # Only pass one when CLAWDND_SCORER_MODEL is explicitly set AND allowed for the agent. | ||
| AGENT="${CLAWDND_SCORER_AGENT:-main}" | ||
| MODEL="${CLAWDND_SCORER_MODEL:-}" | ||
| MODEL_ARGS=(); [ -n "$MODEL" ] && MODEL_ARGS=(--model "$MODEL") | ||
| # A fresh session id per scoring run so a scorer turn never pollutes the agent's main session. | ||
| SESSION_ID="${CLAWDND_SCORER_SESSION:-qa-score-$(basename "${OUT%.json}")}" | ||
| # openclaw agent has NO stdin/file message input — the prompt is a single --message argv, bounded by | ||
| # MAX_ARG_STRLEN (~128KB). The state.json alone can be ~140KB, so cap it (the distilled transcript | ||
| # carries the prose; the state is supplementary ground-truth). Tune via CLAWDND_SCORER_STATE_CAP. | ||
| STATE_CAP="${CLAWDND_SCORER_STATE_CAP:-75000}" | ||
| # 600s: large rubrics (angry_dm ~32KB) + long transcripts (~100KB) need the room | ||
| GATEWAY_TIMEOUT="${CLAWDND_SCORER_TIMEOUT:-600}" | ||
|
|
||
|
|
@@ -41,14 +52,17 @@ r = open(sys.argv[1]).read() | |
| s = open(sys.argv[2]).read() | ||
| m = open(sys.argv[3]).read() | ||
| st = open(sys.argv[4]).read() | ||
| cap = int(sys.argv[5]) | ||
| if len(st) > cap: | ||
| st = st[:cap] + '\n…[FINAL STATE truncated to fit the gateway message size limit]…\n' | ||
|
Comment on lines
+55
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find state.json files and check sizes against the 75KB cap
fd -e json -x sh -c 'size=$(wc -c < "{}"); if [ "$size" -gt 75000 ]; then echo "{}: $size bytes (exceeds 75KB cap)"; fi' \; | head -20Repository: electricsheephq/WorldOS Length of output: 1043 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== qa/score_openclaw.sh lines 45-90 =="
nl -ba qa/score_openclaw.sh | sed -n '45,90p'
echo
echo "== Search in qa/score_openclaw.sh for key strings =="
rg -n "sys\.argv\[5\]|CLAWDND_SCORER_STATE_CAP|st\s*\[:cap\]|FINAL STATE|ground truth|json\.loads|json\.dumps" qa/score_openclaw.sh || true
echo
echo "== Find files that match state.json exactly (and *state*.json) and check size > 75KB =="
# exact state.json
fd -i 'state.json' -e json -t f --exec sh -c 's=$(wc -c < "{}"); if [ "$s" -gt 75000 ]; then echo "{}: ${s} bytes"; fi' \; 2>/dev/null | head -50 || true
echo
# any file containing "state" in name (useful if naming differs)
fd -i '*state*.json' -e json -t f --exec sh -c 's=$(wc -c < "{}"); if [ "$s" -gt 75000 ]; then echo "{}: ${s} bytes"; fi' \; 2>/dev/null | head -50 || trueRepository: electricsheephq/WorldOS Length of output: 167 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== qa/score_openclaw.sh lines 45-90 =="
nl -ba qa/score_openclaw.sh | sed -n '45,90p'
echo
echo "== Search in qa/score_openclaw.sh for key strings =="
rg -n "sys\.argv\[5\]|CLAWDND_SCORER_STATE_CAP|st\s*\[:cap\]|FINAL STATE|ground truth|json\.loads|json\.dumps" qa/score_openclaw.sh || true
echo
echo "== Find files that match state.json exactly (and *state*.json) and check size > 75KB =="
# exact state.json
fd -i 'state.json' -e json -t f --exec sh -c 's=$(wc -c < "{}"); if [ "$s" -gt 75000 ]; then echo "{}: ${s} bytes"; fi' \; 2>/dev/null | head -50 || true
echo
# any file containing "state" in name (useful if naming differs)
fd -i '*state*.json' -e json -t f --exec sh -c 's=$(wc -c < "{}"); if [ "$s" -gt 75000 ]; then echo "{}: ${s} bytes"; fi' \; 2>/dev/null | head -50 || trueRepository: electricsheephq/WorldOS Length of output: 167 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== qa/score_openclaw.sh lines 45-90 =="
sed -n '45,90p' qa/score_openclaw.sh | awk '{printf "%4d\t%s\n", NR+44, $0}'
echo
echo "== Search in qa/score_openclaw.sh for key strings =="
rg -n "sys\.argv\[5\]|CLAWDND_SCORER_STATE_CAP|st\s*\[:cap\]|json\.loads|json\.dumps" qa/score_openclaw.sh || true
echo
echo "== Find files that match state.json exactly (and *state*.json) and check size > 75KB =="
fd -i 'state.json' -e json -t f --exec sh -c 's=$(wc -c < "{}"); if [ "$s" -gt 75000 ]; then echo "{}: ${s} bytes"; fi' \; 2>/dev/null | head -50 || true
echo
fd -i '*state*.json' -e json -t f --exec sh -c 's=$(wc -c < "{}"); if [ "$s" -gt 75000 ]; then echo "{}: ${s} bytes"; fi' \; 2>/dev/null | head -50 || trueRepository: electricsheephq/WorldOS Length of output: 2535 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== qa/score_openclaw.sh (head) =="
sed -n '1,120p' qa/score_openclaw.sh
echo
echo "== qa/score_openclaw.sh (rest) =="
sed -n '120,260p' qa/score_openclaw.sh
echo
echo "== Find how score_openclaw is invoked / STATE arg meaning =="
rg -n "score_openclaw\.sh|score_openclaw" -S . || trueRepository: electricsheephq/WorldOS Length of output: 7500 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "CLAWDND_SCORER_STATE_CAP" -S . || true
rg -n "SCORER_STATE_CAP|STATE_CAP" -S qa WorldOS-RUNBOOK.md qa/SCORING.md qa/QA_TOOLS.md || trueRepository: electricsheephq/WorldOS Length of output: 548 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== score_openclaw call sites =="
rg -n "score_openclaw\.sh" -S . || true
echo
echo "== QA_TOOLS.md context =="
sed -n '60,120p' qa/QA_TOOLS.md || true
echo
echo "== qa/SCORING.md context =="
sed -n '1,120p' qa/SCORING.md || true
echo
echo "== prompt section mentions state parsing? (search for 'FINAL ENGINE STATE' or 'ground truth') =="
rg -n "FINAL ENGINE STATE|ground-truth|ground truth|state.*json|parse.*state" -S qa/score_openclaw.sh qa/SCORING.md qa/QA_TOOLS.md WorldOS-RUNBOOK.md || true
echo
echo "== Find any files literally named state.json in repo =="
fd -i 'state.json' || trueRepository: electricsheephq/WorldOS Length of output: 8905 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "qa/score_openclaw\.sh|score_openclaw\.sh" -S . || true
echo
echo "== Find runner scripts for openclaw scoring =="
fd -e sh -t f qa | xargs -I{} rg -n "openclaw|score_openclaw\.sh|run_duo_openclaw|run_party_openclaw" "{}" || trueRepository: electricsheephq/WorldOS Length of output: 841 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== rg for openclaw usage across repo =="
rg -n "openclaw|score_openclaw\.sh|run_duo_openclaw|run_party_openclaw" -S . || true
echo
echo "== List qa scripts that look openclaw-related =="
fd -i -t f qa -g '*openclaw*' -e sh -e py -e ts -e js || true
echo
echo "== Find where qa/score_openclaw.sh is executed (not just referenced) =="
rg -n "score_openclaw\.sh\s" -S qa . || trueRepository: electricsheephq/WorldOS Length of output: 40529 Fix prompt state truncation to preserve JSON validity (and guard
🤖 Prompt for AI Agents |
||
| prompt = (r + '\n\n# ===== OUTPUT FORMAT =====\n' | ||
| 'Respond with ONLY a single JSON object conforming to this schema' | ||
| ' — no prose, no markdown, no code fences:\n' | ||
| + s + '\n\n# ===== DISTILLED TRANSCRIPT =====\n' | ||
| + m + '\n\n# ===== FINAL ENGINE STATE (ground truth) =====\n' | ||
| + st + '\n') | ||
| sys.stdout.write(prompt) | ||
| " "$RUBRIC" "$SCHEMA" "$MD" "$STATE" > "$PROMPT_FILE" | ||
| " "$RUBRIC" "$SCHEMA" "$MD" "$STATE" "$STATE_CAP" > "$PROMPT_FILE" | ||
|
|
||
| attempt=0 | ||
| while [ "$attempt" -lt 3 ]; do | ||
|
|
@@ -57,7 +71,8 @@ while [ "$attempt" -lt 3 ]; do | |
| # Call the OpenClaw gateway. Reply text is at .result.payloads[0].text | ||
| RAW_REPLY="$(openclaw agent \ | ||
| --agent "$AGENT" \ | ||
| --model "$MODEL" \ | ||
| ${MODEL_ARGS[@]+"${MODEL_ARGS[@]}"} \ | ||
| --session-id "${SESSION_ID}-${attempt}" \ | ||
| --message "$(cat "$PROMPT_FILE")" \ | ||
| --json \ | ||
| --timeout "$GATEWAY_TIMEOUT" \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling for invalid STATE_CAP values.
The
int(sys.argv[5])call will raiseValueErrorifCLAWDND_SCORER_STATE_CAPis set to a non-integer string, producing a cryptic Python traceback instead of a clear error message.🛡️ Proposed fix to add validation
📝 Committable suggestion
🤖 Prompt for AI Agents