Render cost + estimate in the web UI - #42
Merged
Merged
Conversation
The cost endpoints landed in v1.3 but the UI never displayed them. Wire
the existing /submit + /jobs/{id} responses into:
- Latest result card (Invoke tab): 'Estimated max cost' from the submit
response, then 'Actual cost' once the job reaches a terminal status.
Tooltip on the estimate shows the worst-case caveat.
- Job drawer (Invocations tab): 'Cost' chip + a small detail line
showing duration / vCPU / memory / attempts, optionally seconds of
network if auto-install ran.
- Account modal: 'Cost (last 30d)' line that calls /usage/cost?window_days=30
on open and shows total + jobs counted.
Bumped styles.css?v=11 and app.js?v=13 so browsers pick up the new HTML
hooks and JS without a hard refresh dance.
aakri0
added a commit
that referenced
this pull request
May 1, 2026
…ges (#43) The cost-rendering code from #42 only fires when /submit returns an estimated_cost field. If an operator pulls the new web/ but their API container is still the pre-#40 image (e.g. `docker compose up -d` without `--build` after a pull), the field is missing, the row stays hidden, and the UI looks broken with no on-screen explanation. Two changes so this can't bite silently: - onSubmit() now calls /jobs/estimate as a fallback when estimated_cost is missing from the /submit response. The estimate row populates either way, so the user sees the number even on a half-deployed stack (as long as the API has *any* cost endpoint at all). - A console.warn fires when the fallback runs, naming the likely cause ('your API container predates the cost feature: run docker compose up --build -d api'). Operators can paste this into a bug report. Bumped app.js?v=14 so browsers pick up the new code without a hard refresh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The cost endpoints landed in v1.3 but the UI never read them, so users couldn't actually see the numbers. The bug report ('I cannot see the cost estimation on the UI') was correct — the data was sitting in
/submitand/jobs/{id}responses unused.What changed
Three places now show cost. No new API calls beyond responses we already fetch, plus one
/usage/costcall on account-modal open.Latest result card (Invoke tab)
/submitresponse. Shown immediately on submit. Tooltip explains it's a worst-case bound (every attempt to its full timeout).GET /jobs/{id}returns a terminal status. Tooltip carries duration / vCPU / memory / attempts.Job drawer (Invocations tab)
0.18s · 0.5 vCPU · 256 MB · 1 attempt, plusNs netif any auto-install rounds ran.Account modal
/usage/cost?window_days=30and renders$X.XX · N jobs.Verified locally
POST /submit→ response carriesestimated_cost.max_cost_display = "$0.000507".GET /jobs/{id}after the run →cost.cost_display = "$0.000002685",metrics.duration_seconds = 0.181.web/is bind-mounted, so a hard refresh picks upapp.js?v=13+styles.css?v=11with no rebuild.Test plan
(waiting...)once it finishes.Costrow populates with the breakdown chip + detail line.Cost (last 30d)shows total + count.