Skip to content

Revert "feat(tools): add exec tool enhancement with background execution and PTY support"#1865

Merged
yinwm merged 1 commit intomainfrom
revert-1752-feat/exec-tool-enhancement
Mar 21, 2026
Merged

Revert "feat(tools): add exec tool enhancement with background execution and PTY support"#1865
yinwm merged 1 commit intomainfrom
revert-1752-feat/exec-tool-enhancement

Conversation

@yinwm
Copy link
Copy Markdown
Collaborator

@yinwm yinwm commented Mar 21, 2026

Reverts #1752

Copilot AI review requested due to automatic review settings March 21, 2026 16:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reverts the previously introduced exec-tool enhancements (background execution, PTY support, and session management), restoring a simpler synchronous exec interface and removing the associated session infrastructure and dependencies.

Changes:

  • Simplifies exec tool API back to synchronous execution with only command (+ optional working_dir) arguments.
  • Removes session management (types, manager, OS-specific process-group helpers) and associated tests.
  • Updates agent/tool tests and module dependencies to reflect the reverted exec behavior (drops direct creack/pty usage).

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/tools/types.go Removes ExecRequest/ExecResponse types tied to session/PTY features.
pkg/tools/shell.go Reverts exec tool to synchronous-only execution; removes action/session/PTY logic and schema.
pkg/tools/shell_test.go Updates tests to the simplified exec API; removes background/PTY/session test coverage.
pkg/tools/shell_timeout_unix_test.go Updates timeout test invocation to omit action.
pkg/tools/session.go Deletes session manager + session types introduced for background/PTY support.
pkg/tools/session_test.go Deletes session manager unit tests.
pkg/tools/session_process_unix.go Deletes session-era process-group helper.
pkg/tools/session_process_windows.go Deletes session-era process-group helper.
pkg/agent/instance_test.go Updates exec invocation to use working_dir/no action.
go.mod Removes direct dependency on github.com/creack/pty.
go.sum Updates sums consistent with dropping direct PTY usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 610 to 612
for _, cmd := range commands {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
result := tool.Execute(ctx, map[string]any{"action": "run", "command": cmd})
cancel()
result := tool.Execute(context.Background(), map[string]any{"command": cmd})
if result.IsError && strings.Contains(result.ForLLM, "path outside working dir") {
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestShellTool_URLsNotBlocked executes real network-capable commands (curl/wget/git clone). This hunk removed the per-call context.WithTimeout, so these tests can now hang or run up to the tool’s default timeout (60s) if the binaries exist and network stalls. Consider restoring a short context timeout here (as before) and/or change the test commands to non-network no-op commands that still contain URLs (e.g., echo/printf with URL arguments) so the test only validates the guard logic.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@huaaudio huaaudio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we still need to get a workaround for the cross-platform CGo issue and exec stability.

@yinwm yinwm merged commit 3cd674e into main Mar 21, 2026
8 checks passed
@yinwm yinwm deleted the revert-1752-feat/exec-tool-enhancement branch March 25, 2026 16:38
andressg79 pushed a commit to andressg79/picoclaw that referenced this pull request Mar 30, 2026
…-enhancement

Revert "feat(tools): add exec tool enhancement with background execution and PTY support"
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.

3 participants