Repository navigation
ci: create tasks instead of workspaces in ai triage workflow - #19940
Conversation
DanielleMaywood
left a comment
There was a problem hiding this comment.
Looks good to me although will defer to @mafredri for approval
Co-authored-by: Danielle Maywood <[email protected]>
| # AgentAPI must be stable | ||
| agentapi_status=$(curl \ | ||
| --header "Content-Type: application/json" \ | ||
| --header "Coder-Session-Token: ${CODER_SESSION_TOKEN}" \ | ||
| --location \ | ||
| --request GET \ | ||
| --show-error \ | ||
| --silent \ | ||
| "${CODER_URL}/@${username}/${WORKSPACE_NAME}/apps/agentapi/status" | jq -r '.status') | ||
| if [[ "${response}" == "stable" ]]; then | ||
| "${CODER_URL}/@${username}/${TASK_NAME}/apps/${APP_SLUG}/status" | jq -r '.status') | ||
| if [[ "${agentapi_status}" == "stable" ]]; then | ||
| echo "AgentAPI stable" | ||
| break | ||
| else | ||
| echo "Waiting for AgentAPI to report stable status (attempt ${attempt}/120)" | ||
| sleep 5 | ||
| continue |
There was a problem hiding this comment.
Unfortunately it looks like we may need another wait here, as agentapi will become stable before it starts processing the task. We probably need to wait until the prompt shows up in the messages endpoint or something.
There was a problem hiding this comment.
This ended up looking very similar to what we'd want coder exp task status --watch to be. Will update in a separate PR.
| id: generate-summary | ||
| env: | ||
| ARCHIVE_URL: ${{ steps.create-archive.outputs.archive_url }} | ||
| APP_SLUG: ccw |
There was a problem hiding this comment.
I know we have the required envs check, but I'm wondering if it'd be better to define these traiage.sh envs in one place so they're applied to all action steps?
Mayhaps doing something like this early on:
echo "APP_SLUG=$APP_SLUG" >> "$GITHUB_ENV"
(There's probably a better way to do it.)
Or write a traiage.config.sh which can be sourced in traiage.sh.
There was a problem hiding this comment.
Long-term I want to remove the need for this (e.g by using coder task send). Leaving it here, exposed and ugly, makes it easier to delete later IMO.
| fi | ||
|
|
||
| # AgentAPI application should not be 404'ing | ||
| agentapi_app_status_code=$(curl \ |
There was a problem hiding this comment.
We could be fancy, look up the app URL and do a ssh bash 'while :; curl; if ...; fi; done'.
The only motivation here is to reduce coderd load, though.
There was a problem hiding this comment.
As with app_slug above, I'm disinclined to do fanciness if it can later be incorporated into the CLI.
Depends on #19939