- test_catalog_bounds_failure_only_keys failed 3/5 runs on Windows: all
three get() calls land within one time.monotonic() tick, so the eviction
victim in _reserve() is decided by hash-seeded set iteration order among
tied recency keys. Pin the catalog to a synthetic strictly-increasing
monotonic clock (the constructor already accepts one) so the oldest
entry is evicted deterministically. 5/5 stable after, 3/5 failures before.
- test_equivalent_workspace_paths_share_one_store requires directory
symlinks, which need admin/developer mode on Windows (WinError 1314).
Skip with the same pattern the file already uses for file symlinks.
- tests/agent/conftest.py: make_provider() assigned through a spec'd mock
by reading provider.estimate_prompt_tokens first, which raises
AttributeError because the attribute is not on the LLMProvider class
spec; assign a MagicMock directly instead. Latent - no test hit the
default-provider path until now.
* refactor(agent): defer transcript assembly to runner
Keep persisted history and the fresh turn as explicit inputs until the Runner assembles the provider transcript. Preserve ContextBuilder and direct AgentRunner compatibility while making the save boundary structural.
Refs NAN-81.
* fix(providers): preserve mixed adjacent user content
Session files lived under <workspace>/sessions/ (since #713), which is the
on-disk scope of the agent's filesystem tools. With restrict_to_workspace
enabled, an agent could read_file / list_dir every session transcript —
including other users' or channels' conversations — bypassing the scoped
sessions.py access layer entirely.
Move session storage to ~/.nanobot/sessions/<sha256-of-resolved-workspace>[:16]/,
outside the workspace. Per-workspace isolation (the goal of #713) is preserved
via a hash of the resolved workspace path, so different workspaces keep
independent session stores. A one-shot, idempotent migration moves legacy
in-workspace *.jsonl files into the new location at store init.
Scope note: this protects sessions whenever restrict_to_workspace=true. The
default restrict_to_workspace=false leaves read_file unrestricted in general
(not only sessions) and is a separate concern.
Refs #5278
Keep only 128 recently used sessions strongly cached while retaining weak references to evicted sessions still owned by active callers. This bounds idle memory growth without allowing duplicate live Session objects or skipping shutdown flushes.
Add LRU, lifecycle, SDK, and flush regression coverage.
Refs #4786
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.
list_sessions() silently dropped corrupt session files whose filename
stem was a legacy non-base64 name (e.g. telegram_12345.jsonl from the
old lossy path scheme). The repair path called _repair(fallback_key),
but _repair re-encodes the key via _storage_key(), producing a
different base64 filename that never matches the actual file on disk.
Add an optional path parameter to _repair so callers can pass the
actual file path directly, bypassing the key-to-filename round trip.
Signed-off-by: axelray-dev <110029405+axelray-dev@users.noreply.github.com>
maintainer edit: corrupt session metadata can contain JSON strings, nulls, floats, or booleans. Reset non-integer offsets before range checks so recovery keeps valid messages visible instead of falling back to an empty session.