Files
e07824e6a9 Fix/agent env usage workspace (#351)
* fix: inject Admin env into running agents and sum turn token usage

Running shells and Docker sandboxes now pick up ~/.octop/env (and workspace .env) without a full reload; MCP stdio no longer inherits the entire host environment. Usage accounting adds every model call in the turn, and workspace I/O survives the harness rebuild window.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: schema v7 identity, expert profiles, chat artifacts, and KB citations (#346)

* feat: schema v7 identity, expert profiles, chat artifacts, and KB citations

Fold integer PKs plus public string ids, document folders, agent profile columns, and thread artifacts into v7 SQL (not only Python helpers). Experts get workspace avatars and a single welcome_message; chat keeps file changes across sessions, shows knowledge citations, and can drag workspace files.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: drop cron JobDrawer UX from the schema v7 PR

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: prefer tool-arg paths when recording chat artifacts

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 10:17:39 +08:00

55 lines
1.8 KiB
Python

"""Unit tests for knowledge advanced indexing/retrieval settings."""
from __future__ import annotations
import pytest
from octop.infra.knowledge import params
def test_advanced_settings_use_defaults_when_unset() -> None:
assert params.get_advanced_settings(lambda _key: None) == {
"chunk_size": params.DEFAULT_CHUNK_SIZE,
"chunk_overlap": params.DEFAULT_CHUNK_OVERLAP,
"retrieval_k": params.DEFAULT_RETRIEVAL_K,
"context_char_budget": params.DEFAULT_CONTEXT_CHAR_BUDGET,
}
def test_advanced_settings_persist_and_reject_invalid_overlap() -> None:
values: dict[str, str] = {}
params.set_advanced_settings(
values.get,
values.__setitem__,
chunk_size=1000,
chunk_overlap=200,
retrieval_k=5,
context_char_budget=4000,
)
assert params.get_advanced_settings(values.get) == {
"chunk_size": 1000,
"chunk_overlap": 200,
"retrieval_k": 5,
"context_char_budget": 4000,
}
with pytest.raises(ValueError, match="chunk_overlap"):
params.set_advanced_settings(
values.get, values.__setitem__, chunk_size=100, chunk_overlap=100
)
def test_capability_includes_advanced_defaults(monkeypatch: pytest.MonkeyPatch) -> None:
from octop.infra.knowledge import gate
monkeypatch.setattr(gate, "local_embedding_deps_available", lambda: True)
monkeypatch.setattr(gate, "is_model_downloaded", lambda _model: False)
capability = gate.get_capability(lambda _key: None)
assert capability["chunk_size"] == params.DEFAULT_CHUNK_SIZE
assert capability["chunk_overlap"] == params.DEFAULT_CHUNK_OVERLAP
assert capability["retrieval_k"] == params.DEFAULT_RETRIEVAL_K
assert capability["context_char_budget"] == params.DEFAULT_CONTEXT_CHAR_BUDGET