Commit Graph
73 Commits
Author SHA1 Message Date
chengyongru 2b44088413 refactor(commands): own trusted Shell completion outside agent loop 2026-11-05 16:39:09 +08:00
chengyongruandchengyongru 62c2ed4e7e refactor(goal): sustain one ReAct run until the goal closes (#6538)
* refactor(goal): sustain one ReAct run until the goal closes

Keep active goals in the same runner beyond the ordinary iteration limit, with a final answer after successful closure. Remove cross-turn goal handoffs, continuation allowances and rollback bookkeeping while preserving input authorization, recovery, cancellation and terminal lifecycle ownership.

Contributes to NAN-392

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>

* test(goal): consolidate sustained-run regression coverage

Retain lifecycle, history, usage, provider-state privacy and checkpoint cancellation assertions in the existing long-run scenarios. Remove duplicate smoke cases and parameter combinations that do not exercise distinct behavior; keep real Gateway, authorization and generation regressions.
2026-11-03 22:47:00 +08:00
chengyongru a4d2430140 refactor: remove redundant comments and docstrings (#6527)
* refactor: remove redundant comments and docstrings

* fix(signal): annotate async context manager as a generator
2026-10-30 13:07:03 +08:00
chengyongru 8af6313c56 fix(webui): refresh pairing prompts on gateway changes (#6401) 2026-10-25 20:16:51 +08:00
lenin 9650f4fd5b fix(agent): recheck idle expiry after acquiring session lock
Reload settled activity inside the existing session lock before an idle
archive delegates to the consolidator. A fresh turn restarts the idle
interval; manual compaction keeps its existing behavior.

Cover both scheduling orderings and later genuine idleness, and give
existing direct idle-archive fixtures explicit idle preconditions.
2026-10-25 13:18:39 +08:00
chengyongru abfe510ce1 test: remove unreachable cases and strengthen weak assertions 2026-10-22 17:19:20 +08:00
chengyongru bc5c58d239 feat(webui): distinguish context compaction reasons (NAN-324) (#6389)
* feat(webui): distinguish context compaction reasons (NAN-324)

* fix(webui): describe idle compaction cancellation as interruption

* docs: omit compaction notice details from configuration guide

* fix(i18n): make compaction notices read naturally

* fix(i18n): keep CJK compaction notices concise

* fix(i18n): describe idle compaction as unfinished
2026-10-22 16:13:25 +08:00
chengyongru 26e1f41a00 fix(exec): yield long-running commands by default (NAN-328) (#6385)
* fix(exec): yield long-running commands by default (NAN-328)

* test(exec): avoid waiting for already observed output

* test(exec): observe hard-timeout cleanup before asserting completion
2026-10-22 13:27:26 +08:00
chengyongru 74942bd190 test: replace false-green checks with behavioral coverage (#6282)
* test: replace false-green checks with behavioral coverage

* test: complete behavior-focused audit coverage
2026-10-18 03:16:25 +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 67742b2880 refactor(command): declare session queue policy at registration (#6170)
* refactor(command): distinguish handled commands without replies

* refactor(command): declare session queue scheduling at registration
2026-10-12 13:38:14 +08:00
Xubin Ren a27f294f52 perf(agent): trim workspace access context without changing scope 2026-10-11 17:06:39 +08:00
Xubin Ren c1fc6171b6 test: distinguish public history in compaction commands 2026-10-11 17:06:39 +08:00
Xubin Ren 7e00d6a944 fix(commands): keep slash-prefixed paths in normal chat 2026-10-09 12:28:32 +08:00
chengyongru 5be1e589f2 feat(providers): share Responses backend with Codex WebSocket continuation (#6096)
* feat(codex): continue sessions over Responses WebSocket

* fix(codex): retain API errors with repeated handshake headers

* test(codex): assert attachment paths before JSON escaping

* refactor(providers): share Responses transport and state backend

* fix(grok): update subscription client version

* docs: keep Codex configuration focused on user settings
2026-10-08 11:54:23 +08:00
Arthur K. 0b402d0414 fix: stop sending context compaction notifications 2026-09-30 13:44:42 +08:00
chengyongru 99ba062a97 fix(tui): accept goal requests during active turns (#5981)
* fix(tui): accept goal requests during active turns

* fix(goal): reuse live input routing and remove busy guards

* test(goal): cover followup streams across iteration budgets

* refactor(goal): expand slash commands into hidden agent input

* fix(goal): keep generated input permission scoped to users

* refactor(agent): encapsulate goal input permission scope

* refactor(goal): preserve task text without prompt wrapper

* test(goal): consolidate coverage and exercise restart recovery

* test(goal): wait for recovery reply without task registry race
2026-09-30 13:08:13 +08:00
chengyongru 4a7ad00e4f fix(tokens): warm fallback tokenizer in background (#5861)
* fix(tokens): keep fallback token estimation offline

* fix(tokens): warm fallback tokenizer in background

* test(tokens): isolate agent fixtures from tokenizer readiness

* test(tokens): keep Codex pressure fixtures within byte budget

* docs: remove manual wrapping from troubleshooting prose
2026-09-28 13:50:55 +08:00
Xubin Ren d37d7c07c0 fix(agent): redact private recovery and reconnect diagnostics 2026-09-21 15:24:38 +08:00
chengyongru a0a99f24da test(agent): consolidate session inbox coverage 2026-09-17 22:18:38 +08:00
chengyongru 5f378c9aff fix(session): keep compaction continuations out of later turns 2026-09-17 22:18:38 +08:00
chengyongru b669c2036c refactor(agent): unify session message admission 2026-09-17 22:18:38 +08:00
chengyongru 7208fb663f fix(agent): preserve queued turn semantics and completion 2026-09-17 22:18:38 +08:00
chengyongru 73410e0217 fix: stream internal model calls with idle timeouts (#5730)
* fix: stream internal model calls with idle timeouts

* fix(providers): reject streams without terminal events
2026-09-11 13:06:43 +08:00
L4XB a068de8068 fix(channels): keep the compaction outcome visible, gate only the start notice
Rework after review: compaction changes the context of every later turn,
so its outcome (compacted / failed / cancelled) is always delivered,
whether the user or the scheduler started it. Only the transient
"Compressing context…" start notice follows the channel's send_progress
setting, so a channel with progress off receives one notice per
compaction instead of two. The manual flag is gone.
2026-09-11 11:15:57 +08:00
L4XB 92f151ae67 fix(channels): make automatic compaction notices follow send_progress
Idle auto-compaction emitted "Compressing context…" / "Context compacted."
as standalone messages even when the channel had sendProgress: false, so
routine maintenance kept interrupting Discord chats after scheduled turns.

Gate ContextCompactionEvent notices in the outbound dispatch loop on the
channel's send_progress like other progress text. Two cases stay visible
regardless of the setting: a user-requested /compact (the event now
carries manual=True, set by cmd_compact through compact_idle_session)
and a failed compaction.

Fixes #5719
2026-09-11 11:15:57 +08:00
chengyongru 3548aec576 fix: use summary checkpoints for all compaction triggers (#5694)
* fix: exclude archived history after manual compaction

* refactor: share summary checkpoints across compaction paths

* fix: use summary checkpoints for every compaction trigger

* test: assert replay starts at the archived boundary

* fix: preserve nothing summaries without raw fallback

* test: assert compaction results positively

* test: verify checkpoint continuation after session reload
2026-09-08 13:16:45 +08:00
chengyongru 192e2e90dc refactor(events): unify scoped runtime notifications across clients (#5670)
* refactor(events): unify scoped runtime notifications across clients

* style(tests): sort auto-compaction event imports

* refactor(events): scope connections and remove retry callback plumbing

* docs: remove runtime notification design write-up

* refactor(bus): route operation events through the message bus

* fix(channels): isolate outbound sends by destination

* style(events): group shared notification imports

* refactor(events): converge runtime and hook delivery on MessageBus

* test(events): migrate fixtures to unified message bus
2026-09-06 02:11:19 +08:00
chengyongru 5229989f28 feat: make context compaction visible in channels (#5656)
* feat: surface context compaction lifecycle

* fix: complete and simplify context compaction notifications
2026-09-05 20:21:54 +08:00
chengyongru 3c61fef7e8 refactor(memory): decouple archival from provider state (#5565)
* refactor(memory): decouple archival from provider state

* test(memory): remove obsolete consolidation offset coverage
2026-08-27 21:21:15 +08:00
chengyongru 1fe36d5dec fix(dream): gate cursor on run completion 2026-08-22 02:05:40 +08:00
Xubin Ren c320d08dfe feat(tui): run bang commands through the gateway 2026-08-17 20:56:10 +08:00
Xubin Ren 3dc38f6396 refactor(models): unify preset names 2026-08-16 11:50:56 +08:00
chengyongru e226242dfc fix(session): serialize canonical file access (#5383) 2026-08-14 10:32:17 +08:00
chengyongru f45436b61d fix(commands): reject invalid slash commands 2026-08-04 17:11:44 +08:00
chengyongru e2563e2e74 refactor(cli): split commands into focused modules (#5175) 2026-07-30 15:01:35 +08:00
chengyongru 757ad9c764 refactor: enforce BasedPyright strict type checking (#5158) 2026-07-29 21:37:11 +08:00
chengyongru ae089aa3ae fix(webui): reconcile threads after browser resume 2026-07-28 16:25:08 +08:00
chengyongru c13df29457 feat(memory): restore Dream model preset override (#5107) 2026-07-27 14:43:25 +08:00
Xubin Ren 4e2640f2d2 fix(memory): keep failed Dream batches retryable 2026-07-27 02:00:41 +08:00
shixi-li 15e42059bd fix(memory): progress past completed no-op batches 2026-07-27 02:00:41 +08:00
chengyongru c22efb5f7a feat(agent): make model presets session-scoped (#4866) 2026-07-23 00:38:49 +08:00
chengyongru 0fd4d0ab29 fix(prompts): handle undecodable overrides 2026-07-15 01:19:48 +08:00
Arthur K. dcb37259fa feat(heartbeat): custom evaluator prompt 2026-07-15 01:19:48 +08:00
chengyongru 8c9110fee3 fix(dream): filter non-Dream history commits (#4905)
* fix(dream): filter non-Dream history commits

* fix(dream): resolve filtered commit diffs
2026-07-13 17:04:12 +08:00
chengyongru 7f8c3453e1 refactor(agent): gate sustained goals behind explicit /goal
Replace the legacy long-goal skill contract with command-scoped goal tools and runtime guidance. Keep goal state durable across continuations while restricting create and replace mutations to explicit user /goal turns.
2026-07-12 00:35:17 +08:00
chengyongru c9d3e74342 refactor(agent): require runtime for consolidation 2026-07-10 17:54:34 +08:00
chengyongru af85c356b8 refactor(agent): capture subagent runtime before spawn 2026-07-10 17:54:34 +08:00
chengyongru fa73448f6f fix(webui): drive slash command routing from metadata 2026-07-07 15:42:04 +08:00
Kenneth Zhao f0c989ba2d fix(dream): ground memory audit records in the real git diff (#4673)
* fix(dream): ground commit messages and cursor advance in the real git diff

Dream consolidation could emit a /dream-log audit record that did not match
the actual file changes: build_dream_commit_message appended the LLM's
unverified resp.content, dream_run_completed only checked the stop reason, and
file contents were deliberately omitted from the prompt. The combination let a
single-turn self-report become the durable audit record.

- gitstore: add summarize_working_tree() — a structured, machine-derived
  summary (per-file +N/-M, totals, capped unified diff) of working-tree
  changes vs HEAD. Pure filesystem/git ground truth, never LLM narrative.
- memory: build_dream_commit_message now takes the diff body instead of resp;
  dream_content_diff() exposes the real delta over SOUL/USER/MEMORY.md only
  (excludes .dream_cursor so cursor writes aren't mistaken for edits);
  build_dream_prompt embeds current file contents so the model edits reality,
  not a stale mental model.
- builtin/cli: both Dream paths now compute the diff, gate cursor advance on
  a non-empty delta (no-op runs no longer swallow history), and commit with
  the diff-grounded message. Non-git workspaces fall back to the completion
  check.
- dream.md: document that contents are embedded, and add a chain-of-
  verification guardrail so the model's summary cannot claim unmade edits.

A regression test proves a lying resp.content never reaches the audit log
while the real diff does.

* fix(dream): mark non-UTF-8 memory files as binary in diff summary

Address review feedback (Q1 on PR #4673): summarize_working_tree read
working-tree files with errors="replace", which would emit U+FFFD
replacement chars into the audit record if a memory file ever held
invalid UTF-8 — misrepresenting the diff it is meant to make truthful.

Switch to errors="strict" and catch UnicodeDecodeError: a non-UTF-8
(or binary/corrupt) file is now recorded as "{path}: binary or
non-UTF-8 file changed" and omitted from the unified diff, so the
audit record stays honest. An empty diff block is also suppressed when
all changes are binary.

Adds a defensive regression test asserting no replacement char leaks.
2026-07-06 12:12:55 +08:00