Skip to content

[BUG] Archiving a running session via the API gives no warning and the run continues #66604

Backlog

Description

@Err0rCM

Description

In 2.4.1 I archived a session through the HTTP API while it was still running. The request succeeded with no warning or confirmation, and the run continued until it finished. Right after archiving, the session was returned by the archived=true list and not by the archived=false list.

Session.archive in packages/core/src/session/session.ts returns early only when the session is already archived. It does not look at execution state.

I understand that background sessions are meant to stay archived while they run (#66348). This report is about an interactive session that is already running when I archive it.

I expected archiving a running session to be refused, or to at least warn that the run will continue. I did not test how each client shows a later permission request or question from that session.

For comparison, OpenAI's help center says that archiving a Codex chat in the ChatGPT app stops a running chat, and shows a confirmation when one applies.

Plugins

No response

OpenCode version

2.4.1

Steps to reproduce

  1. Create a session and ask it to run sleep 60 with Bash, then reply DONE.
  2. While it runs, archive it: PATCH /api/session/<id> with {"archived": true}.
  3. Check the archived=true and archived=false lists, then wait for the run to finish.

Screenshot

No screenshot. On my machine: archived at 10:00:12. The assistant turn in progress completed at 10:01:05, a new assistant reply was written at 10:01:05, and the session went idle at 10:01:06.

Operating System

Linux 6.12.116+deb13-amd64

Terminal

Not used for this reproduction; the session was archived through the HTTP API.

Activity

  1. opencodejr commented on Nov 26, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and the timeline, @Err0rCM.

    You'd like archiving a session that is already running to either be refused, warn you that the run will continue, or stop the run, as the ChatGPT app does for Codex chats.

    As far as I can tell, archiving currently does what it was built to do, so I'm treating this as a feature request rather than a bug. In 2.4.1, Session.archive (packages/core/src/session/session.ts) returns early only when the session is already archived. Otherwise it marks the session archived. It hides the session from lists and doesn't affect a run in progress. The docs also describe archived sessions that keep running: opencode run --archived creates a session archived so scripted or CI runs stay out of session lists and the inbox. I didn't find anything in the docs or the code I read that says archiving should stop a run or ask for confirmation.

    Maintainers will consider the request. Related issues and pull requests:

  2. added
    area/sdk-api
    type/feature
    version/v2
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sdk-apiplatform/linuxtype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions