Skip to content

fix(agent): stabilize command working directories - #2623

Merged
bobleer merged 1 commit into
GCWing:1.0.0-explorefrom
bobleer:bob/fix-agent-command-workdir-explore
Aug 29, 2026
Merged

fix(agent): stabilize command working directories#2623
bobleer merged 1 commit into
GCWing:1.0.0-explorefrom
bobleer:bob/fix-agent-command-workdir-explore

Conversation

@bobleer

@bobleer bobleer commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Allow ExecCommand workdir values to be workspace-relative while preserving absolute-path compatibility.
  • Keep remote paths POSIX-normalized and contained within the opened SSH workspace.
  • Remove duplicate local and SFTP directory preflights so directory existence is decided by the actual terminal spawn or SSH cd on the execution channel.
  • Apply the same no-SFTP-preflight rule to the legacy Bash tool and add regression coverage.

Type and Areas

Type: regression fix

Areas: Rust core, Agent tools, remote SSH workspace execution

Motivation / Impact

Remote ExecCommand previously called SFTP is_dir before every command, including commands using the default workspace root. A healthy SSH command channel could therefore be rejected whenever the separate file channel was unavailable or transiently unhealthy. Local execution also performed a duplicate preflight before the terminal runtime check. Relative working directories were rejected by ExecCommand even though other workspace tools supported them.

Commands now accept stable workspace-relative paths, retain existing absolute inputs, and validate directory existence in the same channel that performs execution. Remote commands still refuse paths outside the current workspace and never fall back to local execution.

Verification

  • pnpm run fmt:rs
  • cargo test --locked -p bitfun-core --no-default-features --features agent-runtime,opencode-plugin-host --lib agentic::tools::implementations::exec_command::command::tests — 17 passed
  • cargo test --locked -p bitfun-core --no-default-features --features agent-runtime,opencode-plugin-host --lib agentic::tools::implementations::bash_tool::tests — 20 passed
  • cargo test --locked -p bitfun-core --no-default-features --features agent-runtime,opencode-plugin-host --lib workdir — 5 passed
  • cargo check -p bitfun-core --no-default-features --features agent-runtime,git
  • cargo test --locked -p bitfun-agent-tools --no-default-features — 121 passed across unit and contract targets
  • cargo check -p terminal-core
  • cargo test -p bitfun-services-integrations --no-default-features --features remote-ssh --lib remote_ssh::workspace_services::tests::remote_workspace_command_preserves_legacy_cd_wrapping_and_escaping — 1 passed
  • git diff --check

Reviewer Notes

  • Target branch: 1.0.0-explore.
  • Remote workspace behavior was exercised with a remote ToolUseContext that intentionally has no filesystem or SFTP service, plus POSIX normalization, default-root, absolute compatibility, and relative/absolute escape rejection. No live SSH host was used.
  • Remote Control, Peer Device Mode, and Detached Dispatch are unchanged.
  • No persisted shape, wire schema, dependency, or migration changes.
  • The narrower agent-runtime-only Core check is currently blocked by the existing worktree_tool versus git feature gate; the actual minimum compilable agent-runtime,git closure passes.
  • AI-assisted change; testing level: fully tested for the affected contracts.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Resolve relative ExecCommand workdirs from the active workspace, keep remote paths POSIX and contained, and defer directory existence checks to the actual local or SSH execution channel. Remove the legacy Bash SFTP preflight and cover local, remote, compatibility, and escape cases.
@bobleer
bobleer force-pushed the bob/fix-agent-command-workdir-explore branch from a87cd6a to 0d20114 Compare August 29, 2026 02:51
@bobleer
bobleer merged commit e41bcd1 into GCWing:1.0.0-explore Aug 29, 2026
12 checks passed
@bobleer
bobleer deleted the bob/fix-agent-command-workdir-explore branch August 29, 2026 03:16
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.

1 participant