Agents serve the app through one Braid tool that starts it on the run's port, waits until it answers, shows its log and stops it #110
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
An agent that needs the app running starts it itself. That covers trying an endpoint, and
agent.test.browser, whosebrowsersubagent can't start anything (#17). The agent runsnohup … &, loops onsleepandcurluntil the app answers, thenkills orpkills it.nohup24 times across those five runs.curls got "connection refused" 12 times while it waited.Expected
PREVIEW_PORTin the background, waits until it answers HTTP, and returns the URL. If the app exits first, the tool returns the exit code and the end of its log.previewordevscript inpackage.json, and so on.agent.test.browseruses it. A UI check then makes nonohup,sleeporcurlcalls, and thebrowsersubagent gets a URL that is already answering.How
tool/*.{js,ts}from the config folder, and each run's config folder already has the run plugin and@opencode-ai/plugininstalled (#67). So the tool needs no extra process and no extra install, and costs one small schema.Done when a run with a UI change serves its app through the tool and the
browsersubagent checks the page. No production run has done that yet: all 6 Playwright calls so far were in run 22 and all failed, before the--browser chromiumfix.Related: #17, #46, #104, and #109, since the app can't be served before its dependencies are installed.
Shipped in
a2131ea, as the OpenSpec changeapp-tool. It is now archived (9d27890). Its requirements are the newapp-toolspec, andbrowser-checkandagent-delegationare updated.One tool,
app. osfd writes it into each run's opencode config folder astool/app.js. Its arguments are plain JSON Schema, which opencode 1.18.21 accepts, so it needs no install.startruns the command withsh -cin its own process group, withPORTset to$PREVIEW_PORT. It waits up to two minutes forhttp://127.0.0.1:$PREVIEW_PORT/to answer, and returns the URL, or the exit code and the end of the log. It refuses a port that something else holds, and restarts an app it started itself.statusandlogsreport on the app, andstopstops its whole process group.devscript at the root or one directory down.Only where it belongs, and never left running.
browserdelegation guidance andAGENTS.mdsay to use it, and nevernohup … &.Scratch's browser check runs. A project now also counts as servable when it has a package manifest one directory down, or the run has an App command. Every scratch run before this skipped the check as "the project cannot be served".
Verified on production with run 33's
agent.test.browser:appin three start and stop pairs, one of them frontend-only to see the page with the backend down. Each start answered in under 2 s, and each stop reported the port free.browsersubagent's Playwright calls completed, the first ever to succeed on production, and its three checks passed with screenshots.