Commit Graph

9 Commits

Author SHA1 Message Date
Teknium
cf2ffb3cbf fix(memory): drop the replace action; patch is the only edit
replace overwrote the whole matched entry, and models used it as a
find-and-swap, wiping the sibling facts in multi-fact entries (NVIDIA:
19/40 tasks on Opus 4.8). patch does everything replace did (old_text =
the whole entry rewrites it) without that failure, so the tool now
offers add / patch / remove only.

- A replace call, single or inside a batch, is refused with a pointer to
  patch and writes nothing. Writes staged for approval before this change
  still pin, display and replay through the store's replace.
- The schema loses the replace warnings, explains patch once, and drops
  the added target prose: target is already an enum in `required`, the
  runtime refusal teaches a missing or nested target, and batch items now
  set additionalProperties: false so a nested target cannot be expressed.
- Net tool tokens per session: 13,264 on main -> 13,188 (-76); the PR
  head before this commit was 13,446.
- Model-facing hints that said "shorten (replace)" now say patch.

Reverses the whole-entry replace contract from #117952 by maintainer
decision; the tests that drove replace through the tool now drive patch,
and one new test pins the refusal.
2026-10-12 19:13:09 -07:00
emozilla
5e0ec82d1f fix(memory): mirror a patch to providers as a whole-entry replace
notify_memory_tool_write forwarded a patch as action "patch" with only
the replacement span as content. Providers know add/replace/remove, so
they skipped it (byterover mirrors only add and replace) or would have
stored the span as a fact. Since patch takes over the edits replace used
to make, external memory stopped receiving those updates.

Mirror a patch as what it is to a provider: a replace whose content is
the whole entry after the edit, with the entry before it as
previous_content. Single results carry patched_entry_after; for a batch,
redo the store's splice on that op's entry before the edit.
2026-10-12 21:17:47 -04:00
Yuan Li
73808abcd7 fix(memory): report single patch results consistently 2026-10-12 21:17:47 -04:00
Teknium
5908e1aaa8 test: trim memory write-bridge regression tests to the invariants
Keep the two tests that are red on unchanged main: previous_content comes
from the locked native-store result (single + batch replace/remove, batch
ordering) and never from caller arguments or build_metadata. Drop the
uncommitted-batch cases (they pass on main -- the no-notification gate on a
failed write predates this change) and the memory/user target axis (same
store code path).

Salvage of #118903 by @ehz0ah.
2026-09-23 01:06:32 -07:00
ehz0ah
d57c2a3254 fix(memory): forward committed entry identity to providers 2026-09-23 01:06:32 -07:00
Teknium
6b81590c55 test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions
Systematic prune per AGENTS.md test policy, one pass over every major
test tree (gateway, hermes_cli, tools, agent, run_agent, plugins, cli,
cron, tui_gateway, honcho/openviking, root-level):

- DELETE: source-reading tests (read_text/getsource on prod files),
  change-detector tests (exact catalog counts, model-name snapshots,
  config version literals), mock-echo tests (assert a mock returns what
  it was told), assertion-free/trivial tests, near-duplicate
  parametrizations (boundaries + one representative kept), async/sync
  twin duplicates, cosmetic within-file variations.
- KEEP (mandatory): security/redaction/approval guards, message-role
  alternation invariants, prompt-caching/deterministic-call-id
  invariants, issue-number regression tests (deduped), E2E tests.
- 6 test files deleted outright (script-style/no-assert or fully
  redundant); conftest.py, fakes/, fixtures/ untouched.
- tests/acp/conftest.py added: autouse fixture stubs the live
  models.dev/GitHub/Copilot/Anthropic inventory fetches that ACP server
  tests performed on every session create — test_server.py 147s → 3.4s,
  and the tests are now genuinely hermetic.
- Sleep-based slowness shrunk where safe (codex_ttfb_watchdog,
  compression_concurrent_fork, etc.); no wall-clock assertion tightened.

Verification: full hermetic suite via scripts/run_tests.sh —
2439 files, 31,130 tests passed, 0 failed, 0 flaky retries, 315s wall
(baseline: 583s wall, 13,564s subprocess CPU).
2026-07-29 13:10:23 -07:00
Teknium
b1b20270c4 refactor(memory): move write-mirror gating behind MemoryManager interface
The success/staged gating and op-expansion for mirroring built-in memory
writes to external providers lived in a standalone agent/memory_write_bridge.py
helper called inline from two core call sites (tool_executor.py,
agent_runtime_helpers.py). That left the mirror decision-making in the agent
loop, outside the memory-provider interface.

Fold it into a new MemoryManager.notify_memory_tool_write() entry point: the
loop now hands over the raw tool result + args and a metadata callback, and the
manager decides whether/what to mirror. Both core call sites collapse to a
single call; the orphan module is removed. No MemoryProvider ABC change.

Tests rewritten as behavior tests against the manager method.
2026-06-22 07:00:42 -07:00
Hao Zhe
027cb649ef fix(memory): fail closed on unclear write results 2026-06-22 07:00:42 -07:00
Hao Zhe
70e7132e2f fix(openviking): gate memory writes and add viking_forget
Mirror built-in memory writes to external providers only after the native memory tool succeeds and is not staged for approval. Keep OpenViking's built-in memory mirroring add-only, since Hermes native memory entries do not yet have stable OpenViking file URIs for replace/remove.

Add a narrow viking_forget tool for exact user memory file deletion and document the current OpenViking write/delete behavior.
2026-06-22 07:00:42 -07:00