You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: --continue flag picks up archived sessions #22175
The --continue flag in both opencode run (CLI) and the TUI picks up archived sessions. If the most recently updated root session has been archived, --continue will resume it instead of finding the next non-archived session.
Use case
Plugin systems can spawn headless agents via opencode run --pure for background tasks (code auditing, knowledge graph ingestion, etc.). These create real sessions in the database that are more recent than the user's interactive session. Archiving them on completion is the natural cleanup path, but --continue currently ignores the archived flag and picks them up anyway. With this fix, plugins can archive background sessions and --continue will correctly skip past them to the user's last interactive session.
Steps to reproduce
Create a session and do some work in it
Archive the session (via TUI)
Run opencode run -c or launch the TUI with --continue
The archived session is resumed instead of being skipped
Expected behavior
--continue should skip archived sessions and resume the most recent non-archived root session, consistent with how Session.listGlobal() already filters archived sessions by default.
Actual behavior
--continue uses Session.list() via the /session endpoint, which does not filter archived sessions. The .find() call only checks for parentID === undefined but does not check time.archived.
Activity
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.