Skip to content

Add agent self-archive and peer archive tools - #2047

Draft
rapind wants to merge 1 commit into
tiann:mainfrom
rapind:feature/agent-chat-archive
Draft

rapind wants to merge 1 commit into
tiann:mainfrom
rapind:feature/agent-chat-archive

Conversation

@rapind

@rapind rapind commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Agents can archive the current HAPI chat with archive_peer({}), or another accessible chat with sessionIdPrefix. The CLI exposes hapi archive-peer <id-or-prefix> and explicit --self targeting through HAPI_SESSION_ID. Archiving retains history, supports reopening, and adds no per-call confirmation prompt.

Both paths reuse the existing namespace-scoped peer authentication and archive endpoint. Invalid or ambiguous targets fail before mutation. Existing runner stop checks remain intact; an unconfirmed stop now returns HTTP 409 with its reason. Lost archive responses are reported as unknown outcomes and are never retried automatically. Self-archiving can stop the caller before its response arrives, so the tool description and CLI documentation explain how to check from another session.

Related to #2021. This version adds current-chat targeting and preapproval of recoverable archive actions while retaining the current runner stop verification. Creation and deletion remain separate work.

Validation:

  • Repository typecheck passed.
  • 106 focused CLI/MCP tests and 99 focused hub tests passed, including real MCP requests, namespace rejection, repeated archive requests and history retention.
  • All package suites ran. Six existing failures also reproduce on main: three CLI tests whose temporary Git commits are rejected by the host author hook, one hub PATH probe, and two web StorageEvent tests. Shared and relay suites passed.
  • No existing chats were archived, and no running hub or runner was restarted.

@heavygee heavygee added enhancement New feature or request area:cli CLI, runner, agent wrappers area:hub Hub server (API, sync, store) community-pr PR from non-collaborator contributor labels Oct 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli CLI, runner, agent wrappers area:hub Hub server (API, sync, store) community-pr PR from non-collaborator contributor enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants