Skip to content

[codex] Preserve mobile composer input failures#3343

Merged
juliusmarminge merged 3 commits into
codex/redact-dpop-request-targetfrom
codex/mobile-composer-image-errors
Jun 20, 2026
Merged

[codex] Preserve mobile composer input failures#3343
juliusmarminge merged 3 commits into
codex/redact-dpop-request-targetfrom
codex/mobile-composer-image-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace image-picker, clipboard, and pasted-file failures with a structured operation error
  • preserve the exact upstream cause while retaining only URI protocol and input length for pasted-image diagnostics
  • keep existing friendly fallback messages, per-file recovery, and temporary-file cleanup behavior
  • cover file-path and query-token redaction in structured warning payloads

Stack dependency

Validation

  • vp test run apps/mobile/src/lib/composerImages.test.ts (4 tests)
  • vp check (passes with 20 pre-existing warnings)
  • vp run typecheck
  • vp run lint:mobile

Note

Low Risk
Observability and error-shaping only; user-visible success/fallback behavior is largely unchanged aside from fixed messages on picker/clipboard load failure instead of upstream error.message.

Overview
Mobile composer image flows now use a ComposerImageOperationError tagged error (operation, optional URI length/protocol, preserved cause) instead of generic errors or logging raw pasted-image URIs.

Image picker, clipboard, and pasted-file paths wrap dynamic imports and async steps in this error type; load failures still return the same user-facing fallback strings but console.warn with structured payloads. Pasted-image diagnostics use getUrlDiagnostics (new @t3tools/shared/urlDiagnostics export) so logs keep protocol and length only—paths and query tokens stay out of warnings.

Shared also adds redactDpopRequestTarget for safe DPoP URL logging (scheme/host/port/path, no credentials/query/fragment), with tests; it is not wired into composer code in this PR.

A new test asserts read failures emit structured warnings without sensitive URI fragments in the error object or string form.

Reviewed by Cursor Bugbot for commit 3f2c845. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Preserve structured error context for mobile composer image input failures

  • Adds ComposerImageOperationError, a tagged error class in composerImages.ts with fields for operation name, URI length, and URI protocol — without exposing the raw URI.
  • Replaces generic Error throws and raw URI logging in pickComposerImages, pasteComposerClipboard, and convertPastedImagesToAttachments with structured ComposerImageOperationError instances.
  • Adds a describeComposerImageUri helper to extract safe URI diagnostics (length and protocol) for use in error construction.
  • Adds a test verifying that pasted image read failures log a structured error and do not leak sensitive URI tokens.
  • Behavioral Change: import failures for the image picker and clipboard now log a warning and return a generic user-facing error string instead of propagating the raw error message.

Macroscope summarized 3f2c845.

@coderabbitai

coderabbitai Bot commented Jun 20, 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

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4c6a5e49-4871-4422-9480-889678927878

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mobile-composer-image-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR improves error handling observability by adding structured error types with sanitized diagnostics. User-facing behavior is unchanged - error messages remain the same generic strings. Test coverage verifies sensitive URI content (tokens) is not exposed in error context.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 16:08

Dismissing prior approval to re-evaluate 405993e

juliusmarminge and others added 3 commits June 20, 2026 09:15
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/mobile-composer-image-errors branch from 405993e to 3f2c845 Compare June 20, 2026 16:18
@juliusmarminge juliusmarminge changed the base branch from main to codex/redact-dpop-request-target June 20, 2026 16:18
@juliusmarminge juliusmarminge merged commit 9e3a040 into codex/redact-dpop-request-target Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/mobile-composer-image-errors branch June 20, 2026 18:09
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant