Skip to content

fix(session): allow clearing archived timestamp via HTTP API#27510

Open
kjhq wants to merge 3 commits into
anomalyco:devfrom
kjhq:fix/session-allow-null-archived
Open

fix(session): allow clearing archived timestamp via HTTP API#27510
kjhq wants to merge 3 commits into
anomalyco:devfrom
kjhq:fix/session-allow-null-archived

Conversation

@kjhq
Copy link
Copy Markdown

@kjhq kjhq commented May 14, 2026

Issue for this PR

Closes #12393
Unblocks #16030

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The internal session schema (UpdatedTime at session.ts:302) supports null for the archived field, but the HTTP API UpdatePayload schema rejects it. You can archive a session via the API but cannot unarchive it.

This aligns the HTTP API schema with the internal domain model by accepting null for archived in:

  • UpdatePayload (httpapi/groups/session.ts:51)
  • SetArchivedInput (session/session.ts:261)
  • setArchived function signature and implementation (session/session.ts:729)

The setArchived implementation also coalesces undefined to null because the projector rejects undefined (it requires explicit null to clear a field).

How did you verify your code works?

  • Added test: PATCH with time: { archived: null } clears the timestamp and returns archived: undefined
  • Added test: unarchived sessions reappear in listGlobal default results
  • Ran bun typecheck in packages/opencode — passes
  • Ran bun test test/server/httpapi-session.test.ts — 13 pass, 0 fail
  • Ran bun test test/server/global-session-list.test.ts — 4 pass, 0 fail

Screenshots / recordings

N/A — not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The internal session schema (UpdatedTime) supports null for the archived
field, but the HTTP API UpdatePayload schema rejects it. This means you
can archive a session via the API but cannot unarchive it.

This aligns the HTTP API schema with the internal domain model by
accepting null for the archived field in:
- UpdatePayload (httpapi/groups/session.ts)
- SetArchivedInput (session/session.ts)
- setArchived function signature (session/session.ts)

Unblocks anomalyco#16030
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, here are the potentially related PRs:

Potentially Related PRs:

  1. feat(app): view archived sessions & unarchive #15250 - feat(app): view archived sessions & unarchive

    • Related to unarchiving sessions functionality
  2. feat: add unarchive/restore for archived sessions #24154 - feat: add unarchive/restore for archived sessions

    • Also addresses unarchiving/restoring archived sessions

However, PR #27510 (the current PR) appears to be a focused fix addressing a specific API schema alignment issue (allowing null for the archived field), whereas the other PRs seem to be broader feature implementations for unarchiving functionality. These may be complementary rather than duplicates, but they're worth reviewing to ensure there's no overlapping work.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to unarchive in opencode-desktop

1 participant