Skip to content

fix(inbox): archive closes questions and reviews without telling the agent - #2862

Merged
simple-agent-manager[bot] merged 12 commits into
mainfrom
sam/httpsappsimple-agent-managerorgprojects01khrjganb-3fp6eq
Nov 18, 2026
Merged

simple-agent-manager[bot] merged 12 commits into
mainfrom
sam/httpsappsimple-agent-managerorgprojects01khrjganb-3fp6eq

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Problem. Inbox items from finished chats could not be archived. You clicked Archive, saw "Archived · the agent will be told", and ~5 s later the item came back with no error. The reported item, attention:chat_01M4XS6EE6EAHKSMF9VCZNFGXH:7eece64c-…, is a reconciliation_loop check-in pause on PR Shepherd run #163. In production its task was cancelled (2026-10-21), its workspace deleted, its chat stopped, and the marker was still unresolved.

Root cause. Archive always tried to tell the agent. archiveAttention called preparePromptForLiveAgent, which threw 404 No active workspace found for this session when the chat had no workspace. The claim was then released. The inbox UI treats any 404 as "answered elsewhere" (isStaleInboxError), so it refetched and the item reappeared.

Decision (Raphaël, 2026-11-17, reviewing this PR). Archive does not tell the agent: "Either the user chooses to engage, and the agent responds accordingly, or the user archives and leaves things in limbo." This revises decision 4 of inbox spec idea 01M7G03ZCQ6TM6CMEYDRKQ8ST9. Here it applies to questions and reviews; follow-up #2873 extends it to every kind, per his later answer.

Change.

Kind Before After
Question held as a marker live-agent prompt (404 when no workspace) marker resolved archived; no prompt (archiveAttention); a failed complete releases the claim
Question / review / result (#2881) in asks archived + queued notice; sweep retried misses archived with notified_at set in the same write (closeAsk(..., { silent: true })); open chat views get attention.resolved (ProjectData.recordQuestionArchived)
SAM's stall check-in on a task chat whose question was archived the closed question stopped holding check-ins off, so [SAM Orchestrator Check-In] reached the agent ~5 min later held until someone writes in the chat, at most inbox.archiveCheckinHoldHours (new admin setting, default 168 h): holdReconciliationAfterArchive; any human message releases it (closeQuestionAsks → releaseQuestionHold). The archive time is read before the closing write, so a message landing between the close and the hold call ends it (humanMessageSince)
Earlier-build archived questions/reviews/results with notified_at IS NULL notice sweep would still tell the agent; error sweep could report "undelivered" both sweeps skip them
Permission / approval / secret / task / error unchanged here (#2873)
  • archiveAttention requires task:write and a chat writer (requireSessionWriter). Ask archive no longer calls authorizeAnswerWake, since nothing wakes. An archive claim left staged by an earlier build is completed, and a failed complete releases the claim only when this request staged it.
  • The web receipt reads Archived, and the Archive button's accessible name is "Archive: close it". Docs updated: inbox guide, API reference, admin settings, recent product changes. Connector tool text updated.

Validation

  • pnpm lint (eslint on all changed files clean)

  • pnpm typecheck (api, web, operations, project-data)

  • pnpm test (affected suites; CI: every test job green)

  • Additional validation run: worker suites inbox-capability (16), inbox-agent-tools-capability, inbox-tasks-capability; api unit operations / services/inbox / system-errors / mcp; web inbox 428/428

  • If this PR changes candidate selection for a sweep/cron/alarm loop: the two inbox sweeps gain an exclusion (NOT (status='archived' AND kind IN ('question','review'))), which can only shrink their candidate sets; per-candidate cost is unchanged

  • I/O: archive adds no round trips (the hold rides the existing recordQuestionArchived RPC, plus one indexed read in the DO). Each human chat message adds one primary-key do_meta read (releasing a hold); the ingest-cost snapshot records it.

Discrimination: with the old notify-on-archive code restored, exactly the rewritten archive tests failed. Each of these goes red with its guard removed, and only it:

  • the sweep-exclusion tests;
  • the hold tests (reconciliation-loop.test.ts: archive hold → no candidate, human message → candidate);
  • the archive-then-message ordering test (inbox-capability.test.ts);
  • the archivedAt-before-close assertion (question-asks.test.ts);
  • the claim-ownership test (chat-attention-archive-claim.test.ts).

Staging Verification (REQUIRED for all code changes — merge-blocking)

  • Staging deployment green — Deploy Staging run 44222314000 (staging2, head a817fdf88) passed, including smoke tests
  • Live app verified via Playwright — signed in to app.sammy2.party as staging2-test-user (workload identity) and drove the real inbox UI
  • Existing workflows confirmed working — /dashboard, /projects, project Overview, project Chat and /settings load, with no failed API calls and no console errors
  • New feature/fix verified on staging — see below
  • Infrastructure verification completed — N/A: no infra changes
  • Mobile and desktop verification notes added for UI changes

Staging Verification Evidence

Full detail: #2862 (comment)

  • A Claude Code chat filed two inbox_write ask questions.
  • Live chat, desktop: archiving question A gave the "Archived" receipt and 200 {outcome:"archived", agentNotified:false}. The item left the inbox, no chat messages arrived in 45 s, and the agent stayed awaiting_followup.
  • Stopped chat with its workspace deleted (the reported bug), mobile: archiving question B gave the same 200; the inbox then read "Nothing needs you".
  • No failed API calls and no console errors. The test chat, workspace and node are cleaned up, and the lease is released.

Check-in hold (staging2, head e67c97fd0, Deploy Staging run 44268113294):

  • A task-mode Claude Code chat filed a blocking question and ended its turn. Archiving it from the inbox UI gave 200 {outcome:"archived", agentNotified:false}, and the chat card reads "Archived".
  • Watching the chat for 10 minutes (past the 5-minute idle window plus a sweep), no message was added, there was no check-in, and the task stayed in_progress.
  • Control: I then wrote in the chat ("no answer needed, reply ok"), the agent replied, and the normal [SAM Orchestrator Check-In] arrived about 5 minutes later. So check-ins are live on staging2, and writing in the chat ends the hold.
  • Not caused by this PR: the inbox badge read 1 while the list was empty. That row was a result left by Inbox: agents hand finished answers to you as Result items #2881's staging run before that kind existed on this branch; it is merged now.

UI Compliance Checklist (Required for UI changes)

  • Mobile-first layout verified (375×667 on staging2)
  • Accessibility checks completed: the Archive button's accessible name is "Archive: close it", and the receipt is text
  • Shared UI components used or exception documented: copy-only change, no new components
  • Playwright visual audit run locally: CI Playwright Visual Tests passed; this copy-only change was exercised live on staging at both widths, normal and empty states
  • Desktop and mobile screenshots for every changed UI surface are posted in a PR comment and linked below
  • Agent/human reviewed the posted screenshots for quality control and found no visual issues, or fixed/documented every issue found

UI Screenshot Evidence

Screenshots taken with Playwright on staging2 and stored in the project Library at /pr-evidence/2862-inbox-archive/staging2/. Listed in #2862 (comment).

Surface: Inbox item Archive receipt (desktop list + item view)

Surface: Inbox item view on phone (full-screen item)

End-to-End Verification (Required for multi-component changes)

  • Data flow traced from user input to final outcome with code path citations
  • Capability test exercises the complete happy path across system boundaries
  • All spec/doc assumptions about existing behavior verified against code
  • If any gap exists between automated test coverage and full E2E, manual verification steps documented below

Data Flow Trace

  1. Inbox Archive button → usePendingArchive (apps/web/src/components/inbox/useInbox.ts) → archiveInboxItem (apps/web/src/lib/api/inbox.ts) → POST /api/projects/:projectId/inbox/items/:ref/archive (apps/api/src/routes/inbox.ts).
  2. archiveInboxItem (packages/operations/src/inbox-write-core.ts) → requireActable. Then:
    • ask: closeAsk(..., { silent: true }) sets status='archived' and notified_at in one write, then ports.inbox.questionArchived → announceQuestionArchived (apps/api/src/services/inbox/agent-asks.ts) → ProjectData.recordQuestionArchived broadcasts attention.resolved.
    • attention: ports.inbox.archiveAttention → archiveAttention (apps/api/src/routes/chat-attention.ts), which calls prepareAttentionArchive then completeAttentionArchive (packages/project-data/src/do/attention.ts).
  3. Hold: archiveCheckinHold (read before the closing write) → ProjectData.recordQuestionArchived → holdReconciliationAfterArchive (packages/project-data/src/do/reconciliation-candidate-state.ts) unless humanMessageSince(archivedAt). The reconciliation loop then skips the chat until the gate's nextAttemptAt; a human message → closeQuestionAsks → releaseQuestionHold.
  4. Sweeps: runInboxAskSweep (apps/api/src/services/inbox/sweep.ts) and fileUndeliveredAskAnswers (apps/api/src/services/inbox/system-errors.ts) skip archived questions, reviews and results.

Untested Gaps

N/A: full flow covered by automated tests and the staging run. One limitation: marker-era questions (filed before slice G) can't be created on staging any more; they are covered by worker tests through the real route, Durable Object and D1.

Post-Mortem (Required for bug fix PRs)

What broke

Inbox items from chats whose workspace was gone could never be archived. Archive appeared to work, then the item silently returned.

Root cause

Inbox slice A/C (#2776, #2779) implemented archive as "tell the agent" through the live-agent prompt path. That path requires a live workspace (resolveLiveAgentSessionForChat), and isStaleInboxError treated the resulting 404 as an item closed elsewhere.

Class of bug

An action that depends on a downstream side effect (notifying a runtime that may no longer exist) whose failure is classified by the client as benign. The user-visible operation becomes impossible without any error.

Why it wasn't caught

Every archive test used a live workspace and agent. No test archived an item from a chat whose runtime was gone, and the client's 404 → "stale" mapping hid the failure.

Process fix included in this PR

The incident-shape test (archive on a stopped chat with a deleted workspace) and archive tests that assert no notice. The design that made archive depend on a live agent is removed. No rule change: rules 62 and 58 already cover "reach the feature the way production does" and destroyer/resumer agreement.

Post-mortem file

This PR body; spec note on idea 01M7G03ZCQ6TM6CMEYDRKQ8ST9 (note 01M7N16136DNNG3T7F0HGENXST).

Specialist Review Evidence (Required for agent-authored PRs)

  • All local reviewers completed and findings addressed before merge
  • If any reviewer did NOT complete: needs-human-review label added and merge deferred to human (N/A: every reviewer completed.)
Reviewer Status Outcome
security-auditor ADDRESSED No blocking findings. LOW: release the archive claim if completing it fails, fixed in 99c036a. LOW: earlier-build archived rows, fixed in 81fb229
correctness reviewer (general-purpose) ADDRESSED MEDIUM: open chat views not cleared live, fixed in 991084f (recordQuestionArchived). Stale button label and docs fixed in 991084f
Codex connector (bot review) ADDRESSED P2 legacy archived notices and P2 API reference wording: fixed in 81fb229 and 991084f. P2 archive let SAM's check-in nudge the agent: fixed with the check-in hold. P2 hold reinstated after a later chat message: fixed (archivedAt + humanMessageSince). P2 finishing another request's in-flight claim: release now limited to our own claim; completing a stranded claim kept, with reasons. P2 failed hold RPC not repaired: accepted, worst case is the pre-PR check-in, reasons in the thread. All threads resolved

CodeRabbit Review Evidence (Required for agent-authored PRs)

  • CodeRabbit requested when the PR was marked ready for review
  • Waited about 15 minutes (or until a skip, rate-limit or quota reply), or up to about 45 minutes in total while a review CodeRabbit had started was still in progress
  • Either CodeRabbit reviewed and no CodeRabbit feedback is unresolved, or it did not review and the observed outcome is recorded below

CodeRabbit Notes

Requested at 15:50Z by applying the coderabbit-review label when the PR was marked ready. Within minutes CodeRabbit replied with a rate-limit notice, so the wait ended at once and no review arrived (rule 25: recorded and skipped).

Exceptions (If any)

  • Scope: The final head (9b79bb5f4) was not redeployed to staging. Staging verified the feature on a817fdf88 and e67c97fd0 (above). Later commits:
    • 665823e7e (claim release on a failure path);
    • 679b7e570 (results archive silently through the same closeAsk(..., { silent: true }) path staging exercised for questions; sweep exclusions);
    • 9b79bb5f4 (a race between an archive and a chat message).
  • Rationale: staging2's GCP teardown is blocked until fix: isolate GCP WIF setup by installation and preserve teardown proof #2880 merges. A reconnect under another build would break the shared WIF issuer, and the coordinating agents asked that no new GCP VMs be created there. Primary staging had a ~1.5 h queue and a rejected smoke token. Each later change is covered by tests proven to fail without it. Raphaël chose to merge on green CI (2026-11-18, ~10:35 UTC).
  • Expiration: this PR only.

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

External References

N/A: no external APIs involved; the change is internal to the inbox operations, ProjectData Durable Object and D1.

Codebase Impact Analysis

  • packages/operations/src/inbox-write-core.ts (archive switch, closeAsk silent option) and ports.ts (questionArchived).
  • apps/api/src/routes/chat-attention.ts (archiveAttention: writer check, claim, complete, no prompt) and apps/api/src/services/inbox/{agent-asks,port,sweep,system-errors}.ts.
  • packages/project-data (recordQuestionArchived RPC + client).
  • apps/web/src/components/inbox/{useInbox,useInboxWalk}.ts and apps/web/src/pages/inbox/InboxPage.tsx: receipt and accessible-name copy only.
  • Authorization: archive no longer requires the agent-wake grant (nothing wakes). Asks still require the assignee via requireActable and the closeAsk predicate; markers still require task:write and a chat writer.

Documentation & Specs

  • apps/www/src/content/docs/docs/guides/inbox.md (Archive section)
  • apps/www/src/content/docs/docs/reference/api.md (archive route and paragraph, wake-right sentence)
  • apps/www/src/content/docs/docs/guides/admin-settings.md and packages/operations/src/inbox-settings-definition.ts (noticeRetryMinutes)
  • apps/www/src/content/docs/docs/guides/recent-product-changes.md
  • Spec idea 01M7G03ZCQ6TM6CMEYDRKQ8ST9: decision note added

Constitution & Risk Check

  • Principle XI: no new hardcoded values; existing settings are reused.
  • Rule 11: project and assignee scoping is kept in every write predicate.
  • Rule 28 / 63: the security review found nothing blocking; the only narrowing is the removed wake grant.
  • Rule 31: no migrations.
  • Risk: an agent waiting on an archived blocking question is no longer stopped by expiry and stays in limbo until a person engages. That is the intended product behaviour, and it is documented.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@simple-agent-manager simple-agent-manager Bot changed the title fix(inbox): archive questions from chats whose workspace is gone fix(inbox): archive closes questions and reviews without telling the agent Nov 17, 2026
@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 17, 2026 15:50
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 17, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T09:48:38.984586Z
We couldn’t complete this review. Comment @codex review to try again.
9b79bb5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26050af8cd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@github-actions
github-actions Bot requested a deployment to staging2 November 17, 2026 15:55 Abandoned
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 17, 2026
Nothing is sent on archive any more, so a failed complete can always release
the staged claim; leaving it would make every answer to the question 409.
From security review of #2862.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 17, 2026
From review of #2862. Archiving a question in D1 asks used to clear it live
only as a side effect of delivering the agent notice, so with the notice gone
an open chat kept showing the question until it refetched. Archive now calls
ProjectData.recordQuestionArchived, which broadcasts attention.resolved
(reason 'archived'). Unlike a withdrawal it keeps SAM's check-in hold until the
question's deadline, so archiving does not nudge the agent. Never throws.

Also: the inbox Archive button's accessible name no longer says it tells the
agent, and the API reference / noticeRetryMinutes descriptions match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 17, 2026
… archived

Questions and reviews archived before silent archive, whose notice was never
queued, still had notified_at NULL, so the notice sweep would have told their
agents after deploy and the error sweep could have reported the omitted notice
as undelivered. Both sweeps now skip archived questions and reviews. From the
Codex review of #2862.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions
github-actions Bot requested a deployment to staging2 November 17, 2026 17:42 Abandoned
@simple-agent-manager

Copy link
Copy Markdown
Contributor Author

Staging verification blocked by staging infrastructure (not by this change). Not merging.

  • The staging2 deploy of a63042c31 passed, including smoke tests (run 44139464386).
  • The live check needs an agent to file inbox questions. The Claude Code test chat (staging2-agent-user, task 01M7NAKZDN5HC26RSHC06SJP6H) failed on its first model call: API Error: 402 AI inference failed (402).
  • staging2 Worker log ai_proxy_anthropic.upstream_error (18:05:17Z) shows AI Gateway error 2052: "Insufficient unified billing balance for this request. Your available balance is $0.52. Add credits on the AI Gateway Cloudflare dashboard, or use your own provider key (BYOK)." The staging Cloudflare account (shared by staging and staging2) is out of AI Gateway credit, so no platform-key agent can run on either installation.
  • Cleanup: the test chat is stopped, its workspace and node (01M7NAM8QYXKG5CCHVJ3ZJ7YPR) are deleted, I've signed out, and the staging2 lease is released.

Waiting on a human decision: add AI Gateway credits (then I re-run the live check), or approve merging on the automated coverage. That coverage includes real-route, Durable Object and D1 worker tests of every archive path.

@simple-agent-manager simple-agent-manager Bot added the needs-human-review Agent could not complete all review gates — human must approve before merge label Nov 17, 2026
@github-actions
github-actions Bot requested a deployment to staging2 November 17, 2026 18:20 Abandoned
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 18, 2026
Nothing is sent on archive any more, so a failed complete can always release
the staged claim; leaving it would make every answer to the question 409.
From security review of #2862.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 18, 2026
From review of #2862. Archiving a question in D1 asks used to clear it live
only as a side effect of delivering the agent notice, so with the notice gone
an open chat kept showing the question until it refetched. Archive now calls
ProjectData.recordQuestionArchived, which broadcasts attention.resolved
(reason 'archived'). Unlike a withdrawal it keeps SAM's check-in hold until the
question's deadline, so archiving does not nudge the agent. Never throws.

Also: the inbox Archive button's accessible name no longer says it tells the
agent, and the API reference / noticeRetryMinutes descriptions match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 18, 2026
… archived

Questions and reviews archived before silent archive, whose notice was never
queued, still had notified_at NULL, so the notice sweep would have told their
agents after deploy and the error sweep could have reported the omitted notice
as undelivered. Both sweeps now skip archived questions and reviews. From the
Codex review of #2862.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simple-agent-manager
simple-agent-manager Bot force-pushed the sam/httpsappsimple-agent-managerorgprojects01khrjganb-3fp6eq branch from a63042c to 4411f6b Compare November 18, 2026 00:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e67c97fd01

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/api/src/routes/chat-attention.ts Resolved
raphaeltm and others added 10 commits November 18, 2026 09:29
Archiving a marker-era inbox question always tried to deliver a "the person
archived your question" prompt to the chat's live agent. For a chat whose
workspace was deleted (task cancelled, session stopped), the live-agent
resolver returned 404, the archive claim was released, and the inbox UI
treats 404 as "already handled elsewhere", so it silently refetched and the
item came back. Such items could never be archived.

archiveAttention now checks for a live workspace bridging the chat
(the same liveSessionWorkspaceCondition the delivery uses; sleeping
workspaces still count as live) and, when there is none, closes the marker
with reason 'archived' without notifying anyone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raphaël (2026-11-17) revised inbox spec decision 4: archiving should leave
the agent where it is. A person who wants the agent to act answers or
engages in the chat; archive just closes the item.

- archiveAttention (marker-era questions) no longer prepares or sends a
  live-agent prompt. It checks the caller is a writer of the chat, claims
  and resolves the marker with reason `archived`, and completes an archive
  claim an earlier build left staged. This also removes the dependency on a
  live agent that made items from finished chats impossible to archive.
- Asks (questions, reviews) close with `notified_at` set in the same write,
  as error items already do, so the notice sweep never sends one later. The
  agent-wake grant is no longer needed to archive, since nothing wakes.
- Permissions, approvals and secret requests still archive as deny/decline,
  and human tasks still wake their watchers.
- Receipt reads "Archived"; Connector tool text and docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing is sent on archive any more, so a failed complete can always release
the staged claim; leaving it would make every answer to the question 409.
From security review of #2862.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review of #2862. Archiving a question in D1 asks used to clear it live
only as a side effect of delivering the agent notice, so with the notice gone
an open chat kept showing the question until it refetched. Archive now calls
ProjectData.recordQuestionArchived, which broadcasts attention.resolved
(reason 'archived'). Unlike a withdrawal it keeps SAM's check-in hold until the
question's deadline, so archiving does not nudge the agent. Never throws.

Also: the inbox Archive button's accessible name no longer says it tells the
agent, and the API reference / noticeRetryMinutes descriptions match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… archived

Questions and reviews archived before silent archive, whose notice was never
queued, still had notified_at NULL, so the notice sweep would have told their
agents after deploy and the error sweep could have reported the omitted notice
as undelivered. Both sweeps now skip archived questions and reviews. From the
Codex review of #2862.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the Codex review of #2862 (P2): archiving resolved the only thing that
kept SAM's silent-agent reconciliation off the chat (the unresolved
needs_input marker, or the open ask's deadline hold), so an idle task chat
became a check-in candidate and the agent got a "[SAM Orchestrator
Check-In]" despite archive telling it nothing.

- Archiving a question (asks-era or marker-era) now holds the chat's
  reconciliation gate (questionHold) until a person writes in the chat, for
  at most inbox.archiveCheckinHoldHours (new admin setting, default 168).
  holdReconciliationAfterArchive keeps a permanent task exclusion and a
  pending check-in intent, and never shortens a longer hold.
- Any person's chat message now releases a question hold, not only one that
  closed an open question, so the archive hold ends when the person engages.

Tests: reconciliation candidates exclude the chat after an archive hold and
include it again after the release (real SQLite); worker tests assert the
gate after archiving through the real route (asks and marker) and its
release by a real human message. Each guard was removed once and its test
went red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A human message now releases an archive check-in hold, which reads the
chat's reconciliation gate: one primary-key do_meta lookup per user
message batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When completing a marker archive fails, release the shared answer/archive
claim only if this request staged it. A claim found already staged may
belong to another request still in progress (an earlier build during a
rolling deploy), so it is left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions
github-actions Bot requested a deployment to staging2 November 18, 2026 09:32 Abandoned
#2881 added result asks. Archive was already silent for every agent ask
kind; the two sweeps now also skip results an earlier build archived
without a notice, as they do for questions and reviews. The question
archived notice text had no caller left and is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simple-agent-manager
simple-agent-manager Bot force-pushed the sam/httpsappsimple-agent-managerorgprojects01khrjganb-3fp6eq branch from e67c97f to 679b7e5 Compare November 18, 2026 09:39
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

The archive closes its record, then installs SAM's check-in hold through a
separate ProjectData call. A person's message persisted in between released
a hold that did not exist yet, and the hold was then installed anyway.

The archive now reads archivedAt before the closing write and carries it
with the hold; ProjectData skips the hold when a person wrote in the chat
after it (humanMessageSince). A call without archivedAt (an earlier build)
installs the hold as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@sonarqubecloud

Copy link
Copy Markdown

This branch had an error being deployed

1 abandoned and 1 inactive deployments
staging2 — 9b79bb5f Deployed Nov 18, 2026 by github-actions[bot]
staging — 9b79bb5f Deployed Nov 18, 2026 by simple-agent-manager[bot] via lease #3314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant