Skip to content

Add dashboard session stop endpoint - #178

Merged
w4ffl35 merged 115 commits into
masterfrom
dashboard-stop
Nov 1, 2026
Merged

w4ffl35 merged 115 commits into
masterfrom
dashboard-stop

Conversation

@w4ffl35

@w4ffl35 w4ffl35 commented Nov 1, 2026

Copy link
Copy Markdown
Member

POST /api/session/:id/stop with the same auth treatment as pause/resume: persists the detached launch pid (new session-pids), SIGTERM with grace then SIGKILL, marks the session stopped, clears the pause flag, idempotent for dead/unknown sessions. Needed by uwuchat development mode Pause/Stop controls (agent-board Automated Engineer P4a). Tests: session-stop suite (live pid, unknown id, idempotent second stop, auth). Live :4390 dashboard untouched.

RSI smoke and others added 30 commits October 27, 2026 16:33
The terminal renderer dropped decision_blocked/decision_answered events,
so 'Tool: ask_followup_question' printed with no question, and the engine
then blocked up to 30 minutes on .harness.decision-answer with no way to
reply. Render the question plus numbered suggestions, show the answer or
timeout, include the question in the tool_call summary, and prompt inline
for the answer, writing it to the marker file the engine polls.
RSI smoke added 29 commits October 30, 2026 04:47
The host-composition rejection path carried the whole pin/candidate/digest
verification inline: one 96-line function at complexity 24, plus long test
builders that tripped the file, function and clone ratchets. Extract small
assertion, evidence and receipt builders with exact pins, messages and
receipt bytes preserved. Reuse the shared canonical/digest helpers instead
of a third copy. Split the repair suite into receipt and pipeline files
with shared stubs and builders. All six touched files report zero new
standards and architecture findings; focused suites and typecheck pass.
Move builders, runners and throw expectations into a shared support
module; pin values stay identical and all nine observer checks keep
their exact assertions. Both files report zero new standards and
architecture findings; the observer suite and typecheck pass.
Break long literals and overgrown test functions into small named
builders and focused cases with identical assertions and suite names.
Both files report zero new standards and architecture findings; the
suites and typecheck pass.
Move each schema clause verbatim into small checked helpers with error
messages, pin values and acceptance behavior unchanged. The module
reports zero new standards and architecture findings; the RSI suites
and typecheck pass.
Extract fixedCampaignFields, scopedConfig/scopedPaths splits, scopedHooks,
recordingRunCommand, failingBenchmark/campaignScopeError, and
assertCandidateAccepted so every function fits the 20-line limit and every
line fits 80 columns. Behavior unchanged: paired visible evaluation only,
no HCL benchmark calls, exact error text preserved.
Shorten the campaign-ids doc comment and wrap two overlong imports so
each line fits 80 columns. No behavior change.
Spread the campaign-scoped evaluation patch, the proof-protocol ternary,
and the delivery-lock table entry across short lines; shorten the one
overlong test name to match. No behavior change.
Spread two conditional config spreads, the typecheck command fallback
and runner call, and the queue objective union across short lines;
shorten one queue doc comment. No behavior change.
Add CampaignEvaluationObjective to RSI types and use it in both config
blocks and the queue payload instead of three duplicated unions; build
campaign-control paths through one controlFile helper. No behavior
change: constant values verified identical.
Shorten the two overlong test names and spread the protected-request
constructions and suite table across short lines. Same pins, same
assertions.
Spread socket-directory assertions, service options, the HTML escape
chain, asset reads, the template guard, and the script-escape
replacement across short lines. No behavior change.
Extract boundary path/env/git/clone/layout/shim/typecheck helpers so the
50-line snapshot test becomes a slim orchestrator. Same commands, pins,
messages, and assertions.
Build the budget authority from control, run-scope, and ledger helpers
and run the claim/finish/reload probe in start/claim/finish/reload
phases. Same values, pins, and assertions; the throwing claim guard
replaces three non-null assertions.
Extract the qualification definition/record builders and the run/restart
phases from the 46-line durability probe; use the readStatus helper for
the reload assertion. Same values, pins, and assertions.
Wrap imports, signatures, asserts, and table entries; build the two long
command-probe strings and the failure noise input by concatenation and
split the scrub regex into per-branch asserts. All asserted strings and
inputs are byte-identical to the originals.
Split the broker import, the worker options, and the ledger assertion;
shorten one assertion message. No behavior change; neighboring baselined
lines untouched.
…dling

Extract entry reading, digest/record/redaction asserts, and per-test
phases so every function fits 20 lines. Secret-bearing literals are
carried byte-verbatim; only structural whitespace is authored. Same
inputs, pins, and assertions.
Extract the GitFixture/CrlfWorktree shapes and the worktree prepare and
restore-assert phases from the 32-line CRLF probe; wrap the remaining
long calls and shorten two suite names. Same commands, bytes, and
assertions.
Give the contained-run input and result named interfaces, run dispatch
through guard/launch/config/summarize phases over one worker scope, and
let the candidate digest own its file state (narrowing its dependencies
accordingly). Same order of checks, pins, and error texts.
Split spawnSync argument lists, the control-state existsSync assert,
and the retry message assert so every line fits 80 columns. Same
commands, bytes, regex, and assertion messages.
Split long signatures, spawn/intake argument lists, and hoist the two
suite titles into value-identical concatenated consts. Same requests,
feed bytes, regexes, and assertion values.
Give the authority fixture limits/control/repository/monthly/lifetime
builders typed off RepositoryBudgetAuthority, hoist the suite title
into a value-identical const, and read allocations through one helper.
Same caps, keys, order, regexes, and assertion values.
Give the ledger verify-methods, mismatched-grant rejects, and stop-hold
expects their own rated helpers, reuse the reserve helper in the durable
path, and hoist suite titles into value-identical consts. Same grants,
calls, regexes, and assertion values.
Give the fleet authority fixture control/repository/monthly/lifetime
builders, share one advisory input, evidence, progress, and retry
phase helpers, and keep the three suite tests as short phase callers.
Same budgets, keys, order, regexes, and assertion values.
Give the offline pipeline factories, registry write, exact-bind
rejects, Curl definition/registration builders, worker open, pinned
intake, and unsupported-observation asserts their own helpers with
titles in value-identical consts. Same factories, pins, regexes, and
assertion values.
220-line repository-curl-repair-intake.test.ts (88 findings) is now an
85-line caller over curl-repair-intake-fixtures/factories/phases. The
new modules reuse the shared builders instead of copying them:
repairDefinition/repairRegistration from curl-repair support,
repairAdvisoryInput from the store phases, monthly/campaignLifetime
budgets plus live run scope from coordinator fixtures, the canonical
Debian advisory maker, and the shared waitForTerminal/fixtureRoot.
liveRepositoryScope takes the definition as a defaulted parameter so
both suites share one scope helper with identical behavior.

All 5 files zero on standards and architecture; 3/3 intake, 8/8
coordinator, 3/3 store, 5/5 repair green; tsc clean.
POST /api/session/:id/stop group-signals the detached pid recorded
at launch (new .headlesscode/pids registry): SIGTERM, 5s default
grace (server option, HEADLESSCODE_DASHBOARD_STOP_GRACE_MS, or
per-request graceMs), then SIGKILL. On a confirmed exit it marks
the pid record stopped, clears the pause marker, removes the live
usage snapshot, and appends a session_stopped event. Already
stopped or dead sessions return 200 already-stopped; unknown
sessions and sessions with no pid record return a 404. Same
optional bearer-token gate as pause/resume.

Tests: tsc clean; all 19 dashboard test files pass, including 7
new session-stop tests (live stop, unknown, idempotent second
stop, SIGKILL escalation, auth gate, pid registry).
@w4ffl35
w4ffl35 merged commit b07c4eb into master Nov 1, 2026
1 check passed
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.

1 participant