fix(opencode): use inference.tinfoil.sh + attach TUI + NO_COLOR
Three fixes discovered during first live run: - inference host is inference.tinfoil.sh not api.tinfoil.sh (control plane only serves /v1/models, not /v1/chat/completions) - opencode run exits after one turn; switch to opencode attach for the persistent TUI, then ping_session sends the kickoff prompt - NO_COLOR=1 suppresses the first-run interactive theme picker Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -205,10 +205,12 @@ def start_agent(role, session, workdir):
|
||||
cmd = f"{CLAUDE_BIN} {rc} {model_flag} {CLAUDE_FLAGS} \"$(cat '{kf}')\""
|
||||
log(f"starting {session} (backend=claude, phase={pid}, plan={plan}, model={LOOP_MODEL or 'default'})")
|
||||
elif BACKEND == "opencode":
|
||||
# `opencode attach` is the persistent TUI (stays alive in tmux, like the claude TUI).
|
||||
# We attach to the shared server, then send the kickoff message via tmux send-keys.
|
||||
# The server stores the session by title; NO_COLOR=1 skips the first-run theme picker.
|
||||
cmd = (
|
||||
f"set -a; . /srv/cc-ci/.testenv; set +a; "
|
||||
f"{OPENCODE_BIN} {model_flag} run --attach '{OPENCODE_SERVER}' "
|
||||
f"--title '{session}' \"$(cat '{kf}')\""
|
||||
f"NO_COLOR=1 {OPENCODE_BIN} {model_flag} attach '{OPENCODE_SERVER}'"
|
||||
)
|
||||
log(f"starting {session} (backend=opencode, phase={pid}, model={LOOP_MODEL or 'default'})")
|
||||
log(f" visible at http://oc.commoninternet.net (tailnet only)")
|
||||
@ -218,6 +220,12 @@ def start_agent(role, session, workdir):
|
||||
subprocess.run(["tmux", "new-session", "-d", "-s", session, "-c", workdir, cmd])
|
||||
pipe_to_log(session, f"{LOG_DIR}/{session}.log")
|
||||
|
||||
# opencode: send the kickoff prompt once the TUI is ready (give it a moment to connect).
|
||||
if BACKEND == "opencode":
|
||||
time.sleep(4)
|
||||
kickoff_text = kf.read_text().strip()
|
||||
ping_session(session, kickoff_text)
|
||||
|
||||
def start_loops():
|
||||
start_agent("builder", BUILDER_SESSION, BUILDER_DIR)
|
||||
start_agent("adversary", ADV_SESSION, ADV_DIR)
|
||||
|
||||
Reference in New Issue
Block a user