Recreated locally from PR #80015 because the contributor branch could not be updated by maintainers (maintainerCanModify=false).
Fixes#79812.
Co-authored-by: Andy Ye <andy@Andys-MacBook-Pro-2.local>
Adds Gateway task ledger RPCs and SDK methods for listing, fetching, and cancelling durable background tasks. Includes protocol schemas/scopes, generated Swift models, docs, and tests. Public task summary text is sanitized before SDK exposure.
Summary:
- Add explicit sessions cleanup --fix-dm-scope handling for stale direct-DM rows after session.dmScope returns to main.
- Preserve removed-row transcripts as deleted archives and expose the option through CLI, Gateway RPC, protocol schema, generated Swift mirrors, docs, tests, and changelog.
- Fixes#47561 and #45554.
Verification:
- pnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/cli/sessions.md docs/concepts/session.md src/config/sessions/cleanup-service.ts src/commands/sessions-cleanup.ts src/cli/program/register.status-health-sessions.ts src/gateway/protocol/schema/sessions.ts src/gateway/server-methods/sessions.ts src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cli/program/register.status-health-sessions.test.ts
- git diff --check origin/main...HEAD
- pnpm protocol:check
- pnpm exec oxlint src/config/sessions/cleanup-service.ts src/commands/sessions-cleanup.ts src/cli/program/register.status-health-sessions.ts src/gateway/protocol/schema/sessions.ts src/gateway/server-methods/sessions.ts src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cli/program/register.status-health-sessions.test.ts
- pnpm test src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cli/program/register.status-health-sessions.test.ts src/gateway/server.sessions.store-rpc.test.ts
- pnpm changed:lanes --json
Security:
- No new network, credential, process execution, dependency, or permission surface. Cleanup is explicit operator-invoked local session-store repair.
CI note:
- Exact-head CI failures match current main at 2e78fc57af in unrelated extensions/codex and extensions/microsoft-foundry type checks, outside this PR diff. No required checks are reported for this branch.
Replaced 112 typography characters (curly quotes, apostrophes, em/en
dashes, non-breaking hyphens) with ASCII equivalents per
docs/CLAUDE.md heading and content hygiene rules.
- docs/help/gpt55-codex-agentic-parity.md: 22 chars; removed the
duplicate '# GPT-5.5 / Codex Agentic Parity in OpenClaw' H1 (Mintlify
renders the title from frontmatter; the in-body H1 with the slash
produced a brittle anchor).
- docs/platforms/mac/menu-bar.md: 21 chars; removed the duplicate
'# Menu Bar Status Logic' H1.
- docs/tools/acp-agents.md: 23 chars
- docs/concepts/qa-matrix.md: 23 chars
- docs/concepts/qa-e2e-automation.md: 23 chars
docs/install/macos-vm.md: removed the duplicate '# OpenClaw on macOS
VMs (Sandboxing)' H1 (Mintlify renders title from frontmatter; the
in-body H1 plus parens produced a brittle anchor).
docs/install/development-channels.md: removed the duplicate
'# Development channels' H1.
docs/install/index.md: replaced 3 typography characters (curly quotes
and en-dash) with ASCII equivalents.
docs/concepts/delegate-architecture.md: replaced 10 typography
characters (curly quotes, apostrophes, em/en dashes) with ASCII
equivalents.
docs/install/clawdock.md: renamed '## Related pages' to '## Related'
for consistency with sibling install docs and converted the 3-bullet
list into a CardGroup linking docker, docker-vm-runtime, and updating.
docs/install/nix.md: replaced 2 typography characters with ASCII
equivalents and converted the 3-bullet Related list into a CardGroup,
adding an Updating card so readers wiring nix-openclaw next to a
managed install see the upgrade path.
docs/concepts/features.md: converted the 2-bullet Related list into a
CardGroup, adding cross-links to channels and plugins so the page now
points readers at both deeper concepts (experimental features, agent
runtime) and direct surfaces (channels, plugins).
docs/tools/pdf.md: replaced 2 typography characters with ASCII
equivalents.
docs/concepts/context.md: replaced 12 curly quote and italic-marker
typography characters with ASCII equivalents so grep, copy-paste, and
Mintlify search hit clean tokens. Converted the 4-bullet Related list
into a CardGroup linking context-engine, compaction, system-prompt,
and agent-loop. Verified all four targets exist.
docs/concepts/soul.md: replaced 7 typography characters (curly
apostrophe in 'agent's' and similar) with ASCII equivalents. Renamed
'## Related docs' to '## Related' for consistency with sibling pages
and converted the 3-bullet list into a CardGroup linking
agent-workspace, system-prompt, and the SOUL.md template.
docs/tools/perplexity-search.md: removed the duplicate
'# Perplexity Search API' H1 (Mintlify renders title from frontmatter).
Replaced 2 typography characters and converted the 4-bullet Related
list into a CardGroup; verified web/brave-search/exa-search targets.
docs/tools/apply-patch.md: converted the 3-bullet Related list into a
CardGroup linking diffs, exec, and code-execution.
docs/concepts/presence.md: replaced 8 curly quote and non-breaking
hyphen characters (U+201C/U+201D/U+2019/U+2011) with ASCII equivalents
so grep, copy-paste, and Mintlify search hit the right tokens.
Converted the 2-bullet Related list into a CardGroup adding cross-links
to gateway architecture and gateway protocol since presence is produced
by both surfaces.
docs/concepts/markdown-formatting.md: replaced 5 typography characters
(en-dash and curly quotes) with ASCII equivalents and converted the
2-bullet Related list into a CardGroup pointing at streaming/chunking
and system prompt.
docs/concepts/typing-indicators.md: replaced 4 typography characters
with ASCII equivalents and converted the 2-bullet Related list into a
CardGroup with the same Presence and Streaming cross-links.
Verified /concepts/streaming, /concepts/system-prompt,
/concepts/architecture, and /gateway/protocol targets all exist.