Skip to content

fix(desktop): allow large remote attachments - #66555

Closed
diffen77 wants to merge 1 commit into
NousResearch:mainfrom
diffen77:fix/desktop-large-attachment-upload
Closed

diffen77 wants to merge 1 commit into
NousResearch:mainfrom
diffen77:fix/desktop-large-attachment-upload

Conversation

@diffen77

@diffen77 diffen77 commented Jul 17, 2026

Copy link
Copy Markdown

Summary

  • give Desktop attachment uploads a dedicated 256 MiB file reader while preserving the existing 16 MiB preview limit
  • route remote non-image attachments through that dedicated Electron/preload IPC seam
  • raise uvicorn's finite WebSocket frame cap to 384 MiB so a 256 MiB attachment still fits after base64 and JSON-RPC expansion
  • cover the independent preview/upload limits, attachment-reader routing, and WebSocket-size contract

Test plan

  • npm exec --workspace apps/desktop vitest run electron/hardening.test.ts src/app/session/hooks/use-prompt-actions/utils.test.ts (32 passed)
  • python3 -m pytest tests/test_web_server.py -q (5 passed)
  • Headless Electron seam: the real hardening.test.ts helper reads and byte-compares a file above 16 MiB; no GUI/Electron renderer was available in this environment
  • Live loopback hermes serve smoke with a temporary HERMES_HOME and ephemeral query-token auth: sent exactly one successful real file.attach JSON-RPC carrying a 16,789,561-byte on-disk payload, then read back the backend-stored file and verified exact byte count plus SHA-256 (94b9e8d79a08535eb5f58c74c19539f96e374d20cca9a82c5455902b12539398)
  • Removed the temp source, stored attachment, temp HERMES_HOME, harness, and server logs; verified no listener/process remained on port 44041
  • git diff --check and clean worktree

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) comp/cli CLI entry point, hermes_cli/, setup wizard labels Jul 17, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Related to #62375 and #62382: this keeps a bounded one-shot compatibility path for larger attachments, while #62382 adds the independently useful resumable/chunked protocol.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for preserving the 16 MiB preview limit while adding a bounded upload-specific reader. Current main does reproduce the reported issue: remote non-image uploads use the preview reader at apps/desktop/src/app/session/hooks/use-prompt-actions/utils.ts:133, and Electron caps that reader at 16 MiB in apps/desktop/electron/hardening.ts:7.

Problems

  • The new ws_max_size capability changes the Desktop/backend compatibility boundary, but the PR does not bump it. tui_gateway/server.py:3582-3588 says DESKTOP_BACKEND_CONTRACT must be bumped when that contract changes; it remains v3. Desktop also still accepts v3 as current at apps/desktop/src/store/updates.ts:90-95. A new Desktop can therefore use the new 256 MiB reader against an older v3 remote backend, whose start_server() still lacks ws_max_size (hermes_cli/web_server.py:17994-18010), and the upload will fail at the old frame limit.

Suggested changes

  • Bump both producer and consumer contract constants to v4 and update their tests, so older remote backends surface the established skew/update warning. If transparent compatibility is required, add a version/capability fallback that keeps the 16 MiB reader for pre-v4 backends.

The member note links this bounded path to #62375 and #62382; versioning this requirement makes that compatibility boundary explicit. This is an automated hermes-sweeper review.

Comment thread hermes_cli/web_server.py
# reaped via the WebSocketDisconnect → disconnect/reap path.
ws_ping_interval=None if _is_loopback else 20.0,
ws_ping_timeout=None if _is_loopback else 20.0,
ws_max_size=_DESKTOP_ATTACHMENT_WS_MAX_BYTES,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This changes the remote Desktop/backend wire capability, but tui_gateway/server.py still advertises contract v3 and apps/desktop/src/store/updates.ts accepts v3. Please bump both to v4 (and test it), or add a pre-v4 fallback; otherwise a new Desktop can send a >16 MiB frame to an old v3 backend that still uses Uvicorn's default cap.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 18, 2026
@diffen77

Copy link
Copy Markdown
Author

Closeout review found this PR is not merge-safe yet. The 16 MiB preview / 256 MiB attachment-reader split and 384 MiB WebSocket cap pass focused local gates, but the required backend-contract bump collides with the independent v5 semantics in #69508. Contract levels are cumulative, so this branch cannot truthfully claim v5 or v6 until #69508 lands and origin/main is merged here. I have therefore not pushed the local integration/contract patch. Required sequence: land #69508; refresh this branch from resulting main; assign the next aggregate contract; add exact upper-bound rejection coverage; rerun Python/Desktop gates and independent review. Current upstream head remains 5ac55ec.

@OutThisLife

Copy link
Copy Markdown
Contributor

Superseded by #73710.

Rebased onto current main after #73221 reshaped the Settings-configurable preview reader, kept the dedicated 256 MiB attach IPC + 384 MiB ws_max_size, and bumped the Desktop backend contract to v5 so older remotes get the skew warning instead of a silent disconnect.

You're credited via Co-authored-by. Thanks for the attach/WS split and the focused tests.

OutThisLife added a commit that referenced this pull request Jul 29, 2026
…tach

fix(desktop): allow large remote attachments (supersedes #66555)
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…ge-remote-attach

fix(desktop): allow large remote attachments (supersedes NousResearch#66555)
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
…ge-remote-attach

fix(desktop): allow large remote attachments (supersedes NousResearch#66555)
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…ge-remote-attach

fix(desktop): allow large remote attachments (supersedes NousResearch#66555)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants