Skip to content

fix: pass agent messages through unchanged, accept only the window's own origin, and expand a tilde in the data folder - #16

Merged
nodemode-ai merged 6 commits into
mainfrom
fix/review-2026-11-28
Nov 29, 2026
Merged

nodemode-ai merged 6 commits into
mainfrom
fix/review-2026-11-28

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • On Windows an npm .cmd launcher's target (its .exe, or node with its script) is started directly instead of through the command interpreter. Any other .cmd or .bat goes through cmd /v:off /c, and text the interpreter would change is refused: control characters, a percent sign, and & | < > ^ ( ) wherever the interpreter's quote rules would act on them. A program path ending in dots or spaces after .cmd or .bat is treated the same way. agent_lookup.check reports such a program as found but not starting.
  • Stopping Chat on Windows now ends the whole process tree.
  • The window origins no longer include tauri://localhost and http://tauri.localhost. The desktop window loads from the engine's own address, and every Tauri web view shares those two origins.
  • The Rust engine's data folder expands a leading ~ or ~/ in FORMFABRIC_DATA_DIR under the home folder, as the service does, so the library sits next to the garments. Extra slashes after the tilde stay under the home folder, and ~\ is expanded on Windows only.
  • Tests: backend/tests/test_agent_start.py (new), plus updated origin tests in test_core_config.py, test_core_guards.py and test_mcp_protocol.py, and Rust tests in library_cmds/store.rs.
  • On Windows, a plain .cmd or .bat agent launcher (not an npm launcher, which is started directly without the command interpreter) now refuses any argument holding a control character or one of & | < > ^ ( ) ! % ", quoted or not, because a batch file reads its arguments again through %*. The message points to the program's own path, or to standard input or a file for long text.
  • Added tests for the argv builder covering both the direct npm-launcher path and the strict command interpreter refusal. They run on any OS.

Tests

  • Each fix has a test that fails on the previous code where practical.
  • The repo CI commands were run locally on macOS. Every failure seen locally also fails on main in the same environment (missing local tools or platform-specific tests); none is introduced here.
  • Please rely on this PR's CI run for Linux and Windows.

For the owner

  • A few related items need an owner decision; they are listed separately, not here.

How to ship

  • Independent of other repos; merge in any order. No version bump; release as usual.

The desktop shell loads the window from the engine's own address, so the
origins every Tauri web view shares are no longer let through.
On Windows an npm launcher's target is started directly instead of through
the command interpreter, and text that interpreter would change is refused
when there is no other way. On macOS and Linux both launchers quote for the
person's own login shell, fish included. Stopping Chat on Windows ends the
whole process tree.
Windows drops trailing dots and spaces when it opens a file, so such a path is started the same way as the plain .cmd or .bat name.
Extra slashes after the tilde stay under the home folder, and a tilde followed by a backslash is expanded on Windows only.
…uments

A batch file reads its arguments again through %*, so quoting does not
protect them. When an agent program is a plain .cmd or .bat (not an npm
launcher that can be started directly), any word holding a control
character or one of & | < > ^ ( ) ! % " is now refused, quoted or not,
and the message points to standard input or a file for long text.
@gbarnai
gbarnai requested a review from nodemode-ai as a code owner November 29, 2026 18:18
@nodemode-ai
nodemode-ai merged commit bc82ec2 into main Nov 29, 2026
7 checks passed
@nodemode-ai
nodemode-ai deleted the fix/review-2026-11-28 branch November 29, 2026 18:56
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.

2 participants