Skip to content

Retain item attachments when storage is unavailable - #49402

Merged
brennanb2025 merged 4 commits into
mainfrom
brennanb2025/item-retention-622
Nov 28, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
brennanb2025/item-retention-622

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca temporarily cannot read the saved item data, it now keeps screenshot files instead of deleting them. Once the saved data is available again, normal cleanup resumes.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​76 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​57

What Changed

Represent an unavailable item store as unknown retention data and have attachment cleanup preserve uploads in that state. An opened store with no pending item mail still permits normal cleanup.

Why

A temporary startup storage failure previously looked like an empty list of retained uploads, so a screenshot accepted for delivery could be removed before its recipient claimed it.

Linked Issue

Tracked in STA-18518.

Visual Proof

Example result

Orca remains usable after attachment cleanup

Testing

  • Added coverage for unopened, failed, empty, and recovered item-store retention reads, plus attachment sweeping behavior.

  • TC_GATE_POOL=test tc-gate node node_modules/vitest/vitest.mjs run --config config/vitest.config.ts src/main/native-chat/agent-session-attachments/agent-session-attachment-sweep.test.ts src/main/bots/bot-items-runtime.test.ts

  • tc-gate pnpm tc:node

  • I manually tested these changes locally

  • Automated tests added/updated

  • Every added test fails without this change and avoids the test anti-patterns

Performance

None, because this adds no repeated work and skips deletion only while the required retention data cannot be read.

Risk

Level: Low

The riskiest path is temporary item-store unavailability; affected uploads are retained longer rather than deleted. This does not alter attachments on remote hosts or user settings, and a plain revert restores the prior cleanup behavior.

AI Disclosure

N/A

Review

Pending.

Agent skill upstream boundary

  • Not applicable.

Notes

Security, cross-platform behavior, remote hosts, mobile, backwards compatibility, and performance were considered; no new platform-specific paths or external effects are introduced.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I stated the risk and rollback
  • Screenshot included
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path impact considered
  • Targeted tests and node typecheck pass; final checks pending

@brennanb2025
brennanb2025 marked this pull request as ready for review November 26, 2026 07:25
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The item-store lookup now distinguishes an absent store from a store that cannot be read. The attachment sweep receives nullable retention results. It keeps old uploads when the result is null, and it can remove unlisted uploads when the result is an empty set and markForSweep succeeds.

Merge Risk: Minimal · up to d8081

Attachments are now kept when item storage cannot be read, and normal cleanup resumes once the data is readable again. No remaining defect was found. The cost is that affected uploads are retained longer during temporary storage unavailability, which the PR intends.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Retain item attachments when storage is unavailable" matches the main change. The PR makes attachment cleanup keep uploads when item-store retention data cannot be read, instead of treating…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template and fills in every required section: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk (level Low), AI Disclosure, Review,…
Full details: Title check

Explanation

The title "Retain item attachments when storage is unavailable" matches the main change. The PR makes attachment cleanup keep uploads when item-store retention data cannot be read, instead of treating the failure as an empty retained set. The title is short, specific, and describes the behavior change.

Full details: Description check

Explanation

The description follows the repository template and fills in every required section: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk (level Low), AI Disclosure, Review, upstream boundary, Notes, and Checklist. It explains the mechanism (an unavailable item store is treated as unknown retention data, and cleanup skips deletion in that state) and the reason (a temporary startup storage failure could make a pending screenshot look unclaimed and get deleted). It names the targeted test command and a rollback path. Gaps: the Linked Issue section cites only 'Tracked in STA-18518' and not a 'Fixes #' issue link, which the template asks for; Manual testing is unchecked; the Testing section does not state which platforms were tested; the Visual Proof is a single screenshot of an 'Orca remains usable' result rather than a before/after pair as the template requests; and the Review section says 'Pending.' The overall description is mostly complete, so the check passes, but the author should address the issue link and the before/after visual proof.

  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d29466d-f010-4a9a-b018-5ea2abb58c47
Commits

Reviewing files that changed from the base of the PR and between 47980a4 and d808182.

Files selected for processing: 8

  • src/main/bots/bot-item-attachment-retention.ts
  • src/main/bots/bot-items-runtime.test.ts
  • src/main/bots/bot-items-runtime.ts
  • src/main/native-chat/agent-session-attachments/agent-session-attachment-sweep.test.ts
  • src/main/native-chat/agent-session-attachments/agent-session-attachment-sweep.ts
  • src/main/runtime/agent-session/installation/structured-agent-session-attachment-sweep.ts
  • src/main/runtime/agent-session/installation/structured-agent-session-attachment-wiring.ts
  • src/main/runtime/agent-session/installation/structured-agent-session-runtime-contract.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@brennanb2025
brennanb2025 merged commit 4ecc610 into main Nov 28, 2026
84 checks passed
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