Periodic sessions
A periodic session is an ordinary chat session that the server starts on a schedule. Each
configured preset fires on its interval: the scheduler creates a fresh session under the periodic
owner, titles it <preset> — <date>, and posts the preset's initial_prompt through the exact same
code path as an operator message. The turn runs, the agent finishes with a report, and that is the
whole lifecycle.
There is no execution state machine, no self-scheduled continuation, and no restart-resume: a server
restart mid-turn fails that turn like it would fail yours, and the next scheduled firing starts a
fresh session. You can open any periodic session in the sidebar ([PERIODIC] prefix) and simply
talk to it — it behaves like any other session.
Configuration
Presets live under periodic.sessions in the config:
{
"periodic": {
"sessions": [
{
"name": "calendar-agenda",
"initial_prompt": "Produce today's calendar agenda for the current UTC day. List the day's scheduled items in chronological order; if the day is empty, say so.",
"schedule_interval_seconds": 86400,
"anchor_utc": "2026-09-03T06:00:00Z",
"model_level": null,
"enabled": true
},
{
"name": "mail-triage",
"initial_prompt": "Review today's mail triage decisions. READ-ONLY: never move, archive, delete, or send anything. Finish with a concise report.",
"schedule_interval_seconds": 86400,
"model_level": null,
"enabled": true
}
]
}
}
initial_prompt— the one message the session receives. Write it as a complete task brief: task, scope, hard constraints, expected report. The scheduler prepends a short shared preamble stating the periodic contract (finish in this turn, report at the end, no continuations).schedule_interval_seconds— spacing between firings (min 300, default one day). A never-fired preset fires promptly after startup.anchor_utc— optional fixed UTC instant (ISO 8601, e.g.2026-09-03T06:00:00Z) that anchors the schedule. When set, the preset fires at this instant and then everyschedule_interval_secondsthereafter, soevery 24h from <ts>fires daily at the anchor's UTC time-of-day. An anchored preset never fires off its cadence: if it is registered after the anchor has passed, the first run waits for the next occurrence on/after the current time. Omit it (null) to keep the legacy cadence — first run promptly after startup, then spaced by the interval from the last firing.model_level— optional llmio level override (1–3);nullfollows the global model-level resolution, like an operator session.
Anchoring a daily digest (e.g. the calendar-agenda job above) at a morning UTC instant makes it fire at the start of the UTC day and report that day's agenda before the day ends, instead of at an arbitrary end-of-day time.
If a preset comes due while its previous session is still processing a turn, that firing is skipped (logged, not queued).
A firing supersedes the preset's previous run: once the new session exists, the previous run's
session is closed through the same path as POST /sessions/{id}/close (its subsessions are closed,
a session_end feedback run is scheduled, the memory component receives the final summary). Only
the latest run of each preset is ever open, so periodic runs never pile up as sessions to close by
hand. A failure to close the previous run is logged and never blocks the new firing.
Two things survive that supersede-close:
- Pending operator decisions. Before the previous run is closed, its live
user_chatpanels (questions the operator has not answered yet) are moved to the new run's session. The new run's mandatory first step — listing its openuser_chatsubsessions — therefore finds them and does not re-ask; the operator can answer a decision days after it was first raised, in whichever run is current. Without this, every firing killed the previous run's panels and spawned the same questions again.
Fallback when a turn crashes. The agent normally surfaces open user_chat panels as its first
operation, but a turn that fails before the agent even starts (e.g. a network error during
submit_turn, or a pre-agent validation failure) never performs that check. To ensure
time-critical operator decisions stay visible even when the main task crashes, a fallback
mechanism automatically surfaces any open user_chat panels into the transcript when a turn
fails. This makes pending decisions visible independently of the main task succeeding — the
operator still sees decision panels and their decision prompts even when the turn crashes. No-op
when there are no open panels, so the transcript stays clean when nothing is pending.
Automatic system alerts. System health checks (e.g., the memory component's periodic retain
health probe) can automatically open a user_chat operator panel when a critical subsystem fails.
The memory write-failure alert, for example, opens when the memory component's retain path (used
by background cognee consolidation) stops working — which never surfaces on the chat request path
because memory retains asynchronously. The panel opens with title Memory writes failing: <error>
and guides the operator to investigate the cause (e.g. exhausted extraction-LLM balance). These
alert panels are deduped per cause, so if the same error persists across multiple health checks,
only one panel remains open. The panel automatically closes when the health check detects
recovery. Like other pending decisions, these alert panels survive run supersessions, so the
operator can investigate in the current run even if a panel was initially opened in a previous
run.
- The last few runs. The scheduler remembers the last
RETAINED_RUNS_PER_PRESET(3) session ids of each preset. After every firing, and once at startup, every other closed periodic session is deleted from the conversation store — a closed run is kept only long enough to read back what the last couple of firings did; the memory component holds the long tail. Open runs (a failed turn, or a run whose decision panel is still waiting) are never pruned, and a run the operator chatted in keeps its history under the operator's own session list.
The sidebar hides closed periodic runs by default. The Show closed periodic runs (N) button under + New chat reveals them (the choice sticks per browser); the run you are currently viewing is always shown. Discard closed periodic runs (N) next to it deletes every closed run in one confirmed click (the run you are viewing is kept; deletes go one at a time and any refused delete is reported, not retried).
Shipped presets
Where the live presets live
The presets in the committed config/config.json are a template only. The running chat reads
its presets from the deployed config volume (the file ROBOTSIX_CONFIG_FILE points at; in
production the central-deploy chat-config volume, readable via GET /config). The template is
not copied into the container image, and the live preset list can differ completely from it (for
example a live repo-hygiene preset with no template counterpart). Editing a preset in the
template therefore changes nothing live by itself.
A preset change reaches the running chat only by editing the live config: PUT /config with the
updated periodic.sessions entry (named-list merge by name), then restart the chat. When a PR
changes a template preset prompt, apply the same change to the live preset of the same name.
To keep such drift visible, src/robotsix_chat/periodic/shipped.py mirrors every template preset as
name → SHA256 of its initial_prompt (SHIPPED_PRESET_PROMPT_SHA256S):
- CI (
tests/periodic/test_shipped_drift.py) fails when a template preset prompt changes without the mirror being updated — the prompt to check the live config for that preset. - At boot the chat logs a
Periodic preset driftwarning for every shipped preset that is absent from the live config, or whose live prompt differs from the shipped one. The live prompt is always kept (it may be an operator edit); the warning only surfaces the gap.
dependabot-drain
The committed config/config.json ships one preset, dependabot-drain, which keeps the
repository's dependency-update pull requests from piling up. On each firing it enumerates the open
Dependabot/Renovate PRs (list_open_prs), judges each one's impact (inspect_pr_diff,
verify_pr_ci_status), merges the safe non-breaking bumps, and files a migration ticket
(POST /tickets/ingest) for every breaking change. It complements — never duplicates — any CI-level
auto-merge: PRs already armed to auto-merge are skipped. It finishes with a report of the PRs
merged, migration tickets filed, and PRs skipped.
Before classifying or holding a PR whose checks are red, it compares each red check with the latest
run of the same workflow on the base branch (check_ci_health). A PR that is red on its branch but
green on main most likely predates a main-branch fix: the agent updates the branch with
recover_auto_merge (GitHub's update-branch API) and re-verifies on the next run instead of holding
it as CI-red. Only a PR whose workflow is red on main too is held as a real blocker. The report
lists the two classes separately. Live presets with the same role (e.g. an operator-defined
repo-hygiene entry in the config volume) need the same step added by the operator or deploy.
- Cadence — weekly, anchored to Monday 06:00 UTC (
schedule_interval_seconds: 604800,anchor_utc: "2026-09-07T06:00:00Z"). It runs atmodel_level: 3. - Ships disabled — the preset ships with
"enabled": falseper the feature-flag convention, so it never fires on a fresh checkout. - Activation — set
"enabled": trueon thedependabot-drainentry underperiodic.sessionsin the deployment's config, then redeploy. To prove it live, fire it once withPOST /periodic/definitions/dependabot-drain/runand read the report, and confirm it appears enabled inGET /periodic/definitions.
gate-drain
The committed config/config.json also ships a gate-drain preset, which keeps the operator
informed of production-blocking issues and human-gated/blocked tickets across boards. On each firing
it scans the main branch for any failing workflows (CI failures are production-blocking and take
absolute priority), reports those first in the main conversation with clear ALERT flags and
recommended fixes, and then enumerates every ticket in the gated states — human_issue_approval,
human_mr_approval, awaiting_user_reply, and blocked — across all boards. Its first output is
a scope report emitted in the main conversation: each current-main CI failure (one ALERT line per
failure with recommended fix PR and recommendation), the total count of gated tickets discovered, a
per-state count summary, and an explicit flag when it will only analyze a subset (the
discovered-vs-analyzed mismatch). Only after that scope report does it begin detailed per-ticket
processing.
- Production CI failures are front-loaded. The operator's primary goal is keeping main green. Current-main CI failures are production-blocking and must be reported at the TOP of the main conversation before the gated-ticket enumeration, with a clear ALERT flag, recommended fix PR, and recommendation for each failure. Never bury a CI failure in subsession metadata that a main-thread-only reader would miss.
- Scope reporting belongs in the primary conversation. Subsession summaries capture follow-up work items, not top-line scope. The CI failures, total discovered count, the per-state summary, and any discovered-vs-analyzed mismatch must appear in the main conversation where the operator sees them immediately — never buried in a closed subsession summary. This preset exists because a 2026-09-09 gate-drain run reported ~14 tickets in the main conversation while a subsession had actually discovered 47 across multiple boards; the 3× scope expansion never reached the operator. And a 2026-09-19 incident identified that a broken robotsix-mill Docs workflow (production-blocking CI failure) existed only in subsession metadata and never reached the operator's main conversation.
- Escalation handling must be verified and reported. Before listing a gated ticket as 'already escalated → awaiting operator' (or taking any action on it), the agent must read the ticket's history and confirm whether an ESCALATED comment or an open operator decision panel already exists for it — and only classify a ticket as freshly open when its history shows no prior escalation. The final report must explicitly state that this history-verification was performed (e.g. 'Verified ESCALATED comment present on each of the 7+9 escalated tickets; no operator answer recorded since'), so a future run never treats an already-escalated ticket as freshly open.
- Cascade triage surfaces the specific files. When a stabilized blocked cascade of
file-classification tickets is detected (multiple
module_curatortickets blocking on module assignment — typically ≥10 blocked tickets across ≥2 boards unchanged for ≥3 runs), the triageuser_chatsubsession must enumerate the specific unclaimed/blocking files (grouped by ticket when several cascades exist) and give per-file classification options: a suggested module candidate inferred from the file path pattern, a note that direct team input may be required before approval, and the current blocker. The panel title states which files are unclaimed and what decision is needed, so the operator can triage without digging through ticket comments. This behaviour exists because session331c2099197b4606bfafea0d26c21f1dspawned a hexarchy blocked cascade triage that asked for a decision without listing the ~7 unclaimed files or offering classification candidates. - Skeleton-first PARTIAL REPORT strategy prevents token exhaustion. To prevent silent
mid-operation failures where the agent is cut off mid-sentence before reporting work, PARTIAL
REPORTTs now use a skeleton-first strategy: the agent emits a minimal report skeleton FIRST
(counts and full ticket IDs, one per line, no prose) before adding optional prose descriptions.
The skeleton is re-emitted after each batch of work with updated counts. This ensures that even if
truncation strikes mid-prose or mid-report, the counts and ticket IDs survive and the next run
knows what was discovered and can resume. The agent maintains a hard 8–10k token reserve and stops
enumeration immediately if remaining tokens drop below 10,000 total, even mid-ticket. When the
hard stop is reached, it emits the final skeleton with what was discovered and what remains
unenumerated. This strategy exists because session
36857ec8e0b34cf6b54a3b6bbf60c3caenumerated multiple operations before being cut off, with no final report visible to the operator. - Board-API filters may be ignored — enumerate defensively. The board API's list endpoints
(
GET /board/cardsand similar) may silently ignorestatus/board_idfilter parameters and return the entire unfiltered board regardless of what is passed. The prompt therefore instructs the agent NOT to rely on server-side filtering: fetch each board once as a complete entity, parse it locally to extract the gated-state tickets, and track which boards are already fully enumerated so none is re-fetched. Boards are processed in small batches with a PARTIAL REPORT between them (boards done so far, gated tickets per state, running total, boards still remaining) so enumeration resumes across turns without duplication and completes even when the API does not honour the expected filters. This exists because the 2026-09-08 run issued one filtered request per state per board, re-fetched whole boards repeatedly, and exhausted its token budget before finishing enumeration. - Cadence — every four hours (
schedule_interval_seconds: 14400), atmodel_level: 2. - Ships disabled —
"enabled": falseper the feature-flag convention, so it never fires on a fresh checkout. - Activation — set
"enabled": trueon thegate-drainentry underperiodic.sessionsin the deployment's config, then redeploy. To prove it live, fire it once withPOST /periodic/definitions/gate-drain/runand confirm the main-conversation report leads with any current-main CI failures (one ALERT line per failure with recommended fix PR) and then the total discovered count and the state-by-state summary (with no scope mismatch left silent), and that it appears enabled inGET /periodic/definitions.
trace_review
The committed config/config.json also ships a trace_review preset, which monitors fleet-wide LLM
spending patterns and detects wasteful traces. On each firing it attempts to fetch the 5–10 most
expensive traces from the Langfuse mill project (sorted by cost), analyzes them for waste patterns
(oversized prompts, retry loops, model-tier escalations), and reports findings to the operator. When
Langfuse project credentials are absent, it degrades gracefully to aggregate cost-monitor queries
(total spend by model-level, provider, region) and recommends configuring the langfuse.projects
block per docs/configuration.md.
- Configuration requirement — requires Langfuse project credentials configured in
langfuse.projectsfor themill,chat, and optionallymailprojects (seedocs/configuration.mdLangfuse configuration section). When projects are unconfigured (langfuse.projects: {}), the monitor switches to aggregate fallback mode (cost spikes by model-level and provider). - Cadence — weekly, anchored to Monday 06:00 UTC (
schedule_interval_seconds: 604800,anchor_utc: "2026-09-07T06:00:00Z"). It runs atmodel_level: 2. - Ships disabled — the preset ships with
"enabled": falseper the feature-flag convention, so it never fires on a fresh checkout. - Activation — set
"enabled": trueon thetrace_reviewentry underperiodic.sessionsin the deployment's config, then redeploy. To prove it live, fire it once withPOST /periodic/definitions/trace_review/runand read the cost report. If Langfuse projects are unconfigured, the report will recommend configuringlangfuse.projectsperconfig/config.jsonanddocs/configuration.md. Once Langfuse is configured, a second firing will produce per-trace analysis instead of aggregate fallback.
Branch hygiene in operator presets (repo-hygiene PART 2)
The operator-defined repo-hygiene preset (it lives in the config volume, not in the shipped
template) asks the agent to verify delete_branch_on_merge on every fleet repo. The central-deploy
github component does not expose a repository GET/PATCH, so that step is performed with chat's own
direct-repo tools (GitHub App installation token, no component_request):
get_repo_settings(repo_full_name)—GET /repos/{owner}/{repo}; reportsdelete_branch_on_merge,default_branch,allow_auto_mergeand the merge-strategy flags.set_repo_delete_branch_on_merge(repo_full_name, enabled=True)—PATCH /repos/{owner}/{repo}with a body containing onlydelete_branch_on_merge. Needs the GitHub App permission Administration: write; without it the tool returns a permission-denied message.
With delete_branch_on_merge on, GitHub deletes merged head branches itself, so the preset needs no
separate branch-delete step. Update the live preset's PART 2 text to: "For each fleet repo, call
get_repo_settings; when delete_branch_on_merge is false, call set_repo_delete_branch_on_merge
with enabled=true and list the repos changed in the report."
Session-end contract and interrupted reports
Every periodic session has an unconditional obligation to report at the end — even if it is interrupted by timeout, error, resource exhaustion, or early termination. A session that ends without a report leaves the next scheduled run blind to what was attempted, done, escalated, or blocked.
Guaranteed reports
The scheduler prepends a preamble to every preset's initial prompt that instructs the agent to prioritize the report as the first deliverable, not the last.
The agent cannot introspect its own token consumption or context-window usage — there is no budget field or tool that tells it how close it is to the limit, and the limit can be reached without warning mid-operation. Because "sensing" exhaustion is not actionable, the preamble instead makes the report resilient to sudden termination by having the agent report as it goes:
- Report at natural breakpoints, not just at the end. After each atomic unit of work (each PR
merged, each ticket processed or drained, each subsession opened, each investigation closed), the
agent outputs an updated running
PARTIAL REPORTcapturing everything done so far, restating the full report each time — the last complete report the transcript contains is what survives. - Reserve headroom for the report. The agent does not pack the turn end-to-end with operational work; once a batch of major operations is done, it prefers stopping and emitting a final report over starting another expensive operation that could be cut off before it reports it. A smaller batch that is fully reported beats a larger batch that terminates unreported.
- Guarantee report output even on error. The agent wraps task work in error handling (explicit try-finally or implicit control-flow management) to guarantee PARTIAL REPORT output even if an error occurs. If an error is encountered mid-execution — tool failure, API error, or unhandled exception — the agent stops the remaining work, documents the error in the report's "Errors encountered" section, and emits the PARTIAL REPORT immediately. Do not let an error silence the session — every session MUST end with a report.
PARTIAL REPORT (the expected outcome for interrupted work)
PARTIAL REPORT is the expected outcome for any interrupted or incomplete periodic session, not
an emergency fallback. Whenever a periodic task cannot finish everything — and at every breakpoint
above — it outputs a report titled PARTIAL REPORT with four sections, in this order:
-
Done — items completed and the ROUTINE actions taken (e.g. tickets drained, PRs merged or filed), each named. For gate-drain: any tickets processed and their disposition. For dependabot-drain: any PRs merged and migration tickets filed.
-
Escalations — subsession IDs opened and the decision each one needs from the operator. If the agent opened a subsession for a per-ticket merge decision or investigation that is still pending, record it here so the operator knows it exists and awaits their input.
-
Held for next run — items not reached or deliberately deferred, each with a one-line reason (e.g. "47 remaining tickets need prioritization order"; "PR #123 blocked on feedback").
-
Errors encountered (if any) — brief descriptions of any errors or failures encountered, so the next run understands what to investigate or retry. This section helps subsequent runs avoid the same failures or investigate further.
A PARTIAL REPORT is always better than silence. An interrupted session that reported what it got to gives the next scheduled run the context to resume. One that reported nothing leaves no path forward. An error-aware report (including the Errors section when applicable) tells the next run what went wrong and how to proceed.
Automatic error reports on turn failure
When a periodic turn encounters an unhandled exception before completing, the scheduler
automatically appends an error message to the transcript with the exception type, message, and full
traceback. This ensures that subsequent runs have full context of what was attempted and where it
failed — you can see the error in the session's transcript under the [PERIODIC] prefix in the
sidebar.
The failed session is not immediately closed; it remains open for manual inspection or follow-up, and will be closed when the preset fires again (the new firing's supersede-close mechanism cleans up the previous run). This gives you time to examine the error and decide whether manual intervention is needed.
If the error-reporting mechanism itself fails (e.g. the transcript backend is down), the exception is logged but never propagates out of the turn task, so the scheduler continues normally.
Failsafe report when a turn ends without raising
The error-report path above covers turns that raise. A turn can also end cleanly — without any
exception — yet have the agent never emit its report: token exhaustion or a provider cutoff can end
the turn while the agent is mid-work. To stop the next firing from inheriting a blank transcript,
the scheduler runs a failsafe check after every completed (non-raising) run: if the transcript is
empty, or its final assistant reply is empty/whitespace-only, the scheduler appends a minimal
PARTIAL REPORT stating the turn ended without a report (likely token exhaustion or a provider
cutoff) and that the next firing should treat any prior work as unverified. A healthy run — one
whose final assistant reply is non-empty — is left untouched, so this never double-appends on a
normal firing.
Example: dependabot-drain interrupted
If dependabot-drain times out after processing 3 of 10 Dependabot PRs:
PARTIAL REPORT
Done:
- PR #456 (lodash): merged (green CI, non-breaking bump)
- PR #457 (eslint): filed migration ticket #ticket-123 (breaking API change)
- PR #458 (typescript): skipped (already auto-merging)
Escalations:
- Subsession #sub-789: awaiting operator approval for PR #459 schema migration
Held for next run:
- 7 remaining Dependabot PRs (session token budget exhausted)
The next dependabot-drain run will see these results and skip the 3 already-processed PRs,
resuming with PR #460.
Example: gate-drain interrupted
If gate-drain times out after reporting current-main CI failures and scope:
PARTIAL REPORT
Current-main CI:
⚠️ ALERT — main CI failing: robotsix-mill: Docs workflow (conclusion: failure);
recommended fix: PR #723; recommendation: merge and re-run
Done:
- 12 gated tickets analyzed
- 3 tickets drained (moved to resolved state)
- 2 subsessions opened for merge decisions (see Escalations)
Escalations:
- Subsession #sub-890: awaiting operator approval for PR #410 (merge or close?)
- Subsession #sub-891: awaiting operator decision on ticket #board-567 (reassign or close?)
Held for next run:
- 35 remaining gated tickets (session turn limit reached)
- Current-main CI failure to be re-checked next run
The next gate-drain run sees the current-main CI failure is still present and re-confirms or
updates its status, and resumes the gated-ticket enumeration with the remaining 35.
Endpoints
GET /periodic/definitions— presets with their firing state (last_fired_at,last_session_id,runs) and configuration (schedule_interval_seconds,anchor_utcas an ISO 8601 string when set,model_level,enabled).POST /periodic/definitions/{name}/run— fire a preset now (409 while its previous session is mid-turn).