Skip to content

feat(chat): archived DMs are unpinned (CHE-1801) - #275

Merged
congvc-dev merged 4 commits into
mainfrom
agent/x99-claude-sonnet/che-1801-archive-unpins
Oct 16, 2026
Merged

congvc-dev merged 4 commits into
mainfrom
agent/x99-claude-sonnet/che-1801-archive-unpins

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Status

Layer L1c of the CHE-1755 stack (stage 1, Addendum A2). Based on main at f37d08ba1f61610d2266a05ee3ee4a353bf94157. No predecessor.
Author: x99-claude-sonnet (Anthropic). A different-lab reviewer must sign before ready (RGS-1).
Agent-side scope is complete at head a55221e86f43a8546dfbb4d7c8d7465fe4f41783. Independent review and exact-range OCR are recorded below. Cheese retains the merge gate.

Change

  • Archiving a DM clears its pin (SetChatSessionArchived). Unarchive leaves it unpinned.
  • Continuing a DM unpins the archived source (ArchiveContinuedChatSession). The new DM keeps the copied pin.
  • PATCH /api/chat/sessions/{id}/pin with pinned: true on an archived DM returns 409. Unpin on an archived DM still succeeds. The guard is in the SQL WHERE, so it holds against a concurrent archive.
  • Migration 627_unpin_archived_chat_sessions sets pinned_at = NULL for archived rows that still carry a pin. The down migration is a no-op because the cleared pins are not recoverable.
  • The chat:session:updated events for archive and continue now carry pinned, so other open clients drop the pin without a refetch.
  • Send to an archived DM is unchanged and still returns 409.

Conditions

  • Migration 627 is applied by the normal C00 deploy. This PR does not apply it to production. The migration statement takes row locks. The migration runner separately takes its existing session advisory lock. No application-wide lock is added.
  • L2 (CHE-1759) and L4 (CHE-1760) hide pin on archived DMs and rely on this layer.
  • TestContinueChatSessionPreservesPin asserted the old behavior (source keeps its pin). It is changed in its own tests-only commit to expect an unpinned source, as Addendum A2 requires.
  • The migration test fails on the parent by a missing migration file, which is weaker red than the behavioral failures. Three handler tests plus the continue test fail on assertions.
  • No stage-2 admission, production migration, deployment or agent merge is authorized by this handoff.
  • A later base/head change requires fresh applicable acceptance, independent review and OCR evidence. The evidence below does not transfer to a changed pair.

Evidence

Test-First Gate: commits 1824b8843186ee8d7847f3917eee0d269703c177 and 6f63a0eea1d0543c7b7de8420e7263b5132ce399 hold tests only and fail against the parent code. Commit a55221e86f43a8546dfbb4d7c8d7465fe4f41783 implements and turns them green.

Red output, new tests (go test ./internal/handler -run <new tests>, parent code):

    chat_archived_unpinned_test.go:64: archived DM kept pinned_at; archived means unpinned
    chat_archived_unpinned_test.go:68: unarchive restored the pin; it must leave the DM unpinned
--- FAIL: TestArchivingAChatSessionClearsItsPin
    chat_archived_unpinned_test.go:91: continued (archived) source kept its pin
--- FAIL: TestContinuingAPinnedChatSessionMovesThePinToTheNewDM
    chat_archived_unpinned_test.go:105: PATCH /api/chat/sessions/<id>/pin: expected 409, got 200
--- FAIL: TestPinningAnArchivedChatSessionIsRefused
--- PASS: TestUnpinningAnArchivedChatSessionSucceeds
--- PASS: TestPinningAnActiveChatSessionStillWorks
    chat_archived_unpinned_test.go:147: want exactly one *_unpin_archived_chat_sessions.up.sql migration, got []
--- FAIL: TestUnpinArchivedChatSessionsMigration

Red output, changed test (-run TestContinueChatSessionPreservesPin, parent code):

    chat_continue_test.go:290: session <source> pinned_at = {Time:2025-01-02 10:04:05.123456 +0700 +07 ... Valid:true}, want {... Valid:false}
--- FAIL: TestContinueChatSessionPreservesPin

Two of the new tests pass on the parent on purpose. They guard that unpin on an archived DM and pin on an active DM keep working.

Green, on the implementation head, X99, throwaway pgvector/pg17:

  • All six new tests and TestContinueChatSessionPreservesPin pass.
  • go test ./internal/handler -run 'Chat|Pin|Archiv', ./cmd/server, ./cmd/migrate and ./pkg/db/...: ok.
  • Full go test ./internal/handler once: one failure, TestUpdateComment_GovernanceFlagOn_ProviderSucceeds_ResponseUnaffected (governance receipt, a RESTY ... context deadline exceeded log). It passes 3 of 3 when run alone. It touches no chat code.
  • go vet and gofmt are clean for the changed files. make sqlc output is committed.
  • Not run: frontend and mobile suites (no TS change), Playwright E2E, the migration against a production-sized table.

Review and CI attribution

Changelog: none

Closes CHE-1801

@congvc-bot-x99 congvc-bot-x99 Bot changed the title feat(chat): archived DMs are unpinned feat(chat): archived DMs are unpinned (CHE-1801) Oct 15, 2026
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review October 16, 2026 01:01
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as draft October 16, 2026 03:00
@congvc-dev
congvc-dev marked this pull request as ready for review October 16, 2026 04:12
@congvc-dev
congvc-dev merged commit 74f406f into main Oct 16, 2026
19 checks passed
@congvc-dev
congvc-dev deleted the agent/x99-claude-sonnet/che-1801-archive-unpins branch October 16, 2026 04:12
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.

1 participant