Skip to content

feat(web): show pools on the Runners tab, and choose one in a project - #644

Merged
kalaspuff merged 3 commits into
fctl/1545-snapshots-in-the-web-appfrom
fctl/1545-pools-in-the-web-app
Nov 24, 2026
Merged

kalaspuff merged 3 commits into
fctl/1545-snapshots-in-the-web-appfrom
fctl/1545-pools-in-the-web-app

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This is the pools' web part of #615: an admin sees each pool's state at a glance, and a project chooses a pool by its name.

  • Pools on the Runners tab. The enrollment tokens section becomes "Pools". Each pool is a card with its labels as chips and what it needs now, read every 15 seconds from the demand endpoint. A sentence says what it's doing ("Growing: 1 runner is starting for 3 sessions that wait.", or in amber "At its limit of 20 runners: 3 sessions wait for room."), followed by its facts ("6 of 8 runners busy · 11 of 32 sessions · 3 sessions waiting · longest 2m"), its placement and what its token does. The runners it enrolled are listed under it, and leave the list above.
  • Making and changing pools. "New pool" asks for labels and a placement. Until someone chooses, the placement follows the offline removal, as the server's default does, and the live summary says what each choice means. A pool's ⋯ menu has Edit…, which changes its name, labels, placement and limit as it runs.
  • A project's Settings → Runners. "Its sessions run on" offers Any runner, each pool by name with what its runners give ("AWS large: 2 runners with 4 CPUs and 7.9 GiB · aws, large"), or labels you choose. Under it, how long sessions wait for those runners before any runner takes them. Labels that no runner or pool has say so in amber, and name who adds runners. Maintainers who aren't workspace admins still see pools by name, read from the workspace's runners.

The design docs in hyperstructure/design describe both. I verified it with unit tests for the pool wording, the cards, the form and the settings page, and in cargo xtask dev: a pool "AWS large" with two runners, filled by ten long sessions of a project that asks for its labels, with two left waiting ("Waiting for AWS large: its runners are busy"), in both themes and at a phone's width.

It is stacked on #643 and goes in after it. "Making a pool" step by step, with what each cloud needs, comes in a follow-up that builds on #639's Terraform module.

Refs #615

Screenshots

At e72d7ad, from cargo xtask dev: the Runners tab's pools, with "AWS large" full and two sessions waiting. Light, dark, and dark at a phone's width:

The Pools section, light: AWS large's card with labels aws and large, the amber sentence "2 sessions wait…: it wants 3 runners, and has 2 online.", its facts, and its runners aws-large-1 and aws-large-2 under it; Elastic and GPU pool with no runners yet

The same, dark

The Pools section at 390 px, dark

The new pool form, with labels and placement:

New pool: Name, Runs, Labels and Placement, Expires, Runners at once, When they go offline, Approve each runner, and the live summary

A project's Settings → Runners, with its choices open, then dark:

Settings → Runners: "Its sessions run on" open, with Any runner, GPU pool, Elastic (no labels to choose it by), AWS large chosen, and Runners with labels you choose

Settings → Runners, dark: AWS large, its labels aws, large, and Wait for one

Worth confirming

  • Decision: the Runners tab calls enrollment tokens pools: the heading is "Pools", the button is "New pool", and the token is how a pool's machines enroll. The CLI keeps fctl runners enrollment-tokens beside fctl runners pools.
  • Decision: the pool's state sentence says what the numbers show ("it wants 3 runners, and has 2 online"), not "Scaling up", because fctl can't tell whether anything scales the pool. It says "Growing" only while runners are starting.
  • Decision: the issue's 24-hour chart of busy slots and waiting sessions isn't here. It needs a time series the control plane doesn't keep yet, which is what Insights (Insights: what agents got done, for a workspace, a project and each person #621) is to provide. "Idle: 2 runners retire in 14 minutes" is left out for the same reason: hosts don't report when they'd retire.
  • Decision: a pool without labels is listed in a project's choices but can't be chosen, and says why ("no labels to choose it by: its admins give it some").

fctl session


Note

Medium risk. It changes the Runners tab and a project's runner settings, which admins and maintainers use to decide where sessions run. A wrong pool choice leaves sessions waiting for runners that never take them.

What it does. The Runners tab now calls enrollment tokens pools. Each pool is a card with its labels, a live sentence on what it needs (read every 15 seconds from the demand endpoint), and the runners it enrolled. Admins can make and edit pools. A project's Settings → Runners lets a maintainer choose Any runner, a pool by name, or labels of their own, and warns when no runner or pool has the labels.

Personal pools offered to projects. poolChoices doesn't skip pools that belong to a person, so an admin can pick one for a whole project and everyone else's sessions then wait for runners that never take them.

fctl review's first look at 6e34128 · 16 files, +1480 −200 · Review agent settings

- The Runners tab's enrollment tokens become pools: a card each with its
  labels, what it needs now (from the demand endpoint, read every 15 s)
  as a sentence and facts, its placement, and the runners it enrolled,
  which leave the list above. Pools are made with labels and a placement,
  and edited as they run (PATCH …/enrollment-tokens/{token}).
- A project's Settings get a Runners page: any runner, a pool by its
  name, or labels of its own, and how long its sessions wait for those;
  labels no runner has say so in amber, with who adds one.
- The runner row moves into a component of its own, shared by the list
  and the pools.
@fctl-review

fctl-review Bot commented Nov 24, 2026

Copy link
Copy Markdown

fctl reviewed e72d7ad and found 5 issues.

The Runners tab and the project's Runners page match the server's request types and label rules. The main gap is that a project can be pointed at someone's personal pool.

On lines the diff doesn't show:

  • Runner actions don't refresh the pools' demand · Low severity · web/src/components/workspace/runners.tsx line 84: refetch invalidates the runners and tokens but not keys.workspaceDemand, which the pool cards read. After approving, rejecting, draining or removing a runner, the card keeps its old counts ('1 waiting for approval', 'No runners yet') for up to 15 seconds while the list below already shows the new state.

Reviewed by fctl · Review agent settings

Comment thread web/src/lib/pools.ts
Comment on lines +219 to +220
const out: PoolChoice[] = (pools ?? [])
.filter((d) => !d.pool.closed || enrolled(d.runners) > 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A member's personal pool is offered to projects

Medium severity. poolChoices (and poolFor) ignore pool.owner, but the demand endpoint returns every pool, personal ones included, to admins. Choosing one in Settings → Runners saves its labels for the whole project, yet the server only lets a session use a pool with no owner or its own person (pool_for in do_fleet.rs), so everyone else's sessions wait for runners that never take them. The amber 'no runner has these labels' warning is also hidden, since poolFor finds that pool.

Suggested change
const out: PoolChoice[] = (pools ?? [])
.filter((d) => !d.pool.closed || enrolled(d.runners) > 0)
const out: PoolChoice[] = (pools ?? [])
.filter((d) => !d.pool.owner && (!d.pool.closed || enrolled(d.runners) > 0))

Found by fctl review in e72d7ad.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d0f7d35, in #648, since this pull request has merged. poolChoices skips pools with an owner and runners whose personal names the workspace, and poolFor skips pools with an owner, so a member's own pool is neither offered nor counted against the amber warning. The project's check for runners with its labels skips such runners too.

</div>
{save.error && !field && <Banner tone="error">{save.error.message}</Banner>}
<div className="flex justify-end gap-2">
<Button variant="ghost" onClick={close}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancel in the Edit pool form is a submit button

Low severity. Button sets no default type, so Cancel inside the <form onSubmit> submits it. Clicking Cancel after changing a field can save those changes. The repo's other forms set type="button" on Cancel.

Suggested change
<Button variant="ghost" onClick={close}>
<Button type="button" variant="ghost" onClick={close}>

Found by fctl review in e72d7ad.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9199b81, in #648: Cancel is type="button". The test now changes the labels, presses Cancel and checks nothing was sent; it fails without the fix.

typed: (p.settings.runner_labels ?? []).join(", "),
fallback: p.settings.runner_fallback_minutes ?? null,
});
toast(`Sessions that start from now on run on ${where(p)}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saving the Runners page shows two toasts

Low severity. useSave already toasts 'Saved' after calling the saved callback, and this callback adds a second toast. No other page's saved callback toasts, so each save shows two messages.

Found by fctl review in e72d7ad.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d0f7d35, in #648. useSave takes its message as a string or as a function of the saved project, and the Runners page passes "Sessions that start from now on run on …" as that, so a save shows one toast.

const none =
labels.length > 0 &&
!problem &&
runners.data !== undefined &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'No runner has these labels' warning flashes while pools load

Low severity. none only waits for runners.data. Until the demand query answers, poolFor gets an empty list, so a project whose labels match a pool with no runners yet shows the amber warning for a moment, then it disappears.

Suggested change
runners.data !== undefined &&
runners.data !== undefined &&
!demand.isPending &&

Found by fctl review in e72d7ad.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d0f7d35, in #648, as suggested: the warning also waits for !demand.isPending. A test renders the page with the pools not yet answered and checks there is no amber line.

…pp' into fctl/1545-pools-in-the-web-app

# Conflicts:
#	docs/llms.txt
@kalaspuff
kalaspuff added this pull request to stack #646 November 24, 2026 07:39
@kalaspuff
kalaspuff merged commit c336ff8 into main Nov 24, 2026
13 checks passed
@kalaspuff
kalaspuff deleted the fctl/1545-pools-in-the-web-app branch November 24, 2026 08:15
kalaspuff pushed a commit that referenced this pull request Nov 24, 2026
## Summary

Making a pool now follows the Runners tab's step-by-step setup, as
#615's design asks. New pool asks in three steps: name it; its labels
and machines (labels, placement, sessions each machine runs, runners at
once, offline removal, approval, expiry); and where it runs (your own
machines, AWS, Google Cloud, Azure or Kubernetes). A live summary says
what the pool will do, and a preview shows its card once its first
runner is online. Choosing a cloud removes runners once offline and
packs sessions, as autoscaled machines want.

Once the pool is made, the dialog shows the token once, then the steps
for where its machines run, with every value of this instance and this
pool filled in:
- **Your own machines:** install fctl, then enroll with the token at the
chosen capacity.
- **AWS:** the token in a file, fctl's Terraform module (named after the
pool, with the instance, its version, the capacity and a `max_size` a
few below the pool's limit; the VPC and subnets left to fill in), then
`terraform apply`.
- **Google Cloud:** build the image with Packer, fill in the example's
`terraform.tfvars` (the token stays out of it), then apply with the
token in `TF_VAR_enrollment_token`.
- **Azure:** make the image's resource group, gallery and image
definition, named after the pool, then build the image into that gallery
with Packer (the template now takes `azure_gallery`). Then fill in
`terraform.tfvars` from the same shell (the subscription, the location,
the image's ID, and a resource group of the scale set's own) and apply
with the token in `TF_VAR_enrollment_token`.
- **Kubernetes:** the token in a secret, the host as a Deployment
(linking to the role and the preStop hook in Self-hosting), and a
TriggerAuthentication with a ScaledObject whose metrics-api trigger
reads the pool's demand.

I verified it with unit tests that check each place's steps hold the
instance, the token and the pool's values (and `YOUR_FCTL_VERSION`, with
where to find it, while the app hasn't heard the instance's version), a
component test of the steps from the form to the AWS setup, and in
`cargo xtask dev` in both themes and at a phone's width. The Azure
commands follow the guide's step 7, but nothing ran in a real cloud
account.

It is stacked on #644. The AWS, Google Cloud and Azure steps use
`deploy/cloud` and its Terraform, which #639 added.

Refs #615

- #644
- #639
- hyperstructure/design#80

## Screenshots

At d62c20b, from `cargo xtask dev`. New pool, with AWS chosen, then what
it shows once made, light:

| The steps | Once made |
|---|---|
| ![New pool: 1 Name it, 2 Choose its labels and machines, 3 Choose
where it runs (AWS), the live summary, and the preview of AWS large's
card with its first
runner](https://app.fctl.sh/api/v1/published/IJGQePCaZumJt7heP4CYrTDJpbHnMpbxAK7qtchWVHk/new-aws-form.png)
| ![AWS large is ready: the token once, then Bring it online on AWS:
keep the token in a file, fctl's module filled in, terraform
apply](https://app.fctl.sh/api/v1/published/TN8dikKMhOrgmYnKTs0vFuRGxwjMKYmNeod29I42S1c/new-aws-created.png)
|

Kubernetes in the dark theme, and Google Cloud at a phone's width:

| Kubernetes | Google Cloud, 390 px |
|---|---|
| ![Kubernetes large is ready: the secret, the Deployment, and the KEDA
TriggerAuthentication and
ScaledObject](https://app.fctl.sh/api/v1/published/G95Ghw2y2bqV8o8o1EAObOu4x9xic1v0auJKRYNozJm/new-k8s-created.png)
| ![Google Cloud large is ready, at 390 px: the image, the example's
values, terraform
apply](https://app.fctl.sh/api/v1/published/nJlVwaCXJEWaifcqR0dx8tL7UTyULBn6q5JYhFmm7mb/new-google-phone-created.png)
|

## Worth confirming

- **Decision:** "Sessions each machine runs" is in the form though it
isn't the token's: it only shapes the commands and Terraform it gives to
copy (`--capacity`, `capacity`).
- **Decision:** the AWS module's source isn't pinned to the instance's
version, because a release before #639 has no module; the step says to
pin it with `?ref=`.
- **Decision:** Kubernetes gets the secret and KEDA's objects in full
but the host's Deployment only in words with a link, since running the
host's sandboxes in a cluster is the Kubernetes driver's work (#617).
- **Decision:** choosing a cloud switches "When they go offline" from
Keep them to Remove after 5 minutes, and with it the placement to
packed, until someone changes them.

[fctl session](https://app.fctl.sh/s/ses_01M84BNFZPNEXTHDT8WGN1Q6JY)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** It adds a step-by-step new-pool dialog and generated
setup text to the web app, and a template variable for the Azure image
build; nothing here touches stored data or permissions.
>
> **What it does.** Making a pool in the Runners tab now goes in three
steps (name, labels and machines, where it runs), with a live summary
and a preview of the pool's card. Once the pool is made, the dialog
shows the token once and then the steps for the chosen place (own
machines, AWS, Google Cloud, Azure or Kubernetes), with the instance's
values and the pool's settings filled in. Azure's steps make the image's
gallery first, and the Packer template takes it as a new `azure_gallery`
variable.
>
> **Packer template.** `deploy/cloud/fctl-runner.pkr.hcl` gets an
`azure_gallery` variable that defaults to the old `acme_runners`, so the
guide keeps working; the guide's copy of the template changes with it.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M869JFYMV5K3XNY5YZN1325F)'s first
look at
[`d92acb9`](d92acb9)
· 12 files, +831 −156 · [Review agent
settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
@fctl-sh

fctl-sh Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

The finding in the review's text, that runner actions don't refresh the pools' demand, is fixed in 9199b81, in #648: refetch invalidates keys.workspaceDemand too, so a pool card's counts change with the runner list after approving, rejecting, draining or removing a runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant