Commit Graph

4848 Commits

Author SHA1 Message Date
roboomp aeea2c8a8a fix(coding-agent): preserved noninteractive cross-project resume failures
Separated the fork prompt result into accepted, declined, and unavailable states.
Interactive declines now return cleanly through runRootCommand, while non-TTY
invocations continue to fail with a diagnostic instead of silently exiting 0.

Updated regression coverage for both branches.

Fixes #1668
2026-06-01 22:36:10 +00:00
roboomp cea19b6ebf fix(coding-agent): exited cleanly when declining cross-project resume fork
createSessionManager threw `Session "X" is in another project (Y).` when
the user answered "n" to the fork prompt, and runRootCommand never caught
it. The throw bubbled up as an Uncaught Exception with a stack trace.

Return undefined from the decline branch instead, and treat
`typeof parsed.resume === "string" && !sessionManager` in runRootCommand
as a user cancellation: print a dimmed "Resume cancelled" message and
return cleanly (exit 0), mirroring how the picker UI handles
"No session selected".

Fixes #1668
2026-06-01 22:31:26 +00:00
can1357 96fd4c0f4f test(coding-agent): removed warm-cache refresh performance test case
- Removed the status-line context cache test that benchmarked warm-cache refreshes on a 200-message session.
2026-06-01 20:42:22 +02:00
can1357 7a8c879f9a test(bash-executor): replaced fixed sleep timers with event-driven sync
- Replaced `Bun.sleep(50)` with `Promise.withResolvers` resolved on first chunk to avoid races.
- Used a filesystem marker file to detect shell startup before aborting in persistent-session test.
- Prevents flaky failures where aborts arrived before shell setup completed.
2026-06-01 20:33:43 +02:00
can1357 47690d6495 Merge remote-tracking branch 'origin/farm/f765e67b/esc-keeps-autocomplete-dismissal' 2026-06-01 20:33:08 +02:00
can1357 503d29f408 fix(eval): resolved TDZ crash by splitting eval renderer into eval-render.ts
- Extracted TUI rendering from `eval.ts` into a dependency-light `eval-render.ts` to break the circular initialization chain.
- `renderers.ts` now imports `evalToolRenderer` from `eval-render` directly, avoiding re-entry into the root barrel while `eval.ts` is still initializing.
- `eval.ts` re-exports `evalToolRenderer` and `EVAL_DEFAULT_PREVIEW_LINES` for backward compatibility.
- Increased first-event timeout test budget from 50ms to 5000ms to prevent CI scheduler jitter from tripping the watchdog on success cases.
2026-06-01 20:31:46 +02:00
can1357 c069136eca refactor(exec): extracted eval-backends module and improved shell quarantine
- Moved EvalBackendsAllowance and related functions to a dedicated eval-backends.ts module.
- Replaced ad-hoc brokenShellSessions tracking with a quarantineShellSession helper that also awaits the abort cleanup promise.
- Applied quarantine on timeout and cancellation paths, not just errors.
2026-06-01 20:15:21 +02:00
roboomp 27f4965e00 fix(coding-agent): stop ESC from aborting agent run while @ autocomplete is open
When the autocomplete popup is visible, ESC unconditionally falls through
to the editor base class so it can dismiss the popup. Only an ESC with no
popup visible reaches onEscape and routes to the global interrupt handler.

Removed the shouldBypassAutocompleteOnEscape callback that paved over the
popup-dismissal path whenever the agent was busy (streaming, bash, /btw,
auto-compaction, etc.) — that is precisely the moment the user is most
likely to hit ESC while the popup is open, and dismissing-then-aborting in
one keystroke is a footgun, not a feature. Two-press semantics now match
the standard TUI/IDE pattern: first ESC closes the popup, second ESC
aborts.

Tests cover both branches in custom-editor-keybindings.test.ts and the
input-controller escape suite no longer asserts the dead callback.

Fixes #1655
2026-06-01 17:26:10 +00:00
can1357 cfea72f0f2 chore: bump version to 15.7.6 2026-06-01 19:24:27 +02:00
can1357 fbdc064186 feat(lsp): added session-scoped LSP diagnostics deduplication
- Added `DiagnosticsLedger` to track diagnostics already surfaced per file, suppressing repeats within a session.
- Wired dedup into both edit and write tools via a `transformDiagnostics` hook on the writethrough pipeline.
- Added `lsp.diagnosticsDeduplicate` setting (default: true) to control the behavior.
2026-06-01 18:04:05 +02:00
Can Bölük 3106cf6240 Merge pull request #1598 from ForeverYoungPp/fix/acp-mcp-tool-activation
fix(coding-agent/acp): MCP tools registered but never activated for ACP sessions
2026-06-01 18:30:20 +03:00
Can Bölük a0836b6687 Fix Claude Code command discovery and eval timeout behavior
Fixed the Claude Code slash command discovery to load subdirectory commands recursively and added namespace aliases for colon-namespaced workflows. Updated the timeout behavior for the eval tool to better handle cell execution without premature termination.
2026-06-01 17:24:09 +02:00
Can Bölük be022d8a89 Merge branch 'main' into farm/ad674fba/fix-claude-subdir-commands 2026-06-01 18:23:10 +03:00
Can Bölük 112602cda3 Merge branch 'main' into farm/a22ef9df/raise-discovered-model-max-tokens 2026-06-01 18:22:11 +03:00
Can Bölük b2175bf581 Merge pull request #1555 from can1357/farm/aeb6ba9d/make-indicator-glyphs-and-colorizing-con
feat(theme): make spinner frames overridable per custom theme
2026-06-01 18:21:11 +03:00
Can Bölük 164ecbe2e0 Merge pull request #1619 from can1357/farm/f5ca35c4/prevent-overlimit-prompts
fix(agent): compact before oversized prompts
2026-06-01 18:19:27 +03:00
can1357 dbd9489010 refactor(eval): changed timeout from inactivity to wall-clock budget
- Only bridge heartbeats (`agent()`/`llm()`) now re-arm the watchdog; compute, stdout, `log()`/`phase()`, and ordinary tool calls count against the budget.
- Emitted an immediate heartbeat at bridge call start to avoid early abort near budget edge.
- Removed `idle` flag and "of inactivity" suffix from timeout annotation strings.
- Updated docs, prompts, and comments to reflect the new wall-clock semantics.
2026-06-01 17:17:00 +02:00
Can Bölük 52a29e5df5 Merge branch 'main' into feat/assistant-thinking-renderer 2026-06-01 18:16:42 +03:00
Can Bölük 890d63fdb1 Merge branch 'main' into fix-ask-option-descriptions 2026-06-01 18:14:42 +03:00
can1357 e18e4ada71 fix(eval): keep idle watchdog armed during in-flight agent()/llm() calls
The per-cell `timeout` is an inactivity budget that only re-arms on status
events, but host-side bridge calls can run long stretches with no
intermediate status (a subagent's time-to-first-token on a reasoning
model, a long quiet nested tool, or an entire oneshot llm() request).
The watchdog mistook that for a stall and aborted working subagents
mid-flight.

Pump a lightweight heartbeat while a bridge call awaits, re-arming the
watchdog through the existing emitStatus -> onStatus channel. The
heartbeat is a pure keepalive: forwarded to bump the timer but never
stored or rendered, so a genuinely stalled cell is still interrupted
once the call settles.

- eval/heartbeat.ts: withBridgeHeartbeat() + EVAL_HEARTBEAT_OP
- agent-bridge/llm-bridge: wrap runSubprocess / completeSimple
- js+py executors: forward heartbeat to onStatus, drop from displayOutputs
- tools/eval.ts: bump on heartbeat, skip persist/render
2026-06-01 16:38:32 +02:00
can1357 f9d094de60 perf(coding-agent): aligned spinner and shimmer animations to the TUI 60fps render interval
- Tool execution now renders every 16ms and advances spinner glyphs only every 80ms using a tracked last-advance timestamp.
- Output block shimmer ticks were reduced to 16ms so border-frame updates align with the 60fps cadence for smoother animation.
2026-06-01 16:07:54 +02:00
can1357 da58949320 chore: bump version to 15.7.5 2026-06-01 15:04:12 +02:00
can1357 ff2de07e78 test(coding-agent): added workspaceTree fixture to system prompt tests
- Introduced helper `createEmptyWorkspaceTree` to reduce duplication.
- Populated missing `workspaceTree` field in test contexts for `buildSystemPrompt`.
2026-06-01 14:43:12 +02:00
can1357 e78b66fc6f test(coding-agent): updated fixtures with missing ui and context mocks
- Added `setEagerNativeScrollbackRebuild` mock to `ui` objects in test fixtures.
- Added `pendingTools` map to context fixtures missing it.
2026-06-01 14:42:58 +02:00
can1357 0c6c6fb92f Merge remote-tracking branch 'origin/farm/5636bafd/dedupe-streaming-assistant-tail' 2026-06-01 14:39:34 +02:00
can1357 77d417f706 Merge remote-tracking branch 'origin/farm/b84f19f4/mcp-reconnect-backoff' 2026-06-01 14:38:37 +02:00
can1357 f1237131bd Merge remote-tracking branch 'origin/farm/59c71bcd/isolate-tiny-model-process' 2026-06-01 14:37:59 +02:00
can1357 b37c20cb10 Merge remote-tracking branch 'origin/farm/55028c01/local-plan-md-unreachable-macos' 2026-06-01 14:37:35 +02:00
can1357 72cf371b9d Merge remote-tracking branch 'origin/farm/f30c73d1/demote-subagent-abort-log' 2026-06-01 14:37:10 +02:00
can1357 6a63b17711 Merge remote-tracking branch 'origin/farm/cdb7e4ab/fix-find-renderer-string-paths' 2026-06-01 14:36:57 +02:00
can1357 8a41264745 feat(ai): added Anthropic task budget support via output_config
- Added `TokenTaskBudget` type and `taskBudget` option to `StreamOptions`.
- Forwarded `taskBudget` as `output_config.task_budget` with the `task-budgets-2026-03-13` beta header.
- Fixed `disableThinkingIfToolChoiceForced` to preserve `task_budget` when clearing `effort`.
- Accepted `output_config.task_budget` from Anthropic gateway requests.
2026-06-01 14:35:43 +02:00
roboomp 73102d20df fix(coding-agent): routed local:// reads through the calling session
- Extended ResolveContext / WriteContext with localProtocolOptions so the
  internal-URL router can thread the calling session's local-root mapping
  through to handlers.
- LocalProtocolHandler.resolveOptions now prefers context.localProtocolOptions
  before consulting the process-global override or the first main-kind session
  in AgentRegistry, fixing multi-session ACP hosts (cmux) where reads of
  local://PLAN.md were routing to a sibling session's artifacts dir even
  though plan-mode writes succeeded against the calling session.
- read, find, ast_grep, ast_edit, and search now thread
  this.session.localProtocolOptions into the router so local://, memory://,
  agent://, and other handlers see the right caller.
- Added regression tests covering the override-vs-context priority and the
  ENOENT-against-caller-root path.

Fixes #1608
2026-06-01 11:27:14 +00:00
rimless-casualty 8dfdf27af7 Cap outlined ask selector by wrapped rows 2026-06-01 19:04:27 +08:00
rimless-casualty f7b157675c Count ask option descriptions in selector height 2026-06-01 17:58:49 +08:00
rimless-casualty 3c7d50d292 Improve ask option rendering 2026-06-01 17:37:26 +08:00
roboomp 8580ba248c fix(tool): handled string paths in find renderer
Guarded find renderer path summaries so raw pre-validation string paths render instead of throwing. Added coverage for pending, fallback, empty, and detailed result render paths.\n\nFixes #1622
2026-06-01 06:22:27 +00:00
roboomp d14aa4dbe5 fix(task): demote subagent reminder-loop abort log
The catch around the subagent yield-reminder prompt previously logged
every exception at ERROR. User cancel (^C) and compaction-driven aborts
both surface as ToolAbortError through awaitAbortable, so benign control
flow generated 9 spurious 'Subagent prompt failed' errors in 2 days on
the reporter's instance.

Gate the ERROR branch on '!abortSignal.aborted && !(err instanceof
ToolAbortError)' and route the abort path to logger.debug. The outer
catch + finally still mark the run aborted, so observable behaviour is
unchanged.

Fixes #1623
2026-06-01 06:20:55 +00:00
roboomp 847df21ae9 fix(agent): account for tool schemas in pre-prompt estimate
Switch the pre-prompt token estimate to computeNonMessageTokens so the guard sees the same system-prompt, tool-schema, and skills accounting as /context. Without tool tokens, sessions with large MCP tool sets stayed below the compaction threshold while the outbound request was over the model limit.

Refs #1618
2026-06-01 03:43:21 +00:00
roboomp d6311f1331 fix(agent): compact before oversized prompts
Include pending prompt messages in the pre-send context estimate so auto maintenance runs before providers reject over-limit requests. Suppress auto-continue when maintenance runs inline for an active prompt.

Fixes #1618
2026-06-01 03:37:48 +00:00
roboomp eaba4031ca fix(tui): reset assistant stream rebuild mode
Reset eager scrollback rebuild mode on agent_end when provider streams fail before message_end.\n\nFixes #1615
2026-06-01 02:45:37 +00:00
roboomp 64b48b57b1 fix(tui): rebuilt scrollback during assistant streaming
Enable eager native scrollback rebuild mode while assistant text is actively streaming so reflowed Markdown rows do not leave stale duplicated tails in WSL/Windows Terminal scrollback.\n\nFixes #1615
2026-06-01 02:40:45 +00:00
roboomp e69e8b54f8 fix(tiny): surfaced unexpected subprocess signal exits as worker errors
The first cut at the subprocess isolation swallowed every signal exit (`exitCode === null`) on the assumption it was the intentional SIGKILL from `terminate()`. That misclassifies real worker deaths — SIGSEGV from a native crash, SIGKILL from the OOM killer, an operator `kill -9` — so any in-flight title/completion/download promise would await forever while `#worker` still pointed at a dead process.

Added an `intentionalExit` flag flipped by `wrapSubprocess.terminate()` right before its SIGKILL. `onExit` swallows only the flagged exit; every other signal exit now fires the `errors` channel with a "signal SIGFOO" message so `TinyTitleClient.#handleWorkerError` clears `#pending` and dumps the dead worker handle. Added two regression tests pinning both branches.

Reported by chatgpt-codex-connector on #1607.
2026-05-31 21:09:07 +00:00
roboomp 5843a78dbf fix(tiny): isolated tiny model worker in subprocess to skip onnxruntime napi crash
Moved the tiny title/memory worker from a Bun Worker thread into a child process spawned via Bun.spawn IPC. The agent CLI gains a hidden --tiny-worker dispatch the parent invokes through process.execPath; the parent SIGKILLs the child on dispose so onnxruntime-node's NAPI finalizer never runs in any address space the agent owns. On Windows that finalizer was segfaulting Bun at shutdown after the tiny title model loaded (issue #1606). Drops the now-dead 'close'/'closed' handshake and the unused parentPort bootstrap, and removes tiny/worker.ts from --compile worker entries in both build scripts plus the regression test that pinned them.

Fixes #1606
2026-05-31 21:02:25 +00:00
can1357 56cc099296 Merge remote-tracking branch 'origin/farm/8e4fd13a/show-pr-reviews' 2026-05-31 20:17:47 +02:00
can1357 7e11bea8f4 fix(coding-agent): repaired per-field double-encoded JSON in task tool
- Added `repairDoubleEncodedJsonString` to unescape fields double-encoded by the model (e.g. literal `\n`, `\"`, `\uXXXX` in `context`/`assignment`/`description`).
- Scoped repair to natural-language fields only, leaving code-bearing tools untouched.
- Applied repair on both render and execution paths in `TaskTool`.
2026-05-31 20:17:38 +02:00
can1357 a45747f96a refactor(coding-agent): replaced bracket-style section tags with underlined headers
- Converted [SECTION]...[/SECTION] markers to "SECTION\n===" format in system prompt templates.
- Updated system conventions doc to reference the new marker style.
- Updated tests to match against the new header pattern.
2026-05-31 20:10:56 +02:00
roboomp ff3dd6d9a6 fix(tool): rendered formal pr reviews
Included the reviews field in comments-enabled PR view fetches so pr:// output can show formal review submissions and approvals.

Added protocol coverage that emulates gh --json field selection before asserting rendered approval output.

Fixes #1600
2026-05-31 17:40:56 +00:00
ian_p e9a7f1add9 fix(coding-agent/acp): MCP tools from Zed not activated in ACP sessions
When Zed provisions MCP servers through `session/new.mcpServers`, the
ACP agent
correctly connects to them and registers their tools via
`refreshMCPTools`, but
the tools were never activated.  `refreshMCPTools` builds the next
active tool
set from `getSelectedMCPToolNames()`, which — with discovery disabled —
returns
only MCP tools already in the active set.  Since ACP sessions start with
no MCP
tools, this created a circular deadlock: tools could only become active
if they
were already active.

Added an optional `{ activateAll?: boolean }` parameter to
`refreshMCPTools`.
When true, every newly registered tool is force-activated regardless of
prior
selection.  `AcpAgent#configureMcpServers` passes `activateAll: true` on
both
call sites so client-provisioned tools are immediately usable.
2026-06-01 00:03:42 +08:00
roboomp 6881c5cc41 fix(mcp): drop stale connection when reconnect breaker trips
Leaving the dead connection in `#connections` made `getConnectionStatus` report `connected` and `waitForConnection` hand a closed transport to callers after the breaker had explicitly suspended the server. Mirror `#doReconnect`'s teardown: detach `onClose`, fire-and-forget `transport.close()`, and drop the entry from `#connections` (plus its in-flight slots in `#pendingConnections`/`#pendingToolLoads`). Tools stay registered in `#tools` so the user can recover with `/mcp reconnect`.

Test asserts `getConnectionStatus("crashy") === "disconnected"` after the burst.

Refs #1592
2026-05-31 15:38:21 +00:00
roboomp 230514d937 fix(mcp): cap automatic reconnect bursts to prevent fork-bomb
A stdio MCP server that completes the initialize + tools/list handshake and then exits cleanly will fire `transport.onClose` on every clean exit, and the old `MCPManager.reconnectServer` path spawned again unconditionally. A misconfigured PHP-shebang MCP (e.g. Laravel Boost in a non-Laravel project) hit this loop and forked 66 487 `php84` processes parented directly to the agent's `bun` PID until macOS force-rebooted.

Add a per-server sliding-window circuit breaker: at most 5 reconnect attempts per 30 s window. The transport `onClose` callback and the per-tool-call retry in `tool-bridge` are subject to the breaker; `/mcp reconnect` passes `{ manual: true }` to reset the window so users can recover after fixing the underlying misconfiguration. Stale `onClose` is detached when the breaker trips so a late EOF event cannot re-arm the loop.

Defended by `mcp-reconnect-storm.test.ts`: a Bun stdio fixture answers the handshake and exits, then asserts the spawn count stays at ≤ 10 (was 127 without the fix).

Fixes #1592
2026-05-31 15:34:29 +00:00