Repository navigation
fix(agents): window key for agent controls, approvals for changes that cannot be undone, safer Windows command script launches, dev origins only in dev mode - #11
Merged
Conversation
Approving a pending agent call, reading the bridge queue, posting window tool results, changing agent policies, rotating the token, stopping agent work and writing settings now require the window key, as the terminal routes already do. The window sends the key on every engine call, so its behaviour is unchanged; the bridge goodbye beacon stays open because a beacon cannot carry a header. Checked with python -m pytest (501 passed).
…s or replace a project folders_delete, tags_delete and characters_delete cannot be undone, and projects_update with a doc replaces the whole document with no earlier version kept. They now ask the owner whatever the client policy, as projects_delete and library_delete already do. Renames and cover changes still follow the policy. Tool descriptions, the skill references and agents/manifest.json (./formcraft agents sync) say so. Checked with python -m pytest (518 passed) and check_skills.py.
…ough cmd.exe On Windows a Claude Code installed as a .cmd or .bat script is started through the command interpreter, which reads its own command line and treats quotes, &, |, < > and % in it specially. The prompt from the ask box is no longer put on that command line; it is typed into the new tab once it starts, as a prompt for a tab already running is. A real program (.exe) and macOS and Linux still take the prompt as an argument. The shared agent finder is unchanged. Checked with python -m pytest (524 passed).
config.window_origins() lists localhost and 127.0.0.1 on the Vite dev and preview ports only when FORMCRAFT_DEV is 1. A release engine admits its own origin and the desktop window origins, so another local server that happens to use those ports is refused. LocalGuard accepts the origin list as a function and reads it per request, so the switch is honoured however the engine was started. The two dock tests that model the Vite page now run in dev mode, as that page does. Checked with python -m pytest (529 passed).
…hanges in the engine log
approval_key gave every projects_update the same key, so a remembered yes for a rename or a cover change also covered a later call that replaces the whole document. A projects_update with a doc now has its own key, projects_update:doc, and that answer is never stored or honoured, like an unpriced generate. The approval item says rememberable false, and the window hides the remember box for it. Checked with python -m pytest (556 passed), npm run typecheck and npm test (1186 passed).
… read itself When an agent program is a .cmd or .bat file it starts through cmd.exe /c, which reads its own command line. Every word on that line must now be text with no control characters and no % " & | < > ^ or !, and parentheses pass only inside a word that gets quoted. Otherwise the tab is not started and the window shows why. The Claude Code tab, the other agent tabs and the sign-in check all go through this. A real program and macOS and Linux are unchanged. The engine log records both changes. Checked with python -m pytest (556 passed).
…reter character otherwise An agent program found as an npm-style .cmd shim is now resolved to the node script or program it wraps and started from an argv list without cmd.exe, for the Claude Code tab, the other agent tabs, the version check and the sign-in check. The resolved tab takes the prompt on its command line again. When a shim does not resolve and cmd.exe is still used, any word, including the program path, holding & | < > ^ ( ) ! % " or a control character is refused whether or not it holds a space, because quoting does not protect it there. The earlier exception for parentheses in a quoted word is removed. The refusal says to pass long text through standard input or a file. The version check of such a script no longer goes through the shared finder's cmd.exe start. Checked with python -m pytest (579 passed), npm run typecheck, npm run build, npm test (1186 passed), the engine self-check, setup/versions.py and check_skills.py.
Brings the agents hardening branch up to main 0.11.0 and resolves the six conflicts by hand. - routers/agents.py: the bridge poll keeps the window key from this branch and takes main's project query; imports carry both Depends and Literal. - services/agents.py: main's risk classes replace the projects_update:doc key, NEVER_REMEMBERED and rememberable. A projects_update with a doc is already risky through mcp_tools (this branch), so it gets a risk: key that _keepable refuses: it is never stored, never honoured, and no session, project or allow grant covers it. A rename or cover change stays a normal key. - approvals.ts and api-agents.ts: the window reads main's keepable, which the engine now sends as false for a document replacement. - test_services_agents_replace_doc.py: the two assertions that read the approval item read keepable instead of rememberable. - backend and frontend HASHOUT_LOG: entries kept in date order, plus one entry each for this merge. Checked: python -m pytest (579 passed), npm run typecheck, npm test (1186 passed), npm run build, formcraft_engine.py --selfcheck, setup/versions.py (10 sites at 0.11.0), check_skills.py and setup/agents.py sync --check. Not run: the Windows and desktop jobs.
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.
Summary
Tests
For the owner
How to ship