fix(sessions): stop active runs before archiving (#120892)

* fix(sessions): stop active runs before archiving

Archive now fences the exact session, stops and drains active work before commit, preserves main/global-main/unknown protections and Delete behavior, and keeps patchMany per-target ordering.

* test(gateway): provide archive lifecycle context

* test(ui): expect active sessions to remain archivable

* refactor(gateway): keep archive drains internal

* fix(gateway): keep abort lifecycle contract acyclic

* fix(sessions): fence sharing across archive drains

* test(gateway): type archive lifecycle responses

* fix(sessions): reclaim cloud workers before archive

* fix(sessions): align archive request integration

* test(gateway): omit default deferred type

* docs(sessions): clarify cloud archive retries
This commit is contained in:
Peter Steinberger
2026-08-09 09:03:20 -07:00
committed by GitHub
parent 8ed072ee16
commit b4104e29b5
50 changed files with 2918 additions and 385 deletions
+7 -3
View File
@@ -93,9 +93,13 @@ openclaw sessions archive "agent:main:scratch-1" --json
Archive uses the same `sessions.patch` lifecycle operation as the Control UI.
It keeps the transcript, marks the session archived, and removes the session
from the default active list. Already archived sessions are successful no-ops.
Use `--dry-run` to validate every key and preview the result without changing
session state.
from the default active list. For a cloud-worker session with an active
placement, the Gateway first stops the worker, reconciles its workspace, and
reclaims the environment. If the placement is still transitioning or failed
without proof that its environment is gone, the session remains unarchived;
wait for the placement to settle, then retry. Agent main sessions remain
protected. Already archived sessions are successful no-ops. Use `--dry-run` to
validate every key and preview the result without changing session state.
## Delete sessions