Commit Graph

4326 Commits

Author SHA1 Message Date
can1357 ebc1e7216c fix(ai): fixed Anthropic OAuth, stop-reason, and stream retry regressions
- Exported and applied wrapFetchForCch only for OAuth Anthropic web-search calls.
- Mapped model_context_window_exceeded to "length" and mapped unknown stop reasons to "stop".
- Adjusted header and param generation to preserve caller User-Agent and gate Claude Code betas.
- Updated stream and strict-tool retry handling to clear terminal errors and prevent regressions.
2026-06-09 22:35:51 +02:00
can1357 87bf790b27 Merge remote-tracking branch 'origin/farm/a4d90af5/tui-title-sentinel-leak' 2026-06-09 21:36:48 +02:00
roboomp 4ba6d9b2b9 fix(tui): suppressed tiny-title worker output
Stopped the tiny-title subprocess from inheriting stdout and stderr so native model runtime output cannot corrupt the interactive scrollback. Added a regression test for worker stdio configuration.\n\nFixes #2206
2026-06-09 19:29:28 +00:00
can1357 e18b901a8d refactor(packages/coding-agent): reorganized canonical model selection
- Replaced canonical-row resolution with getCanonicalModelSelections in model lists and selector flow.
- Hydrated model selector state from registry on construction and kept cached selections during refresh.
- Preserved highlighted and cached model selection when offline refresh completed or reordered models.
- Added parity checks between getCanonicalModelSelections and resolveCanonicalModel via registry tests.
2026-06-09 20:46:08 +02:00
can1357 59d3a025f0 fix(packages/coding-agent): patched diff row ordering after line shifts
- Tracked cumulative plus/minus line changes to translate new-file context rows to old indices.
- Merged old and translated new block-boundary context rows in one pass to prevent duplicate/out-of-order rows.
2026-06-09 20:45:01 +02:00
can1357 153c3d6565 refactor(packages/coding-agent): simplified terminal transcript rendering
- Removed terminal risk mode toggles from config, terminal state collection, and render controllers.
- Dropped snapshot freezing, thaw tracking, and finalized-block replay in transcript rendering.
- Removed clear-on-shrink settings and initialization hooks from selector and interactive mode flows.
- Simplified render scheduling by using requestRender() without mutation flags or stream checkpoints.
2026-06-09 20:45:01 +02:00
can1357 7044f1c518 feat(coding-agent): added read-only todo view operation
- Added a new `view` todo operation in the tool schema and dispatch path, returning the current list without mutating it.
- Implemented a read-only execution path in the todo tool so all-`view` calls skipped state updates, completion transitions, and normalization.
- Updated tool prompts to document `view` usage and clarified when bash commands are acceptable for fact-computing pipelines.
2026-06-09 20:37:31 +02:00
can1357 8001ec2773 test(tests): replaced scratch repro with anthropic request-shaping tests
- Added Anthropic request-shaping coverage for adaptive and non-adaptive models in packages/ai/test.
- Removed obsolete scratch thinking test used for commit-boundary tracing in coding-agent.
2026-06-09 19:51:53 +02:00
can1357 28a19e91db fix(packages/coding-agent): addressed transcript append-only scrolling
- Added regressions for transcript append-only handling on wrapped styled rows and trailing-line shrink.
- Added streaming-thinking and spinner-style reproduction coverage for commit-safe boundaries.
2026-06-09 19:48:49 +02:00
can1357 42a05f7b09 fix(coding-agent/modes): allowed transcript rows to re-earn append-only after clean frames
- Changed transcript commit tracking from a volatile boolean to a cooldown counter that decays over clean frames.
- Normalized row equality checks to ignore ANSI and trailing-space noise so equivalent renders do not trigger rewrites.
- Removed the Bun test-runtime exception from Ghostty image paint deferral so normal delay logic always runs.
2026-06-09 19:47:56 +02:00
can1357 b63398aeb9 fix(coding-agent): fixed bracketed image pastes to handle multiple paths
- Updated bracketed-image parsing to recognize multiple image paths in a single paste, including quoted values and shell-escaped spaces.
- Changed the editor image-path handler to process each matched path in order, awaiting async handlers.
- Added tests for multi-path routing/normalization and recorded the fix in the coding-agent changelog entry.
2026-06-09 19:46:17 +02:00
can1357 69a8a6aa6c Merge remote-tracking branch 'origin/farm/73573d1a/legacy-pi-compat-override-fallback' 2026-06-09 19:19:38 +02:00
can1357 a04f6ca0e7 Merge remote-tracking branch 'origin/farm/c312da92/windows-codegraph-mcp' 2026-06-09 19:19:23 +02:00
can1357 d97a89999c Merge remote-tracking branch 'origin/farm/e260f85e/fix-ssh-controlmaster-abort' 2026-06-09 19:18:53 +02:00
can1357 815913f579 Merge remote-tracking branch 'origin/farm/c9b8858e/forward-rules-exts-tools-to-subagents' 2026-06-09 19:18:36 +02:00
roboomp 9c17f27c04 fix(tui): honored tui.hyperlinks=off in mcp auth fallback
urlHyperlinkAlways now short-circuits to plain text when the user has explicitly opted out via tui.hyperlinks=off, while still bypassing capability auto-detection for auto mode.
2026-06-09 16:20:07 +00:00
roboomp dccba5297e fix(tui): restored mcp auth hyperlink fallback
MCP OAuth fallback prompts now emit an auth-safe terminal hyperlink even when auto-detection disables normal URL hyperlinks, matching the provider login behavior while preserving the raw copy URL.\n\nFixes #2196
2026-06-09 16:16:03 +00:00
roboomp fe34d0f392 fix(task): forward extension paths to subagents, rebind extensions per session
Same shape of bug the reviewer flagged for custom tools: forwarding
`LoadExtensionsResult` from parent to subagent reused Extension instances
whose factories closed over the parent's `ExtensionAPI` — cwd, eventBus,
and runtime all pointed at the parent. Any tool/handler/command that
referenced `api.exec()`, `api.events`, or `api.runtime` still acted on the
parent session/worktree from inside an isolated subagent.

Forward only the path list; each session rebuilds extensions through
`loadExtensions` so factories see the right `ExtensionAPI`.

- `extensibility/extensions/loader.ts`: extract `discoverExtensionPaths`
  (FS scan only) from `discoverAndLoadExtensions`. The combined helper now
  composes the two. New export added to the package barrel.
- `sdk.ts`:
  - Add `discoverSessionExtensionPaths()` (the `disableExtensionDiscovery`-aware
    path-only counterpart of `loadSessionExtensions`).
  - Add `preloadedExtensionPaths?: string[]` to `CreateAgentSessionOptions`.
    Three loader branches: `preloadedExtensions` (CLI same-process reuse,
    still shallow-cloned), `preloadedExtensionPaths` (subagent: skip scan,
    reload locally), or full discovery.
  - Document `preloadedExtensions` as same-process-only; subagent
    forwarding MUST use `preloadedExtensionPaths`.
- `tools/index.ts`: `ToolSession.extensionsResult` → `extensionPaths:
  string[]` for the same reason.
- `task/executor.ts` and `task/index.ts`: forward `extensionPaths`. Drop
  the forward for the isolated `runSubprocess` branch — worktree cwd ≠
  parent cwd, so the subagent re-discovers extensions against its own
  tree.
- New `test/sdk-extensions-per-session-binding.test.ts` pins the contract:
  two `loadExtensions` calls on the same path with different `cwd` and
  different `EventBus` instances yield distinct Extension + runtime
  objects whose factories close over the per-call bindings.
- Updated `executor-pass-through` and `sdk-preloaded-extensions-isolation`
  tests for the new option name and comment context.

Refs PR review on #2193
2026-06-09 14:19:47 +00:00
roboomp dde53a8f18 fix(task): forward custom-tool paths to subagents, rebind tools per session
Reviewer flagged that forwarding `LoadedCustomTool[]` from a parent session
to a subagent reused tool instances whose factories had closed over the
parent's `CustomToolAPI` — `cwd`, `exec`, `pushPendingAction`, and `ui` all
pointed at the parent. In isolated tasks the tool would `exec` against the
parent worktree and queue pending actions on the parent session.

Forward only the path list; let each session rebuild tools through
`loadCustomTools` so factories see the right `CustomToolAPI`.

- `extensibility/custom-tools/loader.ts`: extract `discoverCustomToolPaths`
  (FS scan only) from `discoverAndLoadCustomTools`; export
  `ToolPathWithSource`. The combined helper is now `discoverCustomToolPaths`
  + `loadCustomTools`.
- `sdk.ts`: replace `preloadedCustomTools` (`LoadedCustomTool[]`) with
  `preloadedCustomToolPaths` (`ToolPathWithSource[]`). The custom-tools
  block runs `loadCustomTools` unconditionally; only the path scan is
  skipped when the caller pre-discovered it.
- `tools/index.ts`: `ToolSession.loadedCustomTools` →
  `ToolSession.customToolPaths` for the same reason.
- `task/executor.ts` and `task/index.ts`: forward `customToolPaths`.
  Drop the forward for isolated subagents — the worktree shifts `cwd`, so
  the subagent re-discovers tools against its own working tree.
- New `test/sdk-custom-tools-per-session-binding.test.ts` pins the contract:
  two `loadCustomTools` calls on the same path with different `cwd` and
  different `pushPendingAction` callbacks yield distinct tool instances
  whose factories see the per-call bindings.
- Updated `executor-pass-through` and `sdk-preloaded-extensions-isolation`
  tests for the new option name and added a `ToolPathWithSource` fixture.

Refs PR review on #2193
2026-06-09 14:09:37 +00:00
roboomp e7645cec49 fix(task): forward parent-discovered rules, extensions, and custom tools to subagents
Each `runSubprocess` call re-ran `loadCapability<Rule>()`,
`loadSessionExtensions()`, and `discoverAndLoadCustomTools()` because
`ExecutorOptions` and the `createAgentSession()` call inside the executor
omitted three pass-through fields the parent had already paid for. The
already-correct paths (skills, context files, workspace tree, MCP manager)
showed the intended pattern.

- Cache `rules`, `extensionsResult`, and `loadedCustomTools` on the
  parent's `ToolSession`.
- Add `rules` / `preloadedExtensions` / `preloadedCustomTools` to
  `ExecutorOptions`; forward them from both `runSubprocess` call sites
  in `task/index.ts` and into the executor's `createAgentSession()`.
- Add `preloadedCustomTools` to `CreateAgentSessionOptions` and skip
  `discoverAndLoadCustomTools()` when it is supplied.
- Shallow-clone `extensionsResult.extensions` when reusing
  `preloadedExtensions`, so the per-session autoresearch + custom-tools
  inline wrappers never leak back into the caller's array.

Fixes #2190
2026-06-09 13:58:21 +00:00
roboomp 80a47a8329 fix(ssh): report abort after process exit
Preserve cancellation semantics when a user interrupt unblocks SSH stream drains after the mux client already exited.

Fixes #2180
2026-06-09 09:54:15 +00:00
roboomp daee87f00e fix(ssh): cancelled controlmaster stream waits
Return promptly when the ssh executor receives a user interrupt while ControlMaster-owned streams remain open.

Fixes #2180
2026-06-09 09:46:52 +00:00
roboomp db351abe49 fix(mcp): escaped cmd shim quotes
Escaped literal double quotes with cmd caret syntax before invoking Windows .cmd MCP shims so JSON args cannot break out of the quoted argument.

Refs #2174
2026-06-09 08:35:44 +00:00
roboomp 6b4bcb81e4 fix(mcp): preserved percent args in cmd shims
Escaped literal percent signs before joining Windows cmd.exe shim command strings so MCP server args are not consumed by cmd environment expansion.

Refs #2174
2026-06-09 08:30:16 +00:00
roboomp b48960e63e fix(mcp): resolved windows stdio shims
Resolved Windows stdio MCP commands through PATHEXT before spawning so tools installed as .cmd shims launch from bare command configs.

Fixes #2174
2026-06-09 08:16:45 +00:00
roboomp 4a6362192d fix(legacy-pi-compat): validated package-root override targets before rewrite
The package-root override branch of `resolveCanonicalPiSpecifier` returned
the bunfs override path without checking the target was actually present,
so when `bun --compile` quietly dropped one of the extra entrypoints
(observed on macOS arm64 release binaries), the static rewrite emitted a
`file://` URL to a missing module. The #1216 fallback only fired on the
throwing `getResolvedSpecifier` path, so the override never threw and the
rewrite committed the bad URL — extensions silently failed to load.

Each override target is now checked with `fs.existsSync` at module init.
Missing entries are dropped from `LEGACY_PI_PACKAGE_ROOT_OVERRIDES` so
`resolveCanonicalPiSpecifier` falls through to `getResolvedSpecifier`,
which throws under bunfs and triggers the existing rewrite catch — Bun
then resolves the canonical `@oh-my-pi/pi-*` specifier from the
extension's own `node_modules`.

Fixes #2168
2026-06-09 06:33:53 +00:00
can1357 c69ba70a4f fix: thread injectable fetch through read tool and remote compaction
Completes the injectable-fetch transport wiring (15.10.8) that the feature
left half-done, fixing the deterministic CI test failures:

- compaction.compact() rebuilt summaryOptions field-by-field but dropped
  `fetch`, so the injected transport never reached
  requestOpenAiRemoteCompaction / generateSummary's remote path. Thread it.
- Read-tool URL pipeline had no fetch seam: renderHtmlToText gained a
  fetchOverride param but renderUrl/ToolSession never carried one, so the
  jina/parallel reader backends always used global fetch. Add
  ToolSession.fetch -> renderUrl -> renderHtmlToText (defaults to global).
- searchWithParallel mirrored extractWithParallel but missed the fetch
  option; add it.
- Repair tests whose deleted hookFetch interceptors were never replaced
  with a FetchImpl seam (fetch-kagi-toggle, web-search-parallel,
  issue-970 discovery).
- Update issue-1746 POSIX case to the #2154 preserved-scrollback contract:
  unknown-viewport streaming deferral is now platform-independent.
2026-06-09 05:44:35 +02:00
can1357 eb1a46baf5 feat: added injectable fetch transport across AI and coding network flows
- Added optional FetchImpl fields to compaction, proxy, AI, coding-agent, and mnemopi options.
- Threaded injected fetch implementations through OAuth, discovery, and search/LLM request flows.
- Removed exported hookFetch utility and its package entrypoint from utils.
- Replaced global-fetch test monkeypatching with per-test FetchImpl mocks across test suites.
2026-06-09 04:51:17 +02:00
can1357 4a560216cb feat(coding-agent): added @upstream selector to pin aggregator routing
- Parsed a trailing `@slug` to set OpenRouter `provider.only` or Vercel Gateway routing per invocation.
- Resolved via `parseModelPattern`, composing with thinking levels and round-tripping through selectors.
- Split only when the base resolves to an aggregator, so ids containing `@` stay intact.
2026-06-09 04:50:57 +02:00
can1357 34faab9679 fix(coding-agent): clamped inline provider error rendering
- Dropped blank lines, capped at 8 lines, and width-truncated each line so a proxy 502's HTML body can't flood the transcript.
- Mirrored the pinned error banner's preview behavior; full text still kept in the persisted session.
2026-06-09 02:16:32 +02:00
can1357 7a6ce12bdf feat(coding-agent/tools): added bash.enabled setting to hide model-facing bash tool
- Added a `bash.enabled` boolean setting with a default of `true` in the settings schema.
- Updated tool generation to include the `bash` model tool only when `bash.enabled` is enabled.
- Extended createTools tests to assert `bash` is omitted when disabled and omitted from requested disabled tool lists.
2026-06-09 01:25:19 +02:00
can1357 11eba41973 chore: remove unnecessary guideline 2026-06-09 00:24:28 +02:00
can1357 48e6009b67 Merge remote-tracking branch 'origin/farm/daabf133/mcp-startup-no-block-on-slow-servers' 2026-06-09 00:23:48 +02:00
roboomp 54e7ccb468 fix(coding-agent): unblock omp startup when an MCP server stalls
MCPManager.connectServers used to fall through to an unbounded
Promise.allSettled over every still-pending server without cached tools,
so a single MCP server stuck waiting on the per-request MCP timeout
(OMP_MCP_TIMEOUT_MS, default 30 000 ms) gated the entire UI ready
signal — exactly the 30.282 s stall the reporter observed against
sbox-superdocs in #2100.

Drop the fallback wait. Pending-without-cache servers are left in flight
and their tools surface via the existing background #onToolsChanged ->
refreshMCPTools path the moment the connect completes; failures continue
to log through the background catch handler (gated on
allowBackgroundLogging) so users still see which server failed.

Adds a regression test that spawns an unresponsive stdio MCP fixture
and asserts connectServers returns inside the 250 ms STARTUP_TIMEOUT_MS
window (padded for CI jitter). The same test times out at 15 s without
the patch.

Fixes #2100
2026-06-08 20:41:51 +00:00
Can Bölük c03b7c26d8 Merge branch 'main' into farm/7680ea37/fix-opencode-zen-login-clipboard-paste 2026-06-08 22:36:54 +02:00
Can Bölük 15f597b71d Merge branch 'main' into farm/44203ced/shake-fallback-when-threshold-stays-above 2026-06-08 22:36:14 +02:00
Can Bölük 066c0a0cca Merge branch 'main' into farm/3b7d0183/skill-keywords-in-skill-args 2026-06-08 22:35:51 +02:00
Can Bölük 0726551894 Merge branch 'main' into farm/3b7d0183/skill-keywords-in-skill-args 2026-06-08 22:35:37 +02:00
Can Bölük 249bba2c66 Merge branch 'main' into farm/7904dac6/mcp-add-url-clickable 2026-06-08 22:35:16 +02:00
roboomp 336b993126 fix(tui): route enhanced-paste text to the focused Input prompt
On kitty (Linux/Wayland) and any terminal supporting OSC 5522 enhanced
paste, the /login API-key prompt for OpenCode Zen — and any other modal
Input prompt (Perplexity OTP, GitHub Enterprise URL, manual OAuth
redirect URL, …) — silently dropped pasted content. The user could not
paste their API key; on Enter or Esc the key surfaced in the main
prompt.

Cause: InputController.#setupEnhancedPaste enables kitty's enhanced
clipboard protocol on TUI start and consumes the resulting OSC 5522
packets in an addInputListener that runs *before* focus dispatch in
tui.#handleInput. The controller's pasteText callback then routed
unconditionally to this.ctx.editor.pasteText(text) — the main
CustomEditor — even when selector-controller had cleared editorContainer
and focused a temporary Input. The text accumulated in the detached
editor and only resurfaced when the modal was dismissed.

Fix:
- TUI.getFocused() exposes the currently focused component.
- Input.pasteText(text) mirrors Editor.pasteText so any Input can absorb
  a payload from a non-bracketed transport.
- InputController's enhanced-paste callback consults getFocused() and
  routes text to the focused component when it exposes pasteText,
  falling back to the editor only when no modal target is in focus.
- Image pastes refuse with a status message when a modal Input is
  focused, instead of stuffing a binary blob into the hidden editor.

Regression tests in packages/tui/test/input.test.ts and
packages/coding-agent/test/issue-2127-repro.test.ts pin both the new
TUI/Input contract and the InputController routing source.

Fixes #2127
2026-06-08 20:34:50 +00:00
roboomp a190298414 fix(coding-agent): fell back to context-full when shake cannot drop below threshold
Threshold-driven auto-compaction with strategy=shake auto-continued even when
the shake reclaimed nothing material, and the next agent turn re-triggered the
same shake (which had nothing new to drop on a second pass), spinning forever.
After shake completes, recompute the post-shake context estimate; when it
still exceeds the auto-compact threshold (or shake reclaimed nothing on overflow
recovery), emit a one-shot fallback warning and hand off to the summarization
driven context-full path so progress actually resumes. Idle is exempt — its
60s+ timer self-throttles and cannot dead-loop on its own.

Fixes #2119
2026-06-08 20:34:16 +00:00
roboomp ef212c7cc2 fix(cli): kept mcp auth urls clickable
Rendered the MCP OAuth fallback as a short terminal hyperlink plus a single unwrapped copy URL line so terminals do not receive hard-broken authorization URLs.\n\nFixes #2121
2026-06-08 20:33:22 +00:00
can1357 eb33112440 chore: reformat 2026-06-08 22:32:46 +02:00
roboomp ef49122afe fix(coding-agent): honored skill prompt magic keywords
Skill prompt custom messages now scan user-authored skill args for magic keywords and turn budgets, matching normal prompt steering behavior without scanning skill body text.

Added a regression test for workflowz and hard turn-budget args on skill prompts.

Fixes #2128
2026-06-08 20:32:22 +00:00
can1357 0089811129 fix(coding-agent/cli): qualified model IDs to avoid cross-provider collisions
- Updated PI native streaming requests to send model identifiers as provider-qualified keys.
- Updated the auth-gateway model registry to store `${provider}/${id}` first and retain legacy bare IDs as fallback keys.
2026-06-08 22:31:34 +02:00
can1357 532e2b1b16 feat(coding-agent): added manual /plan-review command for reopening latest local plan
- Added an `openPlanReview` flow that selected the newest `local://<slug>-plan.md`, resolved its title, and reopened approval.
- Registered a new `/plan-review` builtin slash command that invokes that flow and clears the editor text.
- Added tests covering latest-plan selection plus warnings when plan mode is inactive or when no local plan file exists.
2026-06-08 22:31:34 +02:00
can1357 d6f2ff38bb fix(coding-agent/task): fixed task result rendering to show error and success glyphs correctly
- Updated `renderResult` to inspect `isError` on detail-less task results and render an error state with the error glyph.
- Replaced success/completed status symbols in agent, review, and result outputs with the shared `status.done` symbol.
- Added tests for detail-less task rendering to verify failed results show error and successful results show the done glyph.
2026-06-08 22:31:33 +02:00
Can Bölük 5a92a35c4c Merge pull request #2120 from danzaio/fix/easy-issues-batch
fix: close several issues
2026-06-08 22:30:41 +02:00
Can Bölük 19ce6b28c4 Merge pull request #2116 from danzaio/fix/split-commit-empty-hunks
fix(commit): reject empty split hunk selectors
2026-06-08 22:29:16 +02:00
can1357 59a688f5c0 fix: address easy issues review 2026-06-08 15:47:57 -03:00