Commit Graph

12 Commits

Author SHA1 Message Date
metaphorics 29a72eb939 test: fix Windows portability of bash ACP, warp capabilities, and logger closure tests 2026-08-05 11:43:19 +00:00
can1357 01e6ba9217 fix(bash): bound poll-tick output read and terminal release awaits 2026-07-23 17:41:55 +02:00
can1357 c507a590bf Merge PR #4270: fix(bash): bound ACP terminal lifecycle with abort/timeout (@metaphorics)
# Conflicts:
#	packages/coding-agent/src/tools/bash.ts
#	packages/coding-agent/test/bash-acp-terminal.test.ts
2026-07-23 17:41:55 +02:00
roboomp 157c1d1c7d fix(acp): reuse resolved bash shell for terminal/create wrap
Addresses codex review on #4335: the previous wrap dropped to cmd.exe on Windows, which broke bash tool semantics for $VAR, $(...), source, and POSIX quoting even when the local executor would have resolved Git Bash / bash.exe. The wrap now takes the resolved ShellConfig (shell binary + login/-c args + optional prefix) from settings.getShellConfig() and reuses it for the ACP terminal/create shape, so the ACP path matches the local path on both platforms. Tests updated to stub getShellConfig and assert the resolved-shell shape deterministically.
2026-07-02 17:59:56 +00:00
roboomp 7b52f64680 fix(acp): wrap bash tool shell line in /bin/sh -c for terminal/create
The bash tool routes commands through the ACP client's terminal/create when the client advertises the terminal capability. It was passing the full shell line as the ACP command field with no args, which relies on the client interpreting command through a shell. Per the ACP protocol docs, command is the executable and args is its argv tail; a spec-conformant client spawns them directly (no implicit shell), so any bash line with a space, pipe, &&, redirect, or $(...) failed with ENOENT and the agent silently degraded to read-only tools.

The bash tool now wraps the shell line before the createTerminal call: { command: /bin/sh, args: [-c, line] } on POSIX and { command: cmd.exe, args: [/d, /s, /c, line] } on Windows. /d/s/c matches Node's spawn({ shell: true }) convention (/s preserves the whole shell line as one argv element on the receiving end). process.platform on the agent side proxies the client's platform, which matches the near-universal ACP shape of an editor spawning omp as a co-hosted subprocess.

Fixes #4333
2026-07-02 17:53:58 +00:00
metaphorics 9bc94b7b26 fix: address cubic review feedback (iteration 5)
Cancel the ACP terminal timeout timer on completion: the hoisted Bun.sleep(timeoutMs) left a live ref'd timer for the full command timeout after every fast command, accumulating timers and delaying process shutdown in SDK/headless use. Switched to a cleared setTimeout, and rewrote the timeout regression test against real time instead of mocking Bun.sleep (the mock coupled the test to timer implementation and starved the event loop).
2026-07-02 19:08:49 +09:00
metaphorics 4eb90bf874 fix(bash): bound ACP terminal lifecycle with abort/timeout
ACP terminal RPCs in `BashTool.execute` were awaited without abort or timeout guards, so a hung `createTerminal`, `kill`, or `currentOutput` call could keep the tool alive past its configured timeout. The ACP polling loop also recreated `exitPromise`/`abortedP` `.then()` closures on every 250 ms tick, leaking memory during long-running commands. This change moves abort/timeout setup before `createTerminal`, races it against the timeout/abort signals, hoists the exit/abort racers outside the loop, tracks `lastPolledOutput`, and bounds kill and final-output waits with fallbacks; late-resolving `createTerminal` handles are killed and released. Verified with `bun run check:types` and `bun test test/bash-acp-terminal.test.ts` in `packages/coding-agent` (6 pass, 0 fail).

Closes #4241
2026-07-02 17:29:19 +09:00
can1357 ae1650d689 refactor: renamed search and find tools to grep and glob
- Renamed the `find` and `search` tools to `glob` and `grep` respectively across the codebase to improve command clarity.
- Implemented full-stack support for the renamed tools, including CLI arguments, system prompts, SDK exports, and tool registration.
- Added automated migration logic in `settings` to transform legacy `find` and `search` configuration keys to their new equivalents.
- Updated the `collab-web` renderer registry to ensure backwards compatibility with legacy tool outputs.
2026-06-27 00:57:55 +02:00
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00
can1357 90b134ca4c test: replaced real timers and sleeps with deterministic test hooks
- Added `providerRetryWait` and `retryWait` hooks to stream/usage options so tests bypass real scheduler delays.
- Parameterized GitHub Copilot poll intervals and Copilot model retry base delay for fast test execution.
- Replaced `Bun.sleep`/`setTimeout` polling loops with `AbortSignal` event listeners in agent session tests.
- Consolidated auth-gateway E2E helpers into a shared `test/helpers` module, eliminating duplicated `checkGatewayAvailable` implementations.
- Migrated credential-disabled tests from SQLite-backed stores to an in-memory store, removing temp-dir lifecycle overhead.
2026-05-17 04:02:09 +02:00
Ogrodev 1a44cd2e36 Fix ACP review follow-ups 2026-05-13 06:00:45 +02:00
Ogrodev d8e38bcc62 test(acp): add comprehensive ACP and edit tool test suites
- AcpAgent integration tests: initialize→run→notify cycle, notification structure, message-ID continuity
- ACP built-in slash command unit tests across all command handlers via fake runtime
- ACP event mapper unit tests: text chunks, thinking, tool calls/results, errors → SessionNotification
- ACP initialize conformance: terminal auth capability negotiation, agentInfo/agentCapabilities contract
- stdout hygiene smoke test: first bytes on omp acp stdout must be a valid JSON-RPC frame
- AgentSession permission gate: allow-once, reject-once, allow-always, abort-during-pending, non-gated tools
- BashTool ACP terminal routing: bridge dispatch vs local PTY fallback
- EditTool diff content propagation: patch, replace, and multi-file aggregation paths
- ReadTool and WriteTool ACP filesystem permission tests
- Shared ACP schema test helper
2026-05-13 06:00:45 +02:00