Skip to content

ADD: show paused runs in Running with a way to hold them longer, leave pauses out of run times, and copy the API token from the admin panel - #94

Merged
Jules-GP merged 2 commits into
DCBIA-OrthoLab:mainfrom
Jules-GP:feat/admin-panel-pauses-and-token
Oct 29, 2026
Merged

Jules-GP merged 2 commits into
DCBIA-OrthoLab:mainfrom
Jules-GP:feat/admin-panel-pauses-and-token

Conversation

@Jules-GP

Copy link
Copy Markdown
Collaborator

Stacked on #93: its commit is the first one here. Merge #93 first; this diff then shrinks to its own commit.

What changes in the admin panel

Paused runs are shown in Running, in orange

A run stopped at a checkpoint used to sit in a small "Paused" card under the queue, where it was easy to miss. It now has an orange card in Running, which shows:

  • how long it has been waiting for a person, and its tool chain;
  • that it holds no machine;
  • when its files will be dropped.

Paused runs are not counted as running: the header reads Running 1 · 2 paused. The old "Paused" card is removed.

Holding a pause longer

Each paused card has +1 h and +4 h buttons, which call a new route, POST /admin/runs/{id}/hold (admin token only).

  • The route records a hold_until deadline in the run's paused.json. The reaper keeps a paused run until the later of two dates: its idle timeout (PAUSED_RUN_TTL_SECONDS, 4 h), or that hold.
  • Clicks add up. The deadline is capped at PAUSED_RUN_MAX_HOLD_SECONDS (3 days) from now, so a review that runs over can be given more time, but a staged cohort is never held indefinitely.
  • The listing now carries each paused run's real deadline (expires_at), which the card displays.
  • The route starts nothing, so it stays open while maintenance has the door shut (declared in test_maintenance).
  • Writing paused.json used to move the run directory's mtime, which is also its idle clock: a hold then also restarted the idle timeout. The mtime is now restored after the write, so +1 h adds exactly one hour.

Pauses are left out of run times

The ledger's seconds included the time a run spent waiting at a pause. On production, AREG runs with pauses spent 58 % to 76 % of their recorded time paused, so tool means measured the reader's pace more than the tool's.

  • seconds is now the time the run worked. The pause time goes in a new field, paused_seconds.
  • History written before this change is corrected when read back, from the phase spans it already kept.
  • The history table shows + 3m05 paused under the duration.

API token copy, and a reveal toggle on the gate

  • An API token button in the header copies the API token a workstation connects with. The token is fetched from a new route, GET /admin-panel/api-token, only when the button is pressed: admin token only, Cache-Control: no-store. It goes straight to the clipboard and is never shown, nor written into the page or into /admin-panel.json.
  • The admin token field on the gate has a Show / Hide toggle.

Tests

  • test_runs.py:
    • a held pause outlives its idle timeout, and an unheld one does not;
    • holds add up and stop at the cap;
    • a hold does not restart the idle clock;
    • the listing carries the deadline;
    • a run that is not paused cannot be held.
  • test_dashboard_data.py:
    • the hold and token routes answer the admin token only;
    • out-of-range holds get 422, and a run that is not paused gets 404;
    • the API token appears in neither the page nor its polled data.
  • test_telemetry.py:
    • a pause is not counted in a run's time;
    • a tool's mean is its working time;
    • old history is corrected on read.
  • The behaviour was also checked live on a local server, with three tools paused and resumed in parallel and a hold applied to a paused run.
  • Full suite: 1494 passed. The one failure, test_dev_mounts, is the same one as on main.

…inished run is not shown as running after one
…e pauses out of run times, and copy the API token from the admin panel
Copilot AI balanced review requested due to automatic review settings October 29, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Jules-GP
Jules-GP merged commit 90769e6 into DCBIA-OrthoLab:main Oct 29, 2026
2 checks passed
@Jules-GP
Jules-GP deleted the feat/admin-panel-pauses-and-token branch October 29, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants