fix(minimax-m3-max, fable-low-effort): H-SECRET-4 rejected MAX_THINKING_TOKENS in env

The validator pattern-matches *TOKEN* as credential-shaped and rejected
both contexts, failing every task on the new harnesses. The env var name
is fixed by Claude Code, so deliver the thinking budget via the
settings.json env map in init.sh instead (jq-merge preserves apiKeyHelper
from the minimax/oauth layer).

Claude-Session: https://claude.ai/code/session_019tJk7P8tZzJ24PvtgoGhLN
This commit is contained in:
Paul O'Reilly
2026-09-03 00:39:59 +12:00
parent 2fa4dc92c2
commit 7244e0ec5f
5 changed files with 95 additions and 7 deletions

View File

@@ -0,0 +1,41 @@
#!/bin/bash
# minimax-m3-max init — set MAX_THINKING_TOKENS via Claude Code settings.json.
#
# MAX_THINKING_TOKENS cannot go in the harness env: block — H-SECRET-4
# pattern-matches "*TOKEN*" as credential-shaped and rejects the harness.
# It is plain config (thinking budget), so deliver it through the
# settings.json "env" map instead. Runs after minimax/v1's init.sh, so
# merge into the existing file (which carries apiKeyHelper).
set -euo pipefail
AGENT_USER="${AGENT_USER:-agent}"
AGENT_HOME=$(getent passwd "$AGENT_USER" | cut -d: -f6)
if [ -z "$AGENT_HOME" ] || [ ! -d "$AGENT_HOME" ]; then
AGENT_HOME="/home/$AGENT_USER"
fi
CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$AGENT_HOME/.claude}"
mkdir -p "$CONFIG_DIR"
chown "$AGENT_USER:" "$CONFIG_DIR" 2>/dev/null || true
SETTINGS_FILE="$CONFIG_DIR/settings.json"
THINKING_BUDGET="32000"
if [ -f "$SETTINGS_FILE" ] && command -v jq >/dev/null 2>&1; then
TMP=$(mktemp)
jq --arg v "$THINKING_BUDGET" \
'.env = ((.env // {}) + {MAX_THINKING_TOKENS: $v})' \
"$SETTINGS_FILE" > "$TMP"
mv "$TMP" "$SETTINGS_FILE"
else
cat > "$SETTINGS_FILE" <<EOF
{
"env": { "MAX_THINKING_TOKENS": "$THINKING_BUDGET" }
}
EOF
fi
chown "$AGENT_USER:" "$SETTINGS_FILE" 2>/dev/null || true
chmod 0644 "$SETTINGS_FILE"
echo "minimax-m3-max: MAX_THINKING_TOKENS=$THINKING_BUDGET wired in $SETTINGS_FILE"