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
Gate draft image ownership checks by local attachments - #32098
Restoring a draft could repeatedly resolve image ownership during unrelated status updates, even when no local stored attachment needed checking.
Solution
Only resolve local ownership when a structured draft includes a relevant local attachment-store image. Preserve retries when the draft returns to local ownership and ignore stale checks from a previous host.
ELI5
Draft images now check whether they still exist only when that check is needed. This avoids extra background work while still preventing missing local images from being sent.
What Changed
Gate local draft-owner resolution on structured drafts containing local attachment-store paths.
Keep ownership checks disabled for ordinary paths, paste paths, SSH attachments, terminal scopes, and drafts without images.
Add coverage for unrelated status publications, host changes during pending checks, and mounted/unmounted rechecks.
Extract the attachment hook test probe into a reusable test file.
Why
This reduces unnecessary work caused by unrelated app status updates while retaining correct missing-image handling for local restored attachments.
Linked Issue
If you do not have one and are an outside contributors, your PR wiil be ignored. Refs is not sufficient. Link an actual issue
Fixes #
Visual Proof
N/A — this changes background ownership-check scheduling and restored attachment validation without a visual UI change.
Testing
Added/updated tests in use-native-chat-composer-attachments.test.tsx covering demand-gated checks, host changes, and rechecks.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
No known issues in security, cross-platform support (Linux, Windows, macOS), Remote SSH, mobile, backwards compatibility, or performance. The change reduces unnecessary ownership-resolution work.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
The attachment hook now grants local-store authority only when its active checks include an eligible unconnected agent-session attachment-store image, while retaining the existing scope and owner conditions. Tests use a shared React probe and cover validation across attachment types, host changes, unrelated status updates, and upload sweeps with the composer mounted or unmounted.
Priority: ⬇️ Low
Merge Risk:⚪ Minimal · up to fe31e
The ownership gate preserves restored-image checks and retries while avoiding checks when there is no eligible pending image. No identified issue blocks merging after normal checks.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description explains the problem, solution, scope, testing changes, and lack of visual impact. It does not provide the required linked issue, and it does not report lint, typecheck, full test, or …
Add a valid issue link after "Fixes #". Report the results of pnpm lint, pnpm typecheck, pnpm test, and pnpm build, or state that CI will cover them. Complete the self-review checklist when applicable.
Docstring Coverage
Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the primary change: gating draft image ownership checks by local attachments.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the problem, solution, scope, testing changes, and lack of visual impact. It does not provide the required linked issue, and it does not report lint, typecheck, full test, or build results or confirm CI coverage.
Resolution
Add a valid issue link after "Fixes #". Report the results of pnpm lint, pnpm typecheck, pnpm test, and pnpm build, or state that CI will cover them. Complete the self-review checklist when applicable.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Restoring a draft could repeatedly resolve image ownership during unrelated status updates, even when no local stored attachment needed checking.
Solution
Only resolve local ownership when a structured draft includes a relevant local attachment-store image. Preserve retries when the draft returns to local ownership and ignore stale checks from a previous host.
ELI5
Draft images now check whether they still exist only when that check is needed. This avoids extra background work while still preventing missing local images from being sent.
What Changed
Why
This reduces unnecessary work caused by unrelated app status updates while retaining correct missing-image handling for local restored attachments.
Linked Issue
If you do not have one and are an outside contributors, your PR wiil be ignored. Refs is not sufficient. Link an actual issue
Fixes #
Visual Proof
N/A — this changes background ownership-check scheduling and restored attachment validation without a visual UI change.
Testing
Added/updated tests in
use-native-chat-composer-attachments.test.tsxcovering demand-gated checks, host changes, and rechecks.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
No known issues in security, cross-platform support (Linux, Windows, macOS), Remote SSH, mobile, backwards compatibility, or performance. The change reduces unnecessary ownership-resolution work.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)