Commit Graph
4909 Commits
Author SHA1 Message Date
chengyongru 559107172a fix(webui): hide recovery notice while resumed tasks run
Render recovery decisions only for awaiting_user and failed states so a reload cannot resurrect a resuming banner. Preserve the runtime recovery state and normal running controls.

Refs NAN-260
2026-10-16 18:25:40 +08:00
chengyongru 8f6a5594fb refactor(session): centralize state ownership in SQLite (#5943)
* fix(session): move persistence off event loop

* refactor(session): isolate async persistence boundary

* refactor(session): keep a single session manager

* refactor(session): use stateless async adapters

* fix(session): serialize local persistence without file-lock contention

* refactor(session): own async persistence and snapshot commits

* refactor(session): narrow persistence changes to async adapters

* refactor(session): remove redundant async forwarding helpers

* fix(command): offload compact session persistence

* fix(session): adapt idle compaction to current main

* fix(webui): offload session metadata persistence

* refactor(session): centralize state ownership in SQLite

* fix(session): skip storage for non-recoverable followups

* test(webui): honor the full gateway event deadline

* perf(session): persist incremental changes and reuse owner snapshots

* test(agent): allow durable worker shutdown in burst test

* fix(gateway): drain session storage on Windows console shutdown

* fix(session): enforce bounded ownership and lifecycle-safe persistence

* fix: reject unresolved home paths and stabilize platform tests

* fix(session): preserve request context compatibility and owner-backed tests

* docs: focus configuration guide on user-facing behavior

* fix(session): adapt goal admission to async ownership after rebase

* fix(session): integrate current gateway and subagent contracts

* fix(session): align rebased workspace admission and async tests

* fix(session): support compatible SQLite schema evolution

* test(agent): use session owner in workspace context regressions

* test: stabilize Windows lifecycle and browser checks

* refactor(session): remove premature JSONL file export

* ci: bound Windows full-suite worker concurrency

* chore: remove session state refactor notes

* fix(session): queue writes and retain worker connections

* perf(webui): read detached metadata for session and task lists

* perf(agent): bound prompt preparation and local token counting

* docs: remove internal session storage guide

* perf(session): skip archived transcripts during idle scans

* fix(session): coordinate turns and isolate legacy session data

Bind WebUI input generations to the execution session and serialize idle
and SDK compaction with turns. Keep turn drafts through preparation so the
latest channel route persists.

Move imported workspace JSONL and checkpoints to durable private backups
before gateway admission, resuming cleanup after interruptions. Remove
committed child sessions when task creation is cancelled.

Validation: focused Python and frontend regressions, Ruff, BasedPyright,
import boundaries, WebUI build, and isolated gateway/browser flows.

* fix(agent): keep cancellation hooks independent of prompt preparation

* fix(session): preserve admission, delivery, and migration contracts

* fix(agent): preserve cancellation settlement after rebase

* fix(session): preserve request attribution through async ownership
2026-10-16 17:28:47 +08:00
chengyongru 33ff520d12 fix: preserve subtask request attribution after restart (#6247)
* fix: preserve request origin across recovery continuations

* fix: bind request origin to each continuation

* fix: capture origin when queuing continuation messages

* chore: remove redundant request context comment

* fix: persist origin for independent system turns
2026-10-16 16:46:39 +08:00
hazelxue 6d84786efa Require dulwich>=0.24.0: GitStore.diff_commits uses porcelain.diff
porcelain.diff only exists from dulwich 0.24.0 (0.22.x and 0.23.x have
init/add/commit/status but not diff). On the declared floor every call to
GitStore.diff_commits / show_commit_diff raised GitStoreError, and the
dream line-ending test failed for the same reason. tests/agent/test_git_store.py
and tests/agent/test_dream.py pass with 0.24.0 and the other dependencies
still at their minimum versions.
2026-10-16 16:01:15 +08:00
Willow Lopezandchengyongru d2aaa8e54b fix(webui): preserve sidebar state after failed initial fetch (#6009)
* fix(webui): wait for sidebar state before persisting edits

* test(webui): load sidebar state in temporary chat fixtures

* fix(webui): preserve sidebar pushes during initial reads

* fix(webui): require successful session reads before pruning

Treat sidebar initialization and session-list completeness as separate permissions. Retain sidebar metadata, workbench panes, activity markers, and workspace overrides when the session list fails or only a partial reload cache is available.

Add integration coverage for recovery with and without cached sessions, successful deletion reconciliation, and successful empty session lists.

* test(webui): align sidebar recovery fixture with current schema

Remove obsolete preview and timestamp settings from the raw API fixture. Assert supported view preferences while retaining exact metadata and workbench comparisons.

---------

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-10-16 15:47:15 +08:00
chengyongru f101a24571 refactor(cli): use Questionary for onboarding selection (#6251)
* fix(cli): require compatible terminal prompt dependencies

Require prompt-toolkit 3.0.52 for Windows VT100 input flushing and Questionary 2.1.1 for compatibility with its prompt layout. Keep the existing major-version bounds and Python minimum.

* refactor(cli): use Questionary for onboarding selection

Delegate menu navigation, selection and scrolling to questionary.select. Retain the existing back/cancel contract, palette and position feedback through a thin adapter and exercise real prompt keyboard behavior instead of viewport arithmetic.
2026-10-16 15:34:49 +08:00
chengyongru 67248790c7 test(shell): remove scheduling race from partial-byte idle check 2026-10-16 15:05:56 +08:00
chengyongru e4fc8788c4 refactor(providers): remove duplicate chat response parsers 2026-10-16 15:05:56 +08:00
chengyongru 0d09b3dc09 perf(webui): avoid subtree style invalidation while typing 2026-10-16 15:00:38 +08:00
chengyongru b8df1f0418 refactor(settings): preserve domain controller objects 2026-10-16 14:57:33 +08:00
chengyongru 0d1beac3aa refactor(webui): centralize client run lifecycle state 2026-10-16 14:54:37 +08:00
chengyongru 6f04038d21 fix(webui): preserve custom shell runtime editing 2026-10-16 14:09:55 +08:00
chengyongru 3ccc181d29 fix(webui): load history for running sessions 2026-10-16 14:07:10 +08:00
chengyongru 6310a39bac fix(shell): separate wait, idle, and runtime limits (#6228)
* fix(shell): separate wait, idle, and runtime limits

* fix(shell): separate wait, idle, and runtime limits

* fix(exec): preserve settings aliases and reclaim completed sessions

* fix(webui): make shell runtime limits explicit
2026-10-16 13:44:15 +08:00
chengyongru 70ac000ad9 fix(webui): space other tasks from following messages 2026-10-16 13:40:14 +08:00
chengyongru 836092424d fix(webui): resume queued prompts after turn completion (#6242)
* fix(webui): resume queued prompts after turn completion

Persist the lifecycle turn each queued prompt waits for and use canonical completion identities to resume after navigation or reconnect. Release one entry at a time, and retain stopped or rejected entries for manual sending.

* fix(webui): drain temporary chat prompts on live completion

* perf(webui): resume queued prompts from live completion
2026-10-16 13:33:41 +08:00
chengyongru 3abcfe70c5 perf(agent): prepare prompts outside the event loop (#6224)
* perf(agent): prepare prompts outside the event loop

* fix(agent): preserve cancellation during run cleanup

* refactor(agent): clarify prompt preparation boundaries

* revert(agent): restore original prompt preparation structure

This reverts commit 484cb96a08bf3a805f5828d5a65316be7decaaa5.
2026-10-16 13:16:13 +08:00
chengyongru fdeda8a468 fix(webui): reconcile turns after reconnect (#6211)
* fix(webui): reconcile turns after reconnect

* perf(webui): bound reconnect recovery and index turn reconciliation

* refactor(webui): simplify reconnect reconciliation

* fix(webui): preserve turn authority during recovery

* fix(webui): validate canonical completion identities
2026-10-16 11:38:05 +08:00
chengyongru aeca1c0f1a fix(webui): avoid blocking the gateway on skill loading 2026-10-16 11:21:28 +08:00
chengyongru a721eb8476 fix(webui): keep sheet close focus rings keyboard-only 2026-10-16 10:34:38 +08:00
chengyongru 31b193236f fix(cli): reject misplaced gateway instance selectors (#6229)
* fix(cli): inherit gateway instance selectors in subcommands

* fix(cli): reject misplaced gateway instance selectors

* test(cli): strip ANSI styling from gateway usage assertions
2026-10-16 01:24:50 +08:00
akinolurandchengyongru 9d2762a4f1 feat(provider): langfuse tracing for codex (#5520)
* feat: trace Codex requests via Langfuse native SDK

Codex has no OpenAI SDK client for Langfuse's usual swap trick, so
log one generation per request through langfuse's native SDK
instead. Tracing failures never affect the returned Codex response.

* docs: note Codex Langfuse tracing support

* fix: trace every Codex request, close every generation

- Move the Langfuse generation inside _send so the compaction
  sub-request gets its own trace too, not just the main request.
- Derive traced model/input from the wire body (post extra_body
  override, post response-item-ID stripping) instead of the
  pre-normalized one.
- Wrap package detection in the same try/except as the SDK call, so
  a broken find_spec() can't turn a valid Codex request into an error.
- Make generation finalization idempotent and cancellation-safe via
  try/except/else/finally, so update() failures or a cancelled
  request no longer leave a generation open.
- Add tests for compaction tracing, update() failures, and
  cancellation.

* docs: fix cli-reference.md langfuse plugin row

* fix: don't trace a rejected compaction as success

- Add a validate hook to _send so a transport-successful compaction
  reply with no usable item traces as an error, not a success.
- Add regression tests for a find_spec() failure, for the traced
  model/input matching the actual wire body (extra_body override,
  ID-stripped replayed items), and for the rejected-compaction case.

* fix: convert LLMUsage to dict for Langfuse usage_details

LLMResponse.usage is now the LLMUsage dataclass upstream, not a
plain dict - Langfuse's usage_details param needs the latter.

* fix: satisfy basedpyright strict on compaction items

* fix(providers): normalize Codex Langfuse cache usage

* fix(providers): migrate Langfuse tracing to SDK 4

---------

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-10-16 00:44:17 +08:00
cristianchiriac a148eabc9f fix(cli): set SPT_NOENV only on Linux
SPT_NOENV only keeps the title out of /proc/PID/environ on Linux. On macOS
it confines the title to the argv area, where setproctitle drops the last
byte, and its import-time getproctitle() then fails to decode a command
line ending in a multibyte character, so every such CLI call crashed.

Fixes #6231
2026-10-16 00:17:47 +08:00
chengyongru 12e869d047 refactor(skills): shorten built-in skill descriptions 2026-10-16 00:15:55 +08:00
chengyongru 4fa125e134 fix(exec): filter terminal control sequences from shell output 2026-10-16 00:11:21 +08:00
chengyongru 32f5cc76a4 fix(agent): trim redundant system prompt context 2026-10-16 00:01:24 +08:00
chengyongru 841d2b880c fix(agent): make tool error guidance neutral (#6227)
* fix(agent): make tool error guidance neutral

* refactor(tools): share tool error guidance
2026-10-15 16:58:39 +08:00
chengyongru c24153db86 fix(ui): keep theme text and selections readable (#6226)
* fix(ui): keep theme text and selections readable

* fix(tui): theme the blank composer cursor cell

* refactor(webui): centralize diff theme colors

* fix(tui): keep conversation selections readable

* fix(ui): preserve nested syntax colors and selection lifetimes
2026-10-15 15:21:28 +08:00
chengyongru 73c2441abc fix(gateway): retain tasks for staged signal shutdown 2026-10-15 11:50:22 +08:00
chengyongru 7177ca05e3 perf(providers): estimate missing usage outside the event loop 2026-10-15 11:48:13 +08:00
chengyongru e604c23fca fix(sdk): validate imported messages before session changes 2026-10-15 10:54:12 +08:00
chengyongru c58bfa71bc perf(agent): skip transcript snapshots without run hooks 2026-10-15 10:48:59 +08:00
chengyongru 2ad0da786d fix(session): serialize compaction with active turns 2026-10-15 10:43:02 +08:00
chengyongru 1d43b46e54 fix(exec): reject shell paths with unresolved home directories 2026-10-15 09:51:53 +08:00
chengyongru af6abde2f4 fix(skills): bind plugin snapshots to approved content (#6225)
* fix(skills): bind plugin snapshots to approved content

* fix(skills): preserve plugin document newline normalization
2026-10-15 09:41:37 +08:00
chengyongru 3a28b9e6ce perf(agent): reuse skill discovery within each prompt 2026-10-15 01:47:06 +08:00
chengyongru 1a77d8fc66 fix(webui): give media gallery components distinct examples 2026-10-15 01:11:22 +08:00
chengyongru 152abe7949 feat(webui): expand MCP service presets (#6216)
* feat(webui): expand MCP service presets

* refactor(webui): load MCP presets from JSON

Validate and package the static service catalogue while preserving existing preset definitions. Pass Redis connection URLs through the official CLI option to retain target, TLS, database, and credential settings.

* docs(mcp): include all built-in service presets
2026-10-14 22:41:55 +08:00
chengyongru a482281092 fix(webui): remove subtask polling and load error UI (#6212)
* fix(webui): stop subtask reads when gateway disconnects

* refactor(webui): limit subtask change to polling removal

* fix(webui): hide subtask load errors after disconnect

* fix(webui): remove subtask load error UI

* refactor(webui): keep subtask refresh fix focused
2026-10-14 18:02:03 +08:00
Kail Tian 3881ed7dd1 fix(providers): preserve supported Kimi K3 reasoning efforts 2026-10-14 18:00:21 +08:00
chengyongru 790a970989 perf(webui): stream bounded file diff previews 2026-10-14 17:49:25 +08:00
chengyongru 2d62d99038 fix(webui): restore and synchronize live activity sheen 2026-10-14 16:25:12 +08:00
David KlaperandCopilot 2732e2b3ce fix(webui): send same-origin cookies with uploads
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-14 16:12:50 +08:00
chengyongru 061b19afe1 fix(webui): require double tildes for strikethrough 2026-10-14 14:56:03 +08:00
chengyongru cdb6210b45 refactor(webui): remove session list previews and timestamps (#6189)
* refactor(webui): remove session list previews and timestamps

* test(webui): limit legacy coverage to persisted sidebar files

* refactor(webui): simplify chat rows and fix gallery states

* refactor(webui): flatten chat row title wrapper
2026-10-14 14:41:52 +08:00
chengyongru 47f600afc6 refactor(transcription): share JSON request retries 2026-10-14 14:35:08 +08:00
chengyongru bdb6c369d0 fix(webui): prevent equation tags from overlapping formulas 2026-10-14 14:32:14 +08:00
chengyongru 74b22b6522 refactor: deduplicate durable writes and file-edit path resolution 2026-10-14 14:12:48 +08:00
chengyongru 4497f7ef24 refactor: remove unused internal code and styles 2026-10-14 10:50:16 +08:00
chengyongru 6b90e400e4 refactor(tools): streamline built-in tool descriptions (#6201)
* refactor(tools): streamline built-in tool descriptions

* refactor(tools): retain actionable schema details
2026-10-14 10:34:07 +08:00