97 Commits
Author SHA1 Message Date
BogdanandGitHub ca7c3efb6e fix(bg): identify sessions with persisted process markers (#2163) 2026-08-24 10:23:00 +08:00
BogdanandGitHub 69aca780ea fix(effort): preserve known model exclusions when force-enabled (#2148)
* fix(effort): preserve known model exclusions when force-enabled

* fix(effort): address review feedback

* test(effort): cover provider-scoped capability overrides

* fix(effort): preserve route-specific reasoning controls

* fix(effort): honor scoped routing environment
2026-08-24 10:19:11 +08:00
BogdanandGitHub 34536c6220 fix(settings): preserve concurrent updates (#2137)
* fix(settings): preserve concurrent updates

Serialize the complete settings read-merge-write transaction under a physical-target lock with a bounded synchronous contention wait. Read the merge base fresh after ownership, preserve logical symlinks during publication, and route direct settings-sync replacements through the same lock.

* fix(settings): address transaction review feedback

* fix(settings): reject invalid merge bases

* fix(settings): preserve lock ownership and apply outcomes

* fix(settings): address transaction follow-up

* fix(settings): avoid unsafe cleanup control flow

* fix(settings): publish complete lock claims

* test(settings): document pending lock claim

* fix(settings): track lock owner process identity
2026-08-24 10:17:55 +08:00
BogdanandGitHub 108a413493 fix(bg): preserve detached session terminal outcomes (#2133)
* fix(bg): preserve detached session terminal outcomes

* fix(bg): harden terminal outcome routing
2026-08-16 15:56:55 +08:00
BogdanandGitHub e9e6beb15b fix(mcp): paginate discovery list operations (#2132)
* fix(mcp): paginate discovery list operations

* fix(mcp): bound paginated discovery retries
2026-08-16 15:55:47 +08:00
BogdanandGitHub 09eba26d30 feat(cost): support exact custom model pricing (#2131)
* feat(cost): support exact custom model pricing

* fix(cost): address custom pricing review feedback
2026-08-16 15:55:02 +08:00
BogdanandGitHub c30578819e diagnostics(query): trace interruption causality (#2111)
* diagnostics(issue-1830): trace interruption causality

* test(issue-1830): lock interruption ownership matrix

* fix(codex): preserve stream deadline contract

* fix(diagnostics): harden interruption trace lifecycle

Refs #1830

* fix(diagnostics): harden interruption trace settlement

Refs #1830

* fix(diagnostics): preserve interruption causality

* fix(diagnostics): address interruption trace review

* fix(diagnostics): preserve tracing observer contracts

* fix(diagnostics): preserve interruption trace contracts

* test(permissions): cover interactive hook interrupts
2026-08-16 15:54:29 +08:00
BogdanandGitHub ea655163d3 feat(zai): expand Coding Plan catalog support (#2127)
* feat(zai): expand Coding Plan catalog support

Signed-off-by: chioarub <chioarub@gmail.com>

* fix(zai): use supported low reasoning mode

Signed-off-by: chioarub <chioarub@gmail.com>

---------

Signed-off-by: chioarub <chioarub@gmail.com>
2026-08-15 17:05:49 +08:00
BogdanandGitHub 16e332e108 fix(query): use monotonic watchdog deadlines (#2110)
Wall-clock corrections can otherwise manufacture an immediate timeout or postpone an already-scheduled one. Keep lifecycle timestamps in wall time while measuring deadline state and elapsed duration from a monotonic clock.\n\nRefs #1830
2026-08-11 19:09:26 +08:00
BogdanandGitHub d834904e5a fix(session): make transcript replacements crash-safe (#2094)
* fix(session): make transcript replacements crash-safe

Complete transcript rewrites could truncate live JSONL files before preserved data was durable, risking unrecoverable resume history after an interrupted write. Commit replacements through exclusive sibling temp files and serialize them with all transcript append paths so readers observe either the old file or the complete replacement.

* fix(session): preserve concurrent transcript updates

Abort tombstone commits when the scanned transcript changes before replacement, and keep existing local history when remote foreground hydration returns no entries. Harden the associated portability, option coverage, queue timing, and diagnostics.

* test(session): match hydration reader signature

Pass the explicit optional subagent reader in the empty-hydration regression so a fresh TypeScript build sees the complete helper signature.

* fix(session): coordinate transcript writers across processes

Hold a same-directory cooperative lock across transcript replacement and final-line truncation, and make session plus SDK append paths participate. Exercise the post-validation/pre-rename race deterministically so external appends land after the complete commit.

* test(session): provide empty hydration subagent reader

* fix(session): scope transcript lock ownership

Separate async and synchronous lock ownership so unrelated sync appends cannot bypass an in-flight replacement. Route aliased in-process appends through the queue, propagate lock compromise through AbortSignal, and cover both symlink-alias and rename-boundary races.
2026-08-07 09:57:32 +08:00
BogdanandGitHub 6465a516f2 fix(mcp): serialize OAuth and XAA refresh across processes (#2093)
* fix(mcp): serialize OAuth and XAA refresh across processes

Normal OAuth refresh, reactive 401 recovery, and silent XAA exchange can otherwise race shared secure-storage writes between processes. Coordinate them on one server-scoped lock and re-read storage so waiters reuse persisted winners.

* fix(mcp): harden refresh follow-up paths

Use asynchronous cache-bypass reads on request paths while preserving the adjacent final record merge and write. Make the XAA concurrency fixtures independent of module import order and extend abort, redaction, and retry coverage.

* fix(mcp): honor aborts after credential reads

Check the active cancellation signal after asynchronous secure-storage reads so fresh-token fast paths cannot return credentials to an aborted request. Cover cancellation while a cache-bypassing read is pending.
2026-08-07 09:56:12 +08:00
BogdanandGitHub d427a4b2bb perf(cli): enable Node module compile cache (#2092)
* perf(cli): enable Node module compile cache

Warm CLI invocations spend substantial time compiling the bundled ESM entrypoint. Enable Node's optional on-disk compile cache only in the process that imports the bundle, while preserving early Node 22 compatibility and making cache failures non-fatal.

Add deterministic launcher coverage, packaging checks, and a reproducible benchmark procedure so the startup benefit can be measured without flaky CI thresholds.

* fix(ci): isolate minimum Node launcher check

The full validation suite depends on knip and oxc-parser behavior unavailable in Node 22.0.0. Keep full CI on the active Node 22 line and exercise the declared runtime floor in a dedicated build-and-launch job.

* fix(benchmark): harden startup measurements

Keep environment setup outside the timed process window, document the API's Node 22.8 floor, and preserve completed benchmark results when git metadata is unavailable.

* test(cli): verify compile cache disable behavior

Pair NODE_DISABLE_COMPILE_CACHE with a temporary cache directory and assert that supported Node releases leave it empty while preserving normal launcher output.
2026-08-07 09:55:01 +08:00
BogdanandGitHub 1bf8076d48 fix(input): preserve text in DEL-coalesced chunks (#2091)
* fix(input): preserve text in DEL-coalesced chunks

Some terminal transports deliver replacement input as raw DEL bytes and printable text in one read. The raw-DEL workaround previously applied only the deletions and returned, dropping the replacement text and leaving same-event cursor and mode state stale.

Process filtered chunks in source order through the existing cursor semantics, preserve coalesced submission and Vim state, and cover grapheme, token, filter, mode, and batching cases.

* test(input): harden DEL regression coverage

* test(input): clean up harnesses after timeouts

* fix(input): preserve coalesced consumer state

* fix(input): synchronize coalesced mode state
2026-08-07 09:49:01 +08:00
5399a11d3c fix(openai): compress tool history on Responses requests (#1958)
* fix(openai): compress tool history on Responses requests

* fix(openai): tighten transport preprocessing

* fix(openai): preserve structured compressed tool results

* fix(openai): tier parallel tool results independently

* fix(openai): preserve Ollama image endpoint fallback

* fix(openai): omit old inline image payloads

* fix(openai): bound inline image history

* fix(openai): preserve local image fallback

* fix(openai): bound data URL tool images

* fix(openai): match parameterized image data URLs

* fix(openai): bound adjacent tool images

* fix(openai): bound leading tool images

* fix(openai): size structured history per transport

* fix(openai): scope attached image compression

* fix(codex): match tool text serialization budget

* fix(openai): recompress GitHub Responses fallback

* fix(openai): preserve user images in history compression

* fix(openai): scope history image omission to result ownership

* fix(messages): preserve image owners after media retry

* fix(messages): retain image ownership through normalization

---------

Co-authored-by: jatmn <the@jat.mn>
2026-07-20 09:53:20 +08:00
3808d19da4 fix(api): enforce API_TIMEOUT_MS for OpenAI-compatible headers (#1940)
* fix(api): enforce API_TIMEOUT_MS for OpenAI-compatible headers

* test(api): cover Copilot responses fallback deadlines

* fix(api): redact secrets in timeout URL paths

* fix(api): harden Copilot response deadlines

* fix(api): prevent header-timeout request replay

* fix(api): harden timeout cleanup and redaction

* fix(api): redact encoded transport credentials

* fix(api): harden deadline retries and URL redaction

* fix(api): preserve aborted fetch reasons

* fix(api): preserve caller abort reasons

* test(api): clear caller abort timer

* docs(api): clarify API_TIMEOUT_MS transport scope

* docs(api): explain timeout env loading

* fix(api): reset deadline for proxy retries

* fix(api): type deadline fetch adapter

* fix(api): honor abort cleanup and request signals

* fix(api): do not block proxy retries on body cancellation

---------

Co-authored-by: jatmn <the@jat.mn>
2026-07-19 09:21:14 +08:00
eb72c770c4 fix(repl): add correction context after interruption (#1936)
* fix(repl): add correction context after interruption

* test(repl): exercise interruption correction lifecycle

* refactor(repl): bind correction tracker to query guard

* fix(repl): retain initialized correction tracker

* fix(repl): track pre-query interruption corrections

* fix(repl): exclude remote turns from correction context

* fix(repl): harden correction reminder lifecycle

* fix(repl): keep correction reminder request-scoped

* test(query): cover absent request-only context

* fix(repl): clear correction context on compaction

* fix(repl): preserve interruption correction recovery

* fix(repl): clear stale correction state on boundary removal

* fix(messages): recover merged attachment retries

* fix(messages): recover attachment retries safely

* fix(messages): recover ambiguous attachment retries

* fix(repl): clear stale correction reminders

* fix(query): clear correction context after reactive compaction

* fix(repl): declare restore callback dependencies

* fix(repl): preserve correction state across rewrites

* fix(repl): scope correction tracking to model calls

* test(repl): remove structural lifecycle assertions

* fix(repl): preserve interruption correction reminders

* fix(repl): retain reminder before queued dispatch

* fix(repl): retain correction reminder until model dispatch

* fix(repl): preserve reminders for queued corrections

* fix(repl): arm correction only at provider dispatch

* fix(repl): scope interruption correction to model requests

* fix(repl): retain reminders until model dispatch

* fix(repl): ignore queued slash commands on interrupt

* fix(messages): strip rejected tool-result media

* fix(messages): apply nested media retry stripping

* fix(messages): preserve empty tool results after media retry

* fix(repl): preserve correction and media retries

* fix(repl): retain correction through tool execution

---------

Co-authored-by: jatmn <the@jat.mn>
2026-07-18 22:48:00 +08:00
BogdanandGitHub 507ba4b804 perf(tools): preserve UTF-8-safe head and tail in persisted previews (#1960)
* perf(tools): preserve UTF-8-safe head and tail in persisted previews

* fix(tools): derive persisted preview size from file

* fix(tools): report exact persisted preview bytes

* fix(tools): bound and sanitize persisted previews

* fix(tools): reconcile sanitized preview metadata
2026-07-16 08:19:41 +08:00
BogdanandGitHub 1f20e92c2e fix(permissions): enforce read-only plan mode (#1938)
* fix(permissions): enforce read-only plan mode

* fix(permissions): narrow hook approval types

* fix(permissions): harden plan-mode decision boundaries

* fix(permissions): close plan-mode hook races

* test(permissions): clarify platform path case coverage

* fix(permissions): guard permission hook rewrites

* fix(permissions): close remaining plan-mode escapes

* test(speculation): satisfy strict context typing

* fix(permissions): close hook update race windows

* fix(permissions): close plan approval races

* fix(permissions): align prompt decision type

* fix(permissions): close plan transition races
2026-07-16 08:15:43 +08:00
BogdanandGitHub af0885d8ec fix(bg): revalidate process identity before signals (#1937)
* fix(bg): revalidate process identity before signals

* fix(bg): sanitize process identity probe failures

* fix(bg): skip signals for terminal sessions
2026-07-14 14:40:32 +08:00
BogdanandGitHub 85cf2ac55a fix(update): avoid upstream package commands for custom builds (#1944)
* fix(update): avoid upstream package commands for custom builds

* test(update): cover runtime package identity
2026-07-13 16:20:30 +08:00
BogdanandGitHub ae9a765fb5 fix(env): align WebSearch and Ollama env docs (#1904) 2026-07-08 22:59:21 +08:00
BogdanandGitHub e204d5ad36 feat(doctor): add WebSearch backend diagnostics (#1884)
* feat(doctor): add WebSearch backend diagnostics

* fix(doctor): tighten Firecrawl cloud URL diagnostics

* fix(firecrawl): align cloud URL detection

* test(websearch): stabilize Brave timeout assertion

* fix(firecrawl): handle bare cloud host casing

* fix(doctor): align WebSearch auto diagnostics with fallback

* fix(doctor): align custom preset diagnostics
2026-07-08 08:42:34 +08:00
BogdanandGitHub 8599560b82 fix(websearch): add built-in provider request timeouts (#1874)
* Add timeouts for web search providers

* Fix WebSearch timeout body-stall test

* Address WebSearch timeout review feedback
2026-07-07 21:54:11 +08:00
BogdanandGitHub 11f4661ea9 fix(lsp): coalesce diagnostic bursts (#1861)
* fix(lsp): coalesce diagnostic bursts

* fix(lsp): tighten diagnostic debounce coverage

* test(lsp): share zero-diagnostic log assertion

* test(lsp): isolate diagnostic attachment debounce coverage
2026-07-07 11:10:03 +08:00
BogdanandGitHub 62fa7d48c1 fix(api): quiet expected side-task aborts (#1868)
* fix(api): quiet expected side-task aborts

* fix(api): tighten expected abort handling

* fix(memory): keep cursor on superseded extraction
2026-07-06 08:21:54 +08:00
BogdanandGitHub ad796e0d9f fix: bound profiler performance entries (#1865)
* fix: bound profiler performance entries

* test: restore profiler retention mocks cleanly
2026-07-06 08:21:11 +08:00
BogdanandGitHub 9700bd3c41 fix(lsp): suppress empty diagnostic deliveries (#1859)
* fix(lsp): suppress empty diagnostic deliveries

* fix(lsp): preserve storm summary diagnostics

* test(lsp): clarify diagnostic attachment guard
2026-07-06 08:16:38 +08:00
BogdanandGitHub cd1cf3ca70 fix(bash): share parser analysis across checks (#1735)
* fix(bash): share parser analysis across checks

* test(bash): tighten parser analysis test helpers

* fix(bash): keep execution sandbox fail-closed

* fix(bash): align sandbox presentation fallback
2026-07-06 08:10:51 +08:00
BogdanandGitHub 5226fb9ee7 fix(query): configure hard max and abort reasons (#1850)
* fix(query): configure hard max and abort reasons

* fix(query): normalize legacy abort reasons

* test(query): dedupe abort classification setup
2026-07-05 11:48:46 +08:00
BogdanandGitHub d1530c28aa fix(query): clean up lifecycle tool tracking (#1845) 2026-07-04 08:00:20 +08:00
BogdanandGitHub ac2b575b6e Fix shell abort classification for Bash and PowerShell (#1688)
* fix: classify shell aborts as cancellations

* fix: enumerate shell abort messages

* fix: preserve PowerShell large error output
2026-07-03 07:58:03 +08:00
BogdanandGitHub 5b1db554fd feat(lsp): expose captured diagnostics (#1813) 2026-07-02 08:12:36 +08:00
BogdanandGitHub 67227cf772 fix(openai-shim): recover stalled provider streams (#1817)
* fix(openai-shim): recover from stalled streams

Bound SSE reader waits with an idle timeout so non-streaming fallback can recover before the parent query is force-aborted. Preserve parent-abort cancellation semantics and cover fallback, disabled-fallback, and slow-active stream cases.

* test(openai-shim): bound fallback recovery regression

* test(openai-shim): relax CI fallback timing guard

* test(openai-shim): stabilize idle fallback regression

* test(openai-shim): force idle timeout fixture error

* test(openai-shim): stabilize idle timeout fallback fixture

* test(openai-shim): use real stalled stream fallback fixture

* test(openai-shim): assert fallback recovery outcome

* test(claude): isolate fallback feature flags

* test(claude): stabilize idle fallback fixture

* fix(claude): fallback on live stream abort timeouts

* test(claude): drop unstable idle fallback fixture

* test(claude): decouple idle timeout assertion budget
2026-07-01 21:19:04 +08:00
BogdanandGitHub bb61d8430b fix(openai-shim): wire stream controller abort (#1828)
* fix(openai-shim): wire stream controller abort

* test(openai-shim): guard Ollama abort fixture cleanup
2026-07-01 07:56:50 +08:00
BogdanandGitHub 8182a46441 feat(report): render task reports as markdown (#1826) 2026-07-01 06:43:05 +08:00
BogdanandGitHub 166d0ce784 feat(resume): group branched sessions in picker (#1824)
* feat(resume): group branched sessions in picker

* test(resume): stabilize branch metadata fixtures

* fix(resume): keep branch base titles searchable

* test(resume): release picker lock on setup failure

* fix(resume): count expanded branch rows for load more

* fix(resume): keep branch metadata reads bounded

* test(resume): assert hidden branch log is loaded
2026-07-01 06:36:15 +08:00
BogdanandGitHub c1a9dadea5 fix(claude): make stream watchdog deterministic (#1823)
* fix(claude): make stream watchdog deterministic

* test(claude): harden watchdog env restore
2026-06-30 20:17:09 +08:00
BogdanandGitHub 1827d84709 feat(agents): add per-agent step limits (#1815)
* feat(agents): add per-agent step limits

Add maxSteps agent configuration for markdown, JSON, plugin, and SDK agent definitions. Enforce the limit in subagent query execution by blocking over-limit tool calls, preserving a no-tool summary turn, and recording an agent_step_limit terminal reason. Add focused coverage for default behavior, invalid values, multi-turn accumulation, plugin parsing, failure-loop interaction, and summary-tool blocking.

* test(agents): isolate agent loader fixtures

* test(agents): stabilize agent loader config fixtures

* fix(agents): harden step-limit summaries

* fix(sdk): harden agent injection follow-up

* fix(sdk): report invalid agent step limits
2026-06-30 11:23:21 +08:00
BogdanandGitHub d0843bed0b fix(compaction): make snip nudges model-aware (#1816)
Scale HISTORY_SNIP context-efficiency nudges with the active model window so large-context sessions do not get prompted after fixed low token growth.

Keep existing reset behavior and add focused regression coverage for custom intervals and model-aware attachment gating.
2026-06-30 08:28:18 +08:00
BogdanandGitHub 9bf6aa2308 feat(session): add branch command for conversation forks (#1808)
* feat(session): add branch command for conversation forks

* test(session): harden branch test cache cleanup

* test(session): isolate branch loader checks

* test(session): guard branch project cache cleanup
2026-06-29 18:06:28 +08:00
BogdanandGitHub a47493342f feat(report): generate deterministic session task reports (#1802)
* feat(report): generate deterministic session task reports

* fix(report): address task report review findings

* fix(report): stabilize task report paths on Windows

* test(report): expect redacted git metadata cwd

* test(report): assert literal redacted git cwd

* fix(report): capture PowerShell and backgrounded validations

* fix(report): detect quoted validation commands

* fix(report): reconcile background validation notifications

* fix(report): keep foreground command statuses authoritative

* test(report): assert command status precedence
2026-06-29 17:57:09 +08:00
BogdanandGitHub 8023356841 feat(session): harden fork-session branching (#1801)
* feat(session): harden fork-session branching

Add explicit fork-session branching metadata, preserve fork-owned transcript state, and seed retained content replacement records for forked resumes.

Document --fork-session behavior and cover forked resume transcript/materialization behavior with focused tests.

* fix(session): respect print persistence for fork seeding
2026-06-28 06:17:29 +08:00
BogdanandGitHub 320d63c812 fix(compaction): skip microcompact when compaction is off (#1800)
* fix(compaction): respect disabled microcompact setting

Skip automatic query-loop microcompact when the message-count compaction threshold is explicitly set to off, while preserving default, numeric, and explicit compact behavior.

* test(query): isolate auto-compact config regression

* test(query): type auto-compact deps fixture
2026-06-28 06:16:42 +08:00
BogdanandGitHub eea0a1a740 feat(cli): add headless heartbeat for print mode (#1789)
* feat(cli): add headless heartbeat for print mode

* fix(cli): harden heartbeat validation and predicates

* fix(cli): align print heartbeat phases

* fix(cli): keep heartbeat payloads schema-valid

* fix(cli): delay stream-json heartbeat until drain

* test(sdk): cover heartbeat placeholder identifiers

* fix(cli): clamp heartbeat durations

* fix(cli): ignore file persistence final events

* test(cli): cover post-turn final filtering

* fix(cli): harden headless heartbeat follow-up

Export the heartbeat SDK message type from generated core types.

Keep heartbeat cleanup paired with setup and streaming failures, and cover timing/count edge cases with focused regression tests.

* test(sdk): exercise generated heartbeat types

Expose the SDK type generator as a pure helper so tests compare fresh output with the checked-in generated artifact.

* fix(scripts): canonicalize sdk type generator entrypoint

Compare real paths for direct script execution so symlinked invocations still run the generator.

* test(sdk): harden generator import coverage

Normalize generated type freshness checks across line endings and keep the SDK type generator import-safe for non-file entrypoints.

* test(sdk): assert generator import has no write side effects

Snapshot the generated SDK type artifact around the non-file import regression so importing the generator cannot silently rewrite the committed output.
2026-06-27 09:22:25 +08:00
BogdanandGitHub 6fdb1d0c46 fix(bg): preserve provider env-file values during prompt detection (#1767) 2026-06-25 11:13:35 +08:00
BogdanandGitHub 3157ee715b Fix slash command suggestion filtering (#1664) 2026-06-25 11:13:01 +08:00
BogdanandGitHub db66f41071 fix(resume): tolerate malformed legacy attachment records (#1768)
* fix(resume): tolerate malformed legacy attachment records

* test(resume): allow resume hook messages in recovery test

* fix(resume): use validated attachment for skill listing
2026-06-25 09:27:02 +08:00
BogdanandGitHub bd00b3b3c5 fix(bg): stream session logs with bounded memory (#1762)
* fix(bg): stream session logs with bounded memory

* fix(bg): handle log follow cleanup edge cases

* fix(bg): surface non-follow log read errors

* test(bg): isolate log streaming temp dirs
2026-06-25 09:10:01 +08:00
BogdanandGitHub 28bbec4948 fix(memory): bound memory-directory scanning work (#1757)
* fix(memory): bound memory-directory scanning work

* fix(memory): harden bounded memory scanning follow-up
2026-06-25 06:39:05 +08:00
BogdanandGitHub 820015fbaf fix(bg): prefer exact session names over ID prefixes (#1753) 2026-06-23 07:53:29 +08:00
BogdanandGitHub 23bc49a01d feat(query): add lifecycle identity and terminal reasons (#1682)
* feat(query): add lifecycle identity and terminal reasons

* fix(query): isolate lifecycle tracking context

* fix(query): guard lifecycle metadata updates

* fix(query): track lifecycle during tool waits

* test(query): cover bash lifecycle metadata

* fix(query): scope lifecycle tracking to request attempts

* fix(query): disambiguate lifecycle abort log reason

* fix(query): preserve foreground subagent lifecycle tracking

* fix(query): clean up timeout and fallback lifecycle events

* fix(query): emit timeout end after cleanup
2026-06-22 08:22:57 +08:00
BogdanandGitHub b9a5030b67 fix(status): show active provider route instead of legacy provider bucket (#1673)
* fix(status): show active provider route instead of legacy bucket

The /status command collapsed many concrete providers (OpenRouter, Groq,
Ollama, Fireworks AI, etc.) into a single "OpenAI-compatible" label, making
multi-provider setups hard to verify and debug.

When apiProvider resolves to the generic "openai" bucket, /status now uses
route metadata to surface the real active route:
  Provider route: OpenRouter
  Transport: OpenAI-compatible API
  OpenAI base URL: https://openrouter.ai/api/v1
  Model: anthropic/claude-sonnet-4.5
  Credential: OPENROUTER_API_KEY configured

The legacy "OpenAI-compatible" label and fallback are preserved for unknown
custom base URLs. Dedicated provider buckets (nvidia-nim, minimax, codex,
github, xai, gemini, bedrock, vertex, foundry, firstParty, mistral) already
have accurate labels and are left untouched.

Credential display uses env-var names only (never values). Transport kind and
route label come from the existing descriptor-driven route metadata; no new
hardcoded provider maps or network calls are introduced.

* fix(status): include route status defaults

* fix(status): address route status review findings

* fix(status): cover route secret redaction review

* fix(status): avoid duplicate route resolution

* fix(status): redact base URL query credentials

* fix(status): harden status URL secret redaction

* fix(status): redact route secrets in status text

* test(status): cover fallback URL fragment redaction

* test(status): isolate route status provider imports

* fix(status): redact encoded route secrets

* fix(status): redact encoded query secrets safely

* fix(status): redact nested encoded query secrets

* fix(status): redact encoded secret substrings

* fix(status): redact strict encoded secret variants
2026-06-22 08:17:56 +08:00
BogdanandGitHub b581bd9ece feat(zai): add GLM-5.2 support (#1689)
* feat(zai): add GLM-5.2 thinking support

* fix(provider): derive GHE Copilot URL from base URL

* fix(zai): gate GLM reasoning effort by model
2026-06-19 22:58:46 +08:00
BogdanandGitHub cc385a6490 fix(ink): reduce high-write-ratio diagnostic noise (#1699)
* fix(ink): reduce high-write-ratio diagnostic noise

* test(ink): cover high-write diagnostic suppression

* fix(ink): preserve churn warnings at suspicious widths
2026-06-18 09:13:53 +08:00
BogdanandGitHub 8cd463383d fix(lsp): throttle diagnostic storms (#1698)
* fix(lsp): throttle diagnostic storms

* fix(lsp): account for capped storm diagnostics
2026-06-18 09:03:43 +08:00
BogdanandGitHub 916f2477f3 fix(warnings): surface perf hooks buffer guidance (#1696) 2026-06-18 08:59:36 +08:00
BogdanandGitHub df986c9275 fix(messages): make projections tool-pair safe (#1695) 2026-06-18 08:59:05 +08:00
BogdanandGitHub e5cb589031 security(status): redact proxy and TLS-sensitive values in /status (#1672)
* security(status): redact proxy and TLS-sensitive values in /status

Make /status safe to share in public issues and screenshots by ensuring
proxy credentials, mTLS private key/cert paths, CA bundle paths, and
token-bearing URLs are never printed verbatim.

- Proxy URL: wrap with redactUrlForStatus (reuses redactUrlForDisplay
  for credential + sensitive query-param masking; additionally strips
  the URL fragment, which can carry tokens).
- NODE_EXTRA_CA_CERTS / CLAUDE_CODE_CLIENT_CERT: wrap with
  redactPathForStatus, which shortens a leading $HOME to ~ so paths
  stay useful without leaking usernames or home directory layout.
- CLAUDE_CODE_CLIENT_KEY: show the literal 'configured' rather than
  the path or value of a private key.

Adds two small reusable helpers in src/utils/statusRedaction.ts plus
unit tests, and extends status.test.ts with an integration test that
asserts the full buildAPIProviderProperties output is leak-free when
proxy credentials and mTLS env vars are set.

* fix(status): address status redaction review feedback

* fix(status): redact provider base URL secrets

* fix(status): unify URL status redaction
2026-06-18 08:53:31 +08:00
BogdanandGitHub 5af6f95c46 feat(config): add explicit provider env-file loading (#1668)
* feat(config): add explicit provider env-file loading

* fix(config): handle escaped quotes in provider env files

* fix(config): polish env-file parser review feedback

* fix(config): preserve provider env-file precedence

* test(config): cover provider env-file precedence

* fix(config): preserve provider env-file values

* fix(config): allow documented env-file setup vars

* fix(config): preserve provider flag precedence
2026-06-18 08:51:59 +08:00
BogdanandGitHub 4cf981200f feat(cache): classify prompt-cache breaks by reliability (#1693)
* feat(cache): classify prompt-cache breaks by reliability

* fix(cache): stabilize prompt-cache break metadata detection

* fix(cache): honor legacy OpenAI base fallback

* fix(cache): normalize OpenAI base URL hints

* fix(cache): align cache-break provider flag truthiness

* fix(cache): ignore undefined OpenAI base hints

* fix(cache): sanitize prompt cache route labels
2026-06-18 08:42:41 +08:00
BogdanandGitHub beab67b44a fix(session-title): harden generated title handling (#1691)
* fix: harden session title generation

* fix(session-title): preserve prompt fallbacks after generation failure

* fix(session-title): address fallback review findings
2026-06-18 08:41:31 +08:00
BogdanandGitHub 23cfc242ed fix(query): add activity-aware query guard leases (#1686)
* fix(query): add activity-aware query guard leases

* test(query): cover tool query activity lifecycle

* fix(shell): align runtime and lease timeouts

* fix(query): cap shell timeouts to query budget
2026-06-18 08:38:37 +08:00
BogdanandGitHub 544b857876 fix(settings): correct stale settings path references (#1666)
* fix(settings): correct OpenClaude settings paths

* fix(settings): address review path clarity

* fix(sandbox): protect OpenClaude settings in changed cwd
2026-06-17 11:44:03 +08:00
BogdanandGitHub 29aea4969d fix(provider): centralize provider secret redaction (#1665)
* fix(provider): centralize provider secret redaction

* fix(system-check): prefer base URL route credentials

* fix(provider): avoid false credential matches

* fix(provider): redact jwt-shaped tokens

* fix(provider): redact embedded diagnostic secrets

* test(system-check): isolate provider env keys
2026-06-17 11:23:15 +08:00
BogdanandGitHub a1b3346f65 feat(cli): add local background sessions (#1642)
* feat(cli): add local background sessions

Add local detached background sessions backed by an OpenClaude-owned registry under the resolved config directory.

- implement --bg spawning plus ps, logs, logs -f, kill, and an explicit attach limitation
- harden registry metadata validation, atomic writes, ID/name collision handling, and terminal-name reuse
- precreate child log files with precise ownership cleanup and register metadata only after spawn succeeds
- verify live PIDs against the session command before treating registry entries as running
- wait for process-tree termination and escalate to SIGKILL before marking sessions killed
- skip live local background sessions during --continue transcript selection
- preserve Node heap flags for detached children while avoiding stale launcher relaunch state
- handle -- separators so dash-prefixed prompts remain positional
- document storage, safety model, name reuse, and the current attach limitation

Validation:
- bun test
- bun run typecheck
- bun run smoke
- isolated built-CLI --bg/ps/logs/kill smoke
- CodeRabbit review findings addressed

* test(utils): prevent bg registry mock leakage

Restore complete bg registry and UDS module mocks after conversation recovery tests so Bun's process-global mock.module registry cannot leak partial module exports into later CLI tests.

CI exposed this under Bun 1.3.13 when conversationRecovery.test ran before the bgRegistry and bg CLI test files.

* test(utils): exercise bg registry without global mock

Replace the conversation recovery bgRegistry module mock with real registry metadata backed by a short-lived live child process. This keeps UDS as the only mocked boundary and avoids leaking a mocked registry module into later CLI registry tests under Bun 1.3.13.

* test(utils): isolate background registry state

Stop the conversation recovery test from using process-wide bgRegistry mocks or real child processes by injecting the live-session dependencies directly.

Pin and serialize the bg registry test config directory through the shared env mutation lock so path/cache state cannot leak from neighboring tests under Bun CI ordering.

* test(utils): document Bun mock restoration

Explain why conversation recovery tests re-register full module exports after mock.restore(), matching the CodeRabbit-requested Bun 1.3.13 isolation workaround.

* test(cli): isolate background registry root

Avoid relying on process-wide CLAUDE_CONFIG_DIR state in bgRegistry tests. Use a registry-local test root override so CI file ordering and mocked path modules cannot redirect background session metadata into another test's temp directory.

* test(utils): cover live session fallback paths

Add focused coverage for collectLiveBackgroundSessionIds when UDS discovery fails but registry data remains available, and when registry refresh fails but UDS data remains available.

* fix(cli): harden background session management

Validate persisted and newly-created background session PIDs before exposing them to management commands.

Reserve named live sessions with an atomic registry write, release reservations when sessions become terminal, and cover concurrent duplicate-name attempts.

Split local session management dispatch from background spawning so ps/logs/attach/kill avoid provider startup while --bg still inherits profile routing.

* fix(cli): address background session review findings

Preserve positional prompts when --bg is combined with optional-value flags such as --debug.

Recover stale name reservations whose owner metadata is missing or terminal while preserving in-flight reservations from live creators.

Cover both reviewer findings with focused parser and registry regression tests.

* fix(cli): respect delimiter for background flags

Limit background and print-mode flag detection to arguments before the -- delimiter so flag-shaped prompts remain positional.

Keep optional resume/from-pr flags out of the required-value table and add regressions for delimiter and optional-flag prompt handling.

* refactor(cli): share delimiter argument helper

Move args-before-delimiter handling into the existing dependency-free CLI args utility.

Use a dynamic import from the entrypoint so background flag routing shares the helper without adding top-level module load to version and management fast paths.

* test(cli): cover background entrypoint routing

Export the CLI entrypoint for controlled tests and add isolated importer injection so runtime routing tests do not leak global module mocks.

Replace the delimiter source-layout assertion with execution-level coverage for management commands, real background flags, and flag-shaped prompt text after --.

* fix(cli): preserve background resume selectors

Keep space-separated --resume, -r, and --from-pr values attached when building background child args.

Mark live background sessions stale when PID command identity cannot be read, avoiding termination of reused unrelated PIDs.

* fix(cli): track unknown background session identity

Represent unreadable live PID identity as a non-terminal unknown state so active sessions stay excluded from resume selection.

Refuse to terminate unknown live PIDs because the process command cannot be positively matched to the background session.

* fix(cli): honor background resume selectors

Avoid adding a generated --session-id to non-forked background resume launches so the spawned print-mode child satisfies the existing resume/session-id contract.

Pass --from-pr through headless print mode and resolve PR-linked sessions through the shared conversation recovery path.

Add regression coverage for background resume launch args and PR selector matching.

* fix(cli): treat PR resume as headless resume source

Include --from-pr in print-mode resume guards so PR-linked headless resumes can run without a prompt and share resume-only options.

Skip eager startup hooks for headless PR resumes and add explicit --session-id launch coverage.

* fix(cli): keep background PR resumes live

Resolve non-forked --from-pr background launches to the selected transcript id before writing registry metadata.

Preserve PID identity refresh for PR-resume children by matching the stored invocation when argv does not carry the transcript id.

Add regressions for launch registration and registry refresh.

* test(cli): cover PR resume lookup failures

Add regression coverage for non-forked background --from-pr launches when the selector cannot be resolved.

Verify the launch planner returns the same clear error used by handleBgFlag().
2026-06-17 11:09:23 +08:00
BogdanandGitHub c74397cd2f chore(gitignore): ignore local worktree directories (#1681) 2026-06-17 10:54:37 +08:00
BogdanandGitHub bd3ad89dd7 fix(security): bundle real sandbox runtime in open CLI (#1641)
* fix(security): bundle real sandbox runtime in open CLI

* test(sandbox): cover fail-closed runtime diagnostics

* fix(sandbox): report doctor inspection failures
2026-06-16 08:42:48 +08:00
BogdanandGitHub 7c034c5a62 feat: add redacted diagnostic issue reports (#1647)
* feat: add redacted diagnostic issue reports

* fix: address diagnostic report review feedback

* fix: report Codex runtime diagnostics accurately
2026-06-16 08:41:18 +08:00
BogdanandGitHub d8dbf274b4 chore(runtime): align Node.js minimum version (#1644)
* chore(runtime): align Node.js runtime requirements

* test(runtime): cover prefixed Node versions

* fix(runtime): check node executable in doctor
2026-06-16 06:55:17 +08:00
BogdanandGitHub 7448be1164 [codex] chore(query): add tool-pairing diagnostics (#1625)
* chore(query): add tool-pairing diagnostics

Add a pure validator for tool_use/tool_result pairing issues and feed phase, query source, model, provider, and agent context into the existing pre-API repair log. Keep ensureToolResultPairing behavior intact while making future repair logs identify missing, orphaned, duplicate tool_use, and duplicate tool_result cases.

* fix(query): complete pairing diagnostics coverage

Address CodeRabbit review by detecting server-side tool use blocks without matching in-message results and by making pairing validation lazy so it only runs after the repair path has actually mutated messages.
2026-06-15 09:38:21 +08:00
BogdanandGitHub 9a72ecd25c [codex] fix(tokens): fallback when provider lacks countTokens (#1624)
* fix(tokens): fallback when provider lacks countTokens

* test(tokens): isolate shim fallback coverage

Avoid process-wide api client mocks in token estimation tests by exercising the count-token dispatch helper directly. Add non-empty tool coverage for the rough fallback path so the local overhead remains covered.
2026-06-15 09:35:43 +08:00
BogdanandGitHub 174ebd5125 [codex] fix(query): abort active work on QueryGuard timeout (#1623)
* fix(query): abort active work on QueryGuard timeout

* fix(query): contain timeout handler failures

* test(query): harden timeout handler cleanup

* test(query): centralize QueryGuard timer cleanup
2026-06-15 09:34:42 +08:00
BogdanandGitHub 9fbcd755a3 fix(mcp): demote successful stdio startup stderr (#1622) 2026-06-15 09:33:21 +08:00
BogdanandGitHub 5fd4a09d01 fix(read): improve oversized file guidance (#1626) 2026-06-15 09:32:21 +08:00
BogdanandGitHub 4e56fd5921 [codex] perf(skills): cap skill listing budget (#1627)
* perf(skills): cap skill listing budget

* chore(skills): export listing budget options
2026-06-15 08:44:53 +08:00
BogdanandGitHub 3752dfe6f7 fix(typecheck): recreate missing CLI Transport interface (#1581)
* fix(typecheck): recreate missing CLI Transport interface

* fix(transports): implement async close in CLI transports

* fix(transports): harden async close cleanup

* fix: address async transport close review feedback

* test: isolate environment-sensitive suites

* fix(transports): drain uploader after close failure

* fix(transports): type guard CCR stream events

* test: remove unused auto-compact fixture helper
2026-06-12 15:17:56 +08:00
BogdanandGitHub bb19392e69 fix(typecheck): expand cachedMicrocompact stub exports (#1591)
* fix(typecheck): expand cachedMicrocompact stub exports

The cachedMicrocompact module is a feature-gated stub that only exported
3 functions, but microCompact.ts expected 10+ exports including types and
state management functions.

Changes:
- Add missing type exports: CachedMCState, CacheEditsBlock, PinnedCacheEdits, CachedMCConfig
- Add missing function stubs: createCachedMCState, markToolsSentToAPI, resetCachedMCState, registerToolResult, registerToolMessage, getToolResultsToDelete, createCacheEditsBlock
- Add null guard in cachedMicrocompactPath for config
- Add comprehensive tests for stub behavior

Resolves 15 typecheck errors in microCompact.ts:
- TS2694: Namespace has no exported member (10 errors)
- TS2339: Property does not exist (5 errors)
- TS18047: possibly null (2 errors)

Testing:
- bun test src/services/compact/cachedMicrocompact.test.ts: 7/7 pass
- bun test src/services/compact/: 61/61 pass
- bun run smoke: pass
- Typecheck errors: 697 → 682 (-15)

* fix(typecheck): address CodeRabbit review feedback

- Add missing fields to CachedMCConfig type: enabled, supportedModels,
  systemPromptSuggestSummaries (used by prompts.ts and claude.ts)
- Replace silent fallback with explicit error throw in cachedMicrocompactPath
  to enforce the invariant that isCachedMicrocompactEnabled() === true implies
  getCachedMCConfig() !== null, preventing potential recursion in future
  non-stub implementations

* test: prevent CI state leaks
2026-06-10 21:56:01 +08:00
BogdanandGitHub 794ccd4f9e fix(typecheck): correct fetch mock type casts in test files (#1592)
* fix(typecheck): correct fetch mock type casts in test files

Test files were casting mock functions to 'typeof fetch' but the mock
signatures didn't match the full fetch type (missing init parameter,
wrong return type, etc.), causing TS2352 errors.

Changes:
- Use double-cast pattern: 'as unknown as typeof fetch' or 'as unknown as FetchType'
- Remove unused @ts-expect-error directive in providerDiscovery.test.ts
- Applied consistently across 6 test files

Files modified:
- src/utils/providerDiscovery.test.ts (11 errors fixed)
- src/services/api/openaiShim.test.ts (9 errors fixed)
- src/tools/firecrawl/client.test.ts (5 errors fixed)
- src/utils/apiPreconnect.test.ts (4 errors fixed)
- src/services/api/codexOAuth.test.ts (2 errors fixed)
- src/services/api/fetchWithProxyRetry.test.ts (1 error fixed)

Testing:
- bun test [all 6 files]: 154/154 pass
- bun run smoke: pass
- Typecheck errors: 682 → 664 (-18)

* chore: trigger CI re-run (flaky test investigation)
2026-06-10 21:55:14 +08:00
BogdanandGitHub 9db9427f29 fix(typecheck): reduce error baseline by 89 across 8 files (#1595)
* fix: resolve 28 typecheck errors in openaiShim.ts

Add null guards for nullable `reader`, `response`, and `responsesResponse`
variables, and use type assertions to bridge Node vs Web ReadableStream
type mismatches in stream processing helpers.

* fix(typecheck): resolve 17 errors in agentSdkTypes.ts

- Add @ts-expect-error for settingsTypes.generated.js (generated at build time)
- Fix type imports: redirect 5 types from ./sdk/runtimeTypes.js to ./sdk/shared.js
- Remove 11 unused type imports that don't exist (AnyZodRawShape, InferShape, etc.)

* fix(typecheck): resolve 26 errors in openaiShim.ts — nullable guards, ReadableStream types

* fix(typecheck): resolve 23 errors in messages.ts + groupToolUses.ts

MessageWithoutProgress resolved to `never` because all message types are
`any` stubs, making `Exclude<any, any>` = `never`. Widen types and use
boolean wrappers to avoid type-predicate narrowing. Add missing return
in getToolUseID switch statement.

* fix(typecheck): resolve 14 errors in toolExecution.ts — fix never[] inference

* fix(typecheck): resolve type errors in claude.ts

- Cast nested block params to BetaContentBlockParam for SDK type union mismatch
- Add missing CACHE_EDITING_BETA_HEADER constant to betas.ts
- Type-assert getCachedMCConfig() return for supportedModels access
- Add missing imports: getContextWindowForModel, COMPACT_MAX_OUTPUT_TOKENS, getSdkBetas
- Fix model variable reference to use options.model in compact context
- Add optional signature property to ConnectorTextBlock type

* ci: re-trigger checks

* fix: address CodeRabbit review feedback

- Throw error instead of silent return when response body is not readable
- Clamp hybrid context budget to non-negative floor (Math.max(0, ...))
- Remove unused isResult wrapper in messages.ts
2026-06-10 21:54:37 +08:00
60b7215785 chore(tests): fix flaky and environment-dependent unit tests (#1582)
* chore(tests): fix flaky and environment-dependent unit tests

- Mock fs.existsSync in geminiAuth tests to prevent real ADC reads
- Isolate runtimeMetadata tests from local environment variables
- Add shared mutation lock to sessionStorage tests to prevent env race conditions

* test: address environment cleanup review

* test(autoCompact): guard temp-dir cleanup against setup-time failures

If beforeEach throws before tempDir is assigned (e.g. lock acquisition or
mkdtempSync fails), afterEach's unconditional rmSync(tempDir) threw a
TypeError and masked the original failure. Type tempDir as string | undefined
and skip removal when unset, mirroring the savedAutoCompactEnabled reset.

Addresses CodeRabbit review on PR #1582.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>

---------

Co-authored-by: Kevin Codex <kevin@gitlawb.com>
Co-authored-by: OpenClaude <openclaude@gitlawb.com>
2026-06-10 09:46:54 +08:00
BogdanandGitHub 553342c204 fix(typecheck): recreate missing Spinner types (#1579) 2026-06-10 09:04:19 +08:00
BogdanandGitHub fba949cabf fix(typecheck): type FileWrite rejection state (#1574) 2026-06-10 09:01:57 +08:00
BogdanandGitHub e6ce1037fe refactor(open-build): remove Ant employee gates (#1576)
* refactor(open-build): remove Ant employee gates

* fix(open-build): address gate-removal review feedback

* fix(open-build): address follow-up review findings

* fix(hooks): remove stale remote fallback status

* fix(open-build): keep pending background tasks visible

* test(open-build): cover task footer hiding
2026-06-10 09:01:26 +08:00
BogdanandGitHub 62c2c5b62f fix(typecheck): recreate missing FeedbackSurvey utils (#1580) 2026-06-10 08:57:00 +08:00
BogdanandGitHub 7727a9f3a3 fix(typecheck): narrow remote agent SDK logs (#1573) 2026-06-10 08:55:32 +08:00
BogdanandGitHub c2cc6ed333 fix(typecheck): type gRPC stream messages (#1572) 2026-06-10 08:54:54 +08:00
BogdanandGitHub 38b2d83699 fix(typecheck): declare Ink JSX intrinsics (#1571) 2026-06-10 08:53:52 +08:00
BogdanandGitHub bf2d540efc fix(typecheck): type MCP XAA auth storage (#1570) 2026-06-10 08:53:07 +08:00
BogdanandGitHub 499c702bce fix(typecheck): type stats dialog state (#1569) 2026-06-10 08:50:55 +08:00
BogdanandGitHub e53d612da5 fix(typecheck): annotate diff rendering props (#1568) 2026-06-10 08:50:14 +08:00
BogdanandGitHub 6ee24f78e7 fix(typecheck): tighten permission rule UI types (#1567) 2026-06-10 08:50:03 +08:00
BogdanandGitHub 65034db367 fix(typecheck): add wizard agent creation types (#1566)
* fix(typecheck): add wizard agent creation types

* fix(typecheck): guard agent wizard state
2026-06-10 08:49:03 +08:00
BogdanandGitHub fc0a4b5cdf fix(typecheck): add plugin command view types (#1565)
* fix(typecheck): add plugin command view types

* fix(typecheck): simplify plugin settings update
2026-06-10 08:48:28 +08:00
BogdanandGitHub 548bffc2a7 fix(typecheck): add MCP component view types (#1564) 2026-06-10 08:48:05 +08:00
BogdanandGitHub f129dd0397 fix(typecheck): declare optional native modules (#1563)
* fix(typecheck): declare optional native modules

* fix(typecheck): self-contain computer-use declarations
2026-06-10 08:47:36 +08:00
BogdanandGitHub 5c239eb601 fix(typecheck): declare bundled markdown and macro fields (#1562)
* fix(typecheck): declare bundled markdown and macro fields

* fix(build): define version changelog macro
2026-06-10 08:44:06 +08:00
BogdanandGitHub 491985a618 fix(typecheck): type session storage test fixtures (#1526)
* fix(typecheck): type session storage test fixtures

* fix(typecheck): align snip boundary fixture ids
2026-06-10 08:41:47 +08:00