Repository navigation
Backlog
Backlog
Copy link
Labels
Milestone
Description
Goal
The AI knows what the server allows: on a server without command execution it is told it can only read and write files and gets no command tool; on a server without SFTP it gets no file tools. MCP clients get a clear refusal instead of a hang.
Context
- Tool list per session:
system_prompt::session_action_schemas(crates/app-logic/src/system_prompt.rs:355), called atsession_builder.rs:264, stored inSessionContext.available_actions(:431). Unknown tool calls are already rejected (crates/app-logic/src/orchestration/chat_turn.rs:640-645). base_prompt(system_prompt.rs:313-350) is static per language (prompt cache) and tells the AI to usesuggest_command. The session system context is built inbuild_session_system_context(session_builder.rs:96-162): base, allow-rules section, notes, extension section.- MCP:
McpBackend::propose_action(crates/app-shell/src/mcp_backend.rs:165) and the read/write handlers; tools are static incrates/mcp-server/src/tool_server.rs. WriteRemoteFilefalls back tosudoover exec (remote_files.rs:386-451).- Capabilities come from the blocking issue (
SessionCapabilities).
Requirements
exec = false→suggest_commandis removed from the session's tool list; a section after the allow-rules section says (all prompt languages): "This server does not allow running commands. You can only read and write files with read_remote_file and write_remote_file." The static base prompt stays unchanged.sftp = false→read_remote_fileandwrite_remote_fileare removed; the section says: "This server offers no file access (SFTP). You can only propose commands."- Both capabilities available → tool list and prompt byte-identical to today.
exec = false→ the sudo fallback ofWriteRemoteFileis not attempted; the write fails with the original SFTP error.- A proposed action of a removed kind (chat or MCP) ends as
ActionOutcome::Failedwith a message naming the missing capability, before filter evaluation and before any confirmation dialog. - MCP
propose_commandon such a session returns that failure;read_remote_file/write_remote_filelikewise whensftp = false.
Acceptance Criteria
- Session with
exec=false: tool list withoutsuggest_command, prompt contains the files-only section (test per prompt language). - Session with
sftp=false: tool list without the file tools, prompt contains the commands-only section. - Session with all capabilities: tool list and system context identical to before (snapshot test).
- Chat: a
suggest_commandon anexec=falsesession fails with the capability message; no confirmation dialog, no filter call (test). - MCP:
propose_commandon anexec=falsesession returns the failure (test); file tools onsftp=falselikewise. -
WriteRemoteFilewithexec=falseand a permission error does not try sudo (test). - Relevant automated tests pass
Technical Notes
- Security-critical: the action path (
handle_action_proposed,evaluate_action,crates/app-logic/src/orchestration/action_exec/propose.rs:42,922) – the capability check is an early refusal before the filter; it never changes the result ofFilterEngine::evaluate()and never lets an action skip approval. MCP actions still always need confirmation (invariant test(app-logic): descriptive event-wait assertions in chat_turn tests #3). - Keep the static base prompt unchanged (cache).
Files: crates/app-logic/src/system_prompt.rs, crates/app-logic/src/connect/session_builder.rs, crates/app-logic/src/orchestration/action_exec/propose.rs, crates/app-logic/src/orchestration/remote_files.rs, crates/app-shell/src/mcp_backend.rs, docs/specs/0020-sftp-file-transfer.md, docs/specs/0028-mcp-server-integration.md, changelog.d/
Spec impact: update 0020
Open questions
- Capability message text for refused actions: reuse an existing error code family (
ACTION_*) or a newACTION_CAPABILITY_MISSING. Recommendation: new code, documented in spec 0028.
Related Work
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
P2 - Normal
Activity