fix(gateway): restore lost file.attach RPC + contract 2 (clears "Backend out of date")#142
Merged
Merged
Conversation
The desktop shows a persistent "Backend out of date" toast and "Update Hermes" does nothing: the desktop requires backend contract 2 (REQUIRED_BACKEND_CONTRACT, for the file.attach RPC) but the backend reports 1, so the warning can never clear and the update flow no-ops (the source is already current; the requirement was for a capability the backend lost). Root cause: commit dbbd1d4 ("remote-gateway file attachments via file.attach") bumped BOTH the desktop requirement (->2) and the backend contract (->2) and added the file.attach handler. The 85-commit upstream merge that is currently blocked (mesh task hermes-fork-resolve-85-commit-upstream-sync-25-file) clobbered the BACKEND half while the desktop half (REQUIRED=2, FileAttachResponse type, the client tests) survived — a split-brain that orphaned the contract demand. This restores the backend half so the contract is honest again: - tui_gateway/server.py: re-add the file.attach RPC + its helpers (_format_ref_value, _attachment_ref_path, _desktop_attachment_dir, _sanitize_attachment_name, _unique_attachment_path, _resolve_gateway_attachment_path) and bump DESKTOP_BACKEND_CONTRACT 1->2. Restored verbatim from dbbd1d4; the file.attach symbols were confirmed absent on main (no duplication), and its cli.py deps (_detect_file_drop, _resolve_attachment_path, _split_path_input) are present. - tests/test_tui_gateway_server.py: restore the 5 file.attach backend tests (workspace upload, gateway-visible copy-in, in-workspace no-copy, unresolvable error, ref quoting). A restarted gateway now reports contract 2, so the toast clears. The CLIENT upload path (use-prompt-actions.ts) was also reverted by the same clobber; restoring it is a larger merge against current code (tracked separately) and is not required to clear the toast — the backend capability is what the contract advertises. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🔎 Lint report:
|
OmarB97
added a commit
that referenced
this pull request
Jun 10, 2026
fix(desktop): restore file.attach client upload path (Phase 2b companion to #142)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The desktop shows a persistent "Backend out of date" toast, and clicking "Update Hermes" does nothing. The desktop requires backend contract 2 (
REQUIRED_BACKEND_CONTRACTinstore/updates.ts, added for thefile.attachRPC) but the backend reportsDESKTOP_BACKEND_CONTRACT = 1— soreportBackendContractfires the warning on every session and it can never clear. "Update Hermes" no-ops because the source checkout is already current; the requirement is for a capability the backend lost.Root cause: commit
dbbd1d4d0("remote-gateway file attachments via file.attach") bumped both the desktop requirement (→2) and the backend contract (→2) and added thefile.attachhandler. The currently-blocked 85-commit upstream merge (mesh taskhermes-fork-resolve-85-commit-upstream-sync-25-file) clobbered the backend half while the desktop half (REQUIRED=2, theFileAttachResponsetype, the client tests) survived — a split-brain that orphaned the contract demand.What changed
tui_gateway/server.py: re-add thefile.attachRPC handler + its six helpers (_format_ref_value,_attachment_ref_path,_desktop_attachment_dir,_sanitize_attachment_name,_unique_attachment_path,_resolve_gateway_attachment_path) and bumpDESKTOP_BACKEND_CONTRACT1→2. Restored verbatim fromdbbd1d4d0; thefile.attachsymbols were confirmed absent on main (no duplication) and itscli.pydependencies (_detect_file_drop,_resolve_attachment_path,_split_path_input) are present.tests/test_tui_gateway_server.py: restore the 5file.attachbackend tests (workspace upload, gateway-visible copy-in, in-workspace no-copy, unresolvable error, ref quoting).A restarted gateway now reports contract 2, so the toast clears and the backend genuinely supports the RPC the desktop advertises.
How to review
server.py— the appendedfile.attachblock (sibling to the other attach handlers) and the one-line contract bump.@method("file.attach")did not exist on main.Evidence
test_file_attach_uploads_remote_file_into_session_workspace(+ 4 siblings) exercise the restored handler end-to-end against a temp workspace.Verification
tests/test_tui_gateway_server.py -k file_attach— 5 passed;-k "attach or contract or detect_drop"— 14 passed (no neighbor regressions).uvx ruff checkclean.py_compileclean.Risks / gaps
use-prompt-actions.ts) was reverted by the same clobber — restoring it is a larger merge against current code (it now coexists with the Phase 2bsender_devicelogic) and is tracked separately inhermes-restore-file-attach-client-20260610. It is NOT required to clear the toast: the contract advertises backend capability, which is now true and tested. The 3 pre-existinguse-prompt-actionsclient test failures remain until that follow-up (they fail identically on clean main).hermes-fork-resolve-85-commit-upstream-sync-25-file); other reverted halves may surface similarly.Collaborators