orchestration-session-lifecycle
How a PilotSwarm session maps to a duroxide orchestration. Read this before concluding that an "idle" session's orchestration is broken, stopped or stuck: most idle sessions are healthy, dehydrated and waiting for their next stimulus.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 16
- Forks
- 10
01 前言 Front Matter
- name
- orchestration-session-lifecycle
- description
- How a PilotSwarm session maps to a duroxide orchestration. Read this before concluding that an "idle" session's orchestration is broken, stopped or stuck: most idle sessions are healthy, dehydrated and waiting for their next stimulus.
02 资源文件 9
- 参考文档api.md10.3 KB
- 参考文档bisect-published-versions.md4.0 KB
- 参考文档dashboard.md1.2 KB
- 参考文档library.md17.6 KB
- 参考文档tools.md17.7 KB
- 参考文档trace_system_guide.md24.5 KB
- 参考文档vendor.md11.1 KB
- 参考文档webkit-safari-version.md908 B
- 参考文档webview.md6.6 KB
03 SKILL.md 正文
Orchestration ↔ Session Lifecycle
You are the agent-manager. Before reporting that a session looks "stuck", "stopped", or "missing its orchestration", read this carefully. The single most common false-positive in tuner reports is conflating session idle with orchestration not running. They are not the same thing.
The contract
A PilotSwarm session is a long-lived logical entity. The duroxide orchestration backing it is an event-driven generator that runs only when there is work to do and is otherwise dehydrated to disk. This is by design — it's how PilotSwarm scales to thousands of sessions on a few worker pods.
A healthy session spends most of its lifetime with no live orchestration in memory. That is the steady state. Not a bug.
Concrete lifecycle states
| Session looks like | Orchestration is | Healthy? |
|---|---|---|
| Just created | Active, running first turn | ✅ |
| Mid-turn (LLM call in flight) | Active, awaiting activity | ✅ |
| Waiting for user input | Dehydrated; history persisted | ✅ |
| Cron'd background loop, between ticks | Dehydrated; durable timer pending | ✅ |
| Idle for hours, no recent events | Dehydrated; ready to wake | ✅ |
state = completed in CMS |
Terminated, history retained | ✅ |
state = failed in CMS |
Terminated, last error recorded | ⚠️ investigate |
Active in CMS but no recent iteration events for hours and no pending timer |
Possibly stuck | ⚠️ investigate |
What "idle" actually means
When you call read_session_info and see no recent activity, that
does not mean the orchestration is dead. To distinguish a healthy
dormant session from a real stall, check all of:
- CMS state.
statefield.running/waiting/completed/failed/cancelled. Anything other thanfailedis not a fault per se. - Pending timers / events.
read_orchestration_stats(session_id)returnsqueue.pendingCountand KV counters. A non-zero queue means the orchestration has work waiting and will be picked up by the next worker. A zero queue withstate = waitingis also normal — it means the orchestration genuinely has nothing to do and is correctly dehydrated waiting on a stimulus (user input, cron wake-up, child completion). - Recent execution history.
read_execution_history(session_id, limit=20)shows the most recent activities and timers. If the last entry isWaitForUserInputorTimerFired waiting on cron, the session is idle by design. - Last checkpoint timestamp. From
read_session_metric_summary:lastCheckpointAt/lastDehydratedAt. A session dehydrated 3 hours ago, with no events since andstate = waiting, is healthy.
You only have a real stall when all of these are true:
stateisrunning- there is a pending event in the queue (
pendingCount > 0) - the last execution history entry is older than the orchestration turn timeout (typically minutes, not hours)
- no worker has picked it up
That combination usually means a worker crashed mid-turn or the session has lost affinity. Anything short of that is not a stall.
Cron sessions in particular
sweeper and facts-manager use low-frequency maintenance cron timers
(21600 seconds by default). pilotswarm and resourcemgr should not
maintain recurring cron loops; they wake from direct operator prompts or
runtime stimuli. Between ticks, cron sessions are dehydrated. Looking
at read_session_info for a sweeper between maintenance ticks, you will
see no live orchestration. That is correct.
The [cron 6h 0m] style chips you see in the sessions
pane mean "this session has a pending cron timer firing in N
seconds". The orchestration genuinely is not in memory — duroxide
will rehydrate it when the timer fires.
What to report instead
When asked "is this session healthy?", do not say "the orchestration is not running" unless you have verified the four-condition stall test above. Say one of:
- "Active and progressing." State=running, recent events.
- "Idle (waiting on user/cron/child) — healthy dormant." State=waiting or active-but-blocked, no pending stuck events.
- "Completed." State=completed.
- "Failed at <step> with <error>." State=failed.
- "Stalled." All four conditions of the stall test met. Recommend worker logs / restart.
Use these phrases. They map cleanly to operator action.
Things that look like bugs but are not
- No recent
agent_eventsinread_agent_events. Means no LLM turn has run recently. Expected for a dormant session. hydration_count == 0but the session is hours old. Means the session was created and ran exactly once, then dehydrated. Common for short reactive sessions.- Snapshot bytes growing. Normal — that's the point of the durable history.
pendingCount = 0and state =waiting. Healthy dormant. Not stuck.
04 同仓库更多 Skills
pilotswarm-three-tier
Reference for adding a Tier 3 worker AKS cluster to a PilotSwarm deployment. Covers provisioning, identity, Dockerfile changes, entrypoint, manifests, and verification.
pilotswarm-sdk-builder
Use when creating or updating an SDK-first app on top of PilotSwarm. Covers the client/worker split, plugin layering, tool registration, tests, and the DevOps sample structure.
pilotswarm-portal-builder
Use when creating or updating a browser portal on top of PilotSwarm. Covers portal branding, plugin.json.portal, named-agent exposure, auth add-ons, and remote deployment wiring.
pilotswarm-knowledge-harvester
Use when an SDK or CLI app needs to ingest external sources into durable, searchable knowledge and an open knowledge graph. Covers enabling the EnhancedFactStore + GraphStore providers, authoring a crawler:true agent, the crawl→graph→reader flow, ACL/scopeKey evidence, and tests.
pilotswarm-hybrid-datastore
Use when a PilotSwarm app needs stock PostgreSQL for runtime storage plus HorizonDB for enhanced facts, semantic/lexical search, and the knowledge graph. Covers env topology, horizonConfigFromEnv wiring, harvester agents, Azure secret/resource guidance, and the rule that Docker defaults remain stock Postgres.
pilotswarm-duroxide-versioning
Use when changing PilotSwarm durable orchestration behavior, continue-as-new state, or replay-sensitive control flow.