feat(harness): add interactive modes and GPU selection - #611
Conversation
There was a problem hiding this comment.
4 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="harness/clients/common.sh">
<violation number="1" location="harness/clients/common.sh:179">
P2: If the OpenClaw config preflight fails or times out, `set -e` exits `run_with_timeout` before the heartbeat cleanup runs, leaving its background loop alive and continuing to emit progress. Install heartbeat cleanup in an unconditional trap or run the wrapped command through an errexit-safe conditional.</violation>
<violation number="2" location="harness/clients/common.sh:395">
P2: When the HIP server uses default or `TARGET_DEVICE=auto:0` placement, `finish_report` invokes `nvidia-smi` because `auto:0` is never resolved to HIP. Resolve `auto` from the actual server backend before selecting the GPU tool, or make startup expose the resolved backend.</violation>
<violation number="3" location="harness/clients/common.sh:404">
P3: The rocm-smi `--device` selection only handles a single-integer HIP_VISIBLE_DEVICES. Comma-separated lists (documented for dual-GPU HIP runs) fail the `^[0-9]+$` regex, so --device is dropped and rocm-smi reports all devices instead of the selected slot. Consider splitting the list on commas and passing the mapped runtime-index list, or drop --device entirely since HIP_VISIBLE_DEVICES already scopes visibility.</violation>
</file>
<file name="harness/clients/run_codex.sh">
<violation number="1" location="harness/clients/run_codex.sh:44">
P2: The interactive Codex branch drops `--skip-git-repo-check`, which the one-shot path explicitly uses, so a `codex --cd <dir>` TUI can fail to open when that directory is not a git repo. Add the flag to the interactive command for parity with the non-interactive launcher.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| tail -n 120 "$SERVER_LOG" || true | ||
| echo "--- gpu ---" | ||
| nvidia-smi --query-gpu=name,memory.used,memory.total,utilization.gpu --format=csv,noheader || true | ||
| local resolved_backend="${TARGET_DEVICE%%:*}" |
There was a problem hiding this comment.
P2: When the HIP server uses default or TARGET_DEVICE=auto:0 placement, finish_report invokes nvidia-smi because auto:0 is never resolved to HIP. Resolve auto from the actual server backend before selecting the GPU tool, or make startup expose the resolved backend.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At harness/clients/common.sh, line 395:
<comment>When the HIP server uses default or `TARGET_DEVICE=auto:0` placement, `finish_report` invokes `nvidia-smi` because `auto:0` is never resolved to HIP. Resolve `auto` from the actual server backend before selecting the GPU tool, or make startup expose the resolved backend.</comment>
<file context>
@@ -304,5 +392,24 @@ finish_report() {
tail -n 120 "$SERVER_LOG" || true
echo "--- gpu ---"
- nvidia-smi --query-gpu=name,memory.used,memory.total,utilization.gpu --format=csv,noheader || true
+ local resolved_backend="${TARGET_DEVICE%%:*}"
+ if [[ -z "$TARGET_DEVICE" ]] && grep -Eq 'target_device[[:space:]]*=[[:space:]]*hip:' "$SERVER_LOG"; then
+ resolved_backend="hip"
</file context>
|
|
||
| local started_at heartbeat_pid rc elapsed | ||
| started_at="$(date +%s)" | ||
| ( |
There was a problem hiding this comment.
P2: If the OpenClaw config preflight fails or times out, set -e exits run_with_timeout before the heartbeat cleanup runs, leaving its background loop alive and continuing to emit progress. Install heartbeat cleanup in an unconditional trap or run the wrapped command through an errexit-safe conditional.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At harness/clients/common.sh, line 179:
<comment>If the OpenClaw config preflight fails or times out, `set -e` exits `run_with_timeout` before the heartbeat cleanup runs, leaving its background loop alive and continuing to emit progress. Install heartbeat cleanup in an unconditional trap or run the wrapped command through an errexit-safe conditional.</comment>
<file context>
@@ -118,18 +157,53 @@ run_with_timeout() {
+
+ local started_at heartbeat_pid rc elapsed
+ started_at="$(date +%s)"
+ (
+ while sleep 10; do
+ elapsed=$(( $(date +%s) - started_at ))
</file context>
| < /dev/null > "$CLIENT_OUT" 2>&1 | ||
| RC=$? | ||
| if [[ "$HARNESS_INTERACTIVE" == "1" ]]; then | ||
| codex_cmd=("$CODEX_BIN" --cd "$REPO_DIR" --sandbox "$CODEX_SANDBOX" --model "$MODEL_ID") |
There was a problem hiding this comment.
P2: The interactive Codex branch drops --skip-git-repo-check, which the one-shot path explicitly uses, so a codex --cd <dir> TUI can fail to open when that directory is not a git repo. Add the flag to the interactive command for parity with the non-interactive launcher.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At harness/clients/run_codex.sh, line 44:
<comment>The interactive Codex branch drops `--skip-git-repo-check`, which the one-shot path explicitly uses, so a `codex --cd <dir>` TUI can fail to open when that directory is not a git repo. Add the flag to the interactive command for parity with the non-interactive launcher.</comment>
<file context>
@@ -38,22 +38,29 @@ start_lucebox_server
- < /dev/null > "$CLIENT_OUT" 2>&1
-RC=$?
+if [[ "$HARNESS_INTERACTIVE" == "1" ]]; then
+ codex_cmd=("$CODEX_BIN" --cd "$REPO_DIR" --sandbox "$CODEX_SANDBOX" --model "$MODEL_ID")
+ if [[ -n "$INTERACTIVE_PROMPT" ]]; then codex_cmd+=("$INTERACTIVE_PROMPT"); fi
+ run_interactive_client "Codex" "$CLIENT_OUT" env "${codex_env[@]}" "${codex_cmd[@]}"
</file context>
| codex_cmd=("$CODEX_BIN" --cd "$REPO_DIR" --sandbox "$CODEX_SANDBOX" --model "$MODEL_ID") | |
| codex_cmd=("$CODEX_BIN" --cd "$REPO_DIR" --skip-git-repo-check --sandbox "$CODEX_SANDBOX" --model "$MODEL_ID") |
| if [[ "$resolved_backend" == "hip" ]]; then | ||
| if command -v rocm-smi >/dev/null 2>&1; then | ||
| local rocm_device_args=() | ||
| if [[ "${HIP_VISIBLE_DEVICES:-}" =~ ^[0-9]+$ ]]; then |
There was a problem hiding this comment.
P3: The rocm-smi --device selection only handles a single-integer HIP_VISIBLE_DEVICES. Comma-separated lists (documented for dual-GPU HIP runs) fail the ^[0-9]+$ regex, so --device is dropped and rocm-smi reports all devices instead of the selected slot. Consider splitting the list on commas and passing the mapped runtime-index list, or drop --device entirely since HIP_VISIBLE_DEVICES already scopes visibility.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At harness/clients/common.sh, line 404:
<comment>The rocm-smi `--device` selection only handles a single-integer HIP_VISIBLE_DEVICES. Comma-separated lists (documented for dual-GPU HIP runs) fail the `^[0-9]+$` regex, so --device is dropped and rocm-smi reports all devices instead of the selected slot. Consider splitting the list on commas and passing the mapped runtime-index list, or drop --device entirely since HIP_VISIBLE_DEVICES already scopes visibility.</comment>
<file context>
@@ -304,5 +392,24 @@ finish_report() {
+ if [[ "$resolved_backend" == "hip" ]]; then
+ if command -v rocm-smi >/dev/null 2>&1; then
+ local rocm_device_args=()
+ if [[ "${HIP_VISIBLE_DEVICES:-}" =~ ^[0-9]+$ ]]; then
+ rocm_device_args=(--device "$HIP_VISIBLE_DEVICES")
+ fi
</file context>
Summary
HARNESS_INTERACTIVE=1TUI sessions for the existing Claude Code, Codex, OpenCode, Hermes, Pi, and OpenClaw launchers while preserving deterministic one-shot defaultsTARGET_DEVICE/DRAFT_DEVICEplacement on top of standard CUDA/HIP visibility controls, including dual-architecture HIP documentation.harness-work/interactive/, show startup/client heartbeats, and report GPU status with the backend-appropriate NVIDIA or ROCm toolValidation
bash -n harness/clients/*.sh harness/tests/test_client_launcher_timeouts.shbash harness/tests/test_client_launcher_timeouts.shbash harness/tests/test_run_pi_timeout.sh harness/clients/run_pi.shpython3 -m py_compile harness/client_test_runner.py harness/clients/summarize_backend_pair.pyuv run --frozen --extra dev ruff check .HIP live validation
Run on the HIP-only validation host with the available Radeon 8060S (
gfx1151) selected via:HIP_VISIBLE_DEVICES=1TARGET_DEVICE=hip:0DRAFT_DEVICE=hip:0Passed:
/healthand exact responsehip-live-okclaude_code,codex,hermes,openclaw,openwebui,opencode,pi)hip-interactive-codex-okgfx1151Deferred validation
The HIP validation is complete for the available server and client paths.