Uh oh!
There was an error while loading. Please reload this page.
feat(resources): 3-layer view (machine / environment / training) + guided change - #361
feat(resources): 3-layer view (machine / environment / training) + guided change#361LukasWodka wants to merge 5 commits into
Conversation
… per-run tb resources used the labels "This machine" (capacity) and "tracebloc uses" (per training run), which confused: "This machine" is actually the summed capacity of the environment's Ready nodes (misleading on a remote/multi-node cluster), and "tracebloc uses" reads like total usage when it's the per-RUN ceiling. Reframe as two plain aligned lines: Your secure environment is equipped with: 12 CPU · 23.3 GiB A training run is allocated up to: 2 CPU · 8 GiB Do you want to change the allocation? Run `tb resources set` (guided ...). - New ui.Printer.Stat: aligned label/value for full-sentence labels (Field's 14-col key is too narrow here). - The trailing hint now resolves the launcher like the home screen (invokedName + tbAliasAvailable) so it reads `tb ...` on a real install and `tracebloc ...` otherwise — fixing the tb/tracebloc inconsistency Lukas spotted. - Value strips the leading "up to " (the label carries it now). Part of epic tracebloc/backend#1142 / cli#355 (copy consistency). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bugbot: the Stat value called trainingLine then stripped its 'up to ' prefix — a round-trip that duplicated perRunSize (resources_set.go), which already returns the clean 'CPU · mem' ceiling. Use perRunSize directly and delete trainingLine (its only caller was this stripped one). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ided change Redesign `tb resources` per the concept settled with Lukas (cli#360): Your machine has: 14 CPU · 36 GiB Your secure environment has: 12 CPU · 23.3 GiB to give it more, open Docker Desktop -> Resources Each training run may use up to: 2 CPU · 8 GiB Change how much each training run gets? [y/N] (terminal) To change: tb resources set --cores N --memory NGi (non-terminal) - No banner: the user typed `resources`; don't echo tool/rule/"resources" back. - Three layers. "Your machine" = the physical host (new: resources.DetectHost, runtime.NumCPU + OS-specific memory via x/sys on darwin, /proc on linux, 0 elsewhere so it degrades to CPU-only). Shown only on a LOCAL install (cluster API is loopback); dropped on a remote cluster, where the environment line adds "(across N nodes)" and points at the node pool. - The environment line carries a per-OS/remote pointer to where its size is actually changed (Docker Desktop / node pool / cgroups) — never a dead-end prompt, because the CLI can't resize Docker or a node pool. - The one dial the CLI owns (the cluster-wide per-run ceiling) is offered inline on a terminal (-> the existing guided wizard via runResourcesSet), or as a scriptable pointer off a terminal. `resources set` stays the non-interactive door. - Ordering CPU · GPU · GiB (compute pair first, memory last). - Wizard prompts reworded from the cryptic "(1-11) [2]" to "How much CPU should each training run get? (now 2 · max 11)". Verified: real `tb resources` on a live k3d cluster renders the three layers exactly; cross-compiles on linux/windows/darwin (host-mem build tags); cli + resources + ui tests green. Fixes#360. Part of epic tracebloc/backend#1142. Supersedes #359 (the 2-line step) — stacked on it; merge #359 first or close it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 20, 2026
@BugBot run |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- hostmem_linux.go: check the deferred f.Close() (errcheck Lint gate). - runResourcesShow: distinguish a prompt cancel (Ctrl-C = exit 0) from a real Confirm error (now surfaced, not swallowed). - Count only Ready nodes for the "(across N nodes)" suffix (new resources.ReadyNodes), matching the set MachineCapacity sums. - A node-list failure now says "couldn't read its capacity" (it can be RBAC on a reachable cluster), not "can't reach it". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 20, 2026
@BugBot run |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…without node list Bugbot: (1) the 'Your machine' line was gated on the node list succeeding, but DetectHost needs no cluster API — so a reachable local install with an RBAC node-list failure wrongly hid the host layer. Show it whenever the cluster is local. (2) Local detection was loopback-only, so Docker Desktop clusters (kubernetes.docker.internal, NOT loopback) got the remote 'resize your node pool' text and no machine line. isLoopbackServer -> isLocalServer now also matches kubernetes.docker.internal / host.docker.internal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 20, 2026
@BugBot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3da8004. Configure here.
| // Ctrl-C / abort at the prompt is a choice, not a failure (exit 0); | ||
| // a genuine prompt error must surface, not be swallowed. | ||
| if errors.Is(cerr, errInteractiveCancelled) { | ||
| return nil |
There was a problem hiding this comment.
Ctrl-C shows no cancel message
Medium Severity
The new inline confirm after resources treats Ctrl-C as a clean exit but prints nothing. Other prompting commands print a visible “Cancelled — nothing was changed.” note at every interrupt site, so users cannot tell whether the flow aborted or succeeded silently.
Triggered by learned rule: errInteractiveCancelled must produce visible feedback at every prompt site
Reviewed by Cursor Bugbot for commit 3da8004. Configure here.
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3da8004. Configure here.
LukasWodka
commented
Jul 21, 2026
Superseded by #359. #359 ships the two-line The branch |


Fixes#360 · epic backend#1142. Supersedes #359 (the 2-line step) — stacked on it; merge #359 first, or close it and merge this. Concept settled with Lukas over the preceding thread.
What
tb resourceslooks like now (verified on a live k3d cluster)Off a terminal: no prompt, a scriptable pointer (
tb resources set --cores N --memory NGi) instead.Three layers
resources.DetectHost:runtime.NumCPU+ OS-specific memory —x/syson darwin,/proc/meminfoon linux, 0 elsewhere so it degrades to CPU-only). Shown only on a local install (cluster API is loopback); on a remote cluster it's dropped and the environment line reads "(across N nodes)" with a node-pool pointer.y/N— the CLI can't resize Docker or a node pool.Also
resources.(1–11) [2]→How much CPU should each training run get? (now 2 · max 11).resources setstays as the scriptable door.Cross-compiles on linux/windows/darwin (host-mem build tags); cli + resources + ui tests green (incl. new local-path + host-detection tests).
Note
Low Risk
Changes are CLI presentation, host detection, and interactive flow only; cluster mutation still goes through the existing helm-based
resources setpath with prior safeguards.Overview
tracebloc resourcesis reworked into a three-layer readout: Your machine (physical host via newDetectHost/ OS-specific memory probes, only when the API server is local), Your secure environment (schedulable cluster capacity with multi-node suffix and hints for Docker Desktop / node pools), and Each training run may use up to (cluster-wide ceiling). The top banner is removed; output uses newPrinter.Statrows and CPU · GPU · GiB ordering viaMachine.Line/perRunSize.After the show view, interactive terminals get an inline “Change how much each training run gets?” prompt that jumps into the existing
resources setwizard; non-TTY runs print aresources set --cores/--memoryhint instead.The set wizard CPU/memory prompts are reworded to show current vs max bounds. Help text and tests are updated for the new labels, local-vs-remote machine line, and
isLocalServerdetection (loopback + Docker Desktop hosts).Reviewed by Cursor Bugbot for commit 3da8004. Bugbot is set up for automated code reviews on this repo. Configure here.