keble-task 2.22.1__tar.gz → 2.24.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. keble_task-2.24.0/AGENTS.md +46 -0
  2. keble_task-2.24.0/AiAgentChangesLogs.md +99 -0
  3. keble_task-2.24.0/CLAUDE.md +5 -0
  4. {keble_task-2.22.1 → keble_task-2.24.0}/PKG-INFO +26 -6
  5. {keble_task-2.22.1 → keble_task-2.24.0}/README.md +24 -4
  6. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/main.py +7 -8
  7. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/schemas/__init__.py +435 -110
  8. {keble_task-2.22.1 → keble_task-2.24.0}/pyproject.toml +2 -5
  9. {keble_task-2.22.1 → keble_task-2.24.0}/tests/conftest.py +35 -17
  10. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/agent/test_agent_query_registry.py +2 -4
  11. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/costs/test_task_costs.py +29 -13
  12. {keble_task-2.22.1 → keble_task-2.24.0}/tests/unit/schemas/test_schemas.py +52 -0
  13. keble_task-2.24.0/tests/unit/schemas/test_task_cost_token_rates.py +292 -0
  14. {keble_task-2.22.1 → keble_task-2.24.0}/uv.lock +7 -29
  15. keble_task-2.22.1/AGENTS.md +0 -32
  16. keble_task-2.22.1/AiAgentChangesLogs.md +0 -44
  17. keble_task-2.22.1/CLAUDE.md +0 -33
  18. {keble_task-2.22.1 → keble_task-2.24.0}/.gitattributes +0 -0
  19. {keble_task-2.22.1 → keble_task-2.24.0}/.gitignore +0 -0
  20. {keble_task-2.22.1 → keble_task-2.24.0}/.python-version +0 -0
  21. {keble_task-2.22.1 → keble_task-2.24.0}/deps/keble_typing-0.3.3-py3-none-any.whl +0 -0
  22. {keble_task-2.22.1 → keble_task-2.24.0}/improve.README.md +0 -0
  23. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/__init__.py +0 -0
  24. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/actions.py +0 -0
  25. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/agent/__init__.py +0 -0
  26. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/agent/chat_provider.py +0 -0
  27. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/agent/deps.py +0 -0
  28. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/agent/tools/__init__.py +0 -0
  29. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/agent/tools/mutation.py +0 -0
  30. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/agent/tools/query.py +0 -0
  31. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/crud.py +0 -0
  32. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/exceptions.py +0 -0
  33. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/schemas/for_agent.py +0 -0
  34. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/task_tree.py +0 -0
  35. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/testing/__init__.py +0 -0
  36. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/testing/config.py +1 -1
  37. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/testing/factories.py +0 -0
  38. {keble_task-2.22.1 → keble_task-2.24.0}/keble_task/utils.py +0 -0
  39. {keble_task-2.22.1 → keble_task-2.24.0}/logs/AiAgentChangesLogs.20260630.md +0 -0
  40. {keble_task-2.22.1 → keble_task-2.24.0}/poetry.lock +0 -0
  41. {keble_task-2.22.1 → keble_task-2.24.0}/pyproject.poetry.toml +0 -0
  42. {keble_task-2.22.1 → keble_task-2.24.0}/pyrightconfig.json +0 -0
  43. {keble_task-2.22.1 → keble_task-2.24.0}/tests/contract/events/test_emit_drain_contract.py +0 -0
  44. {keble_task-2.22.1 → keble_task-2.24.0}/tests/contract/schemas/__init__.py +0 -0
  45. {keble_task-2.22.1 → keble_task-2.24.0}/tests/contract/schemas/test_for_agent.py +0 -0
  46. {keble_task-2.22.1 → keble_task-2.24.0}/tests/contract/schemas/test_metadata_jsonable_read.py +0 -0
  47. {keble_task-2.22.1 → keble_task-2.24.0}/tests/contract/schemas/test_no_local_datetime_helpers.py +0 -0
  48. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/actions/test_task_actions.py +0 -0
  49. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/agent/test_agent_registry.py +0 -0
  50. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/core/test_main.py +0 -0
  51. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/public/test_public_indexable.py +0 -0
  52. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/relations/test_task_relations.py +0 -0
  53. {keble_task-2.22.1 → keble_task-2.24.0}/tests/integration/tree/test_tree_and_public_id_edges.py +0 -0
  54. {keble_task-2.22.1 → keble_task-2.24.0}/tests/live/llm/test_agent_registry_live.py +0 -0
  55. {keble_task-2.22.1 → keble_task-2.24.0}/tests/unit/agent/test_agent_chat_provider.py +0 -0
  56. {keble_task-2.22.1 → keble_task-2.24.0}/tests/unit/core/test_exceptions.py +0 -0
  57. {keble_task-2.22.1 → keble_task-2.24.0}/tests/unit/core/test_metadata_flow.py +0 -0
  58. {keble_task-2.22.1 → keble_task-2.24.0}/tests/unit/core/test_retry_attempt_logging.py +0 -0
  59. {keble_task-2.22.1 → keble_task-2.24.0}/tests/unit/testing/test_config.py +0 -0
@@ -0,0 +1,46 @@
1
+ # Keble Task Agent Instructions
2
+
3
+ Follow the root `TESTING_GUIDELINE.md` when changing tests in this repo.
4
+
5
+ ## Testing Rules
6
+
7
+ - The normal Keble local development command is local-full and should run
8
+ Mongo/Redis-heavy tests by default:
9
+ `RUN_INTEGRATION=1 RUN_REAL_DB=1 RUN_LOCAL_STACK=1 RUN_DB_STACK=1 uv run pytest -q -m "not live and not container"`.
10
+ - Keep the portable-offline fallback available for machines without local DBs:
11
+ `uv run pytest -q -m "not live and not slow and not eval and not local_stack and not db_stack and not container"`.
12
+ - The live LLM test must stay marked `live` and `llm` and must require
13
+ `RUN_LLM_LIVE=1`.
14
+ - Put executable tests under canonical layer folders only: `tests/unit/`,
15
+ `tests/contract/`, `tests/integration/`, `tests/live/`, `tests/evals/`, or
16
+ `tests/db_stack/`.
17
+ - Do not add flat `tests/test_*.py`, `tests/schemas/`, `tests/mock/`, or
18
+ `tests/irl/` folders.
19
+ - Do not recreate root-level `tests/config.py`, `tests/utils.py`, or an
20
+ importable root `tests` package. Shared test doubles and settings belong in
21
+ `keble_task.testing`.
22
+ - Tests that use Mongo/Redis fixtures are local-stack integration DB tests and
23
+ must be marked with `integration`, `db`, `mongo`, `redis`, and `local_stack`;
24
+ they must run under the local-full command and must not be selected by the
25
+ portable-offline command.
26
+ - Selected DB tests must fail with a clear missing-config message when Mongo or
27
+ Redis cannot be resolved; do not hide selected DB coverage behind lazy skips.
28
+ - Use `keble_task.testing.config` for test credentials. It reads explicit env /
29
+ `tests/.env` / the umbrella `keble.backend/.env`, maps backend Azure provider
30
+ lists into the live LLM canary, and keeps test database names isolated.
31
+ - Use shared fixtures from `keble_db.testing` as the DB testing toolkit expands;
32
+ do not introduce ad-hoc shared local database writes.
33
+ - Put quality/regression suites under `tests/evals/` and mark them `eval`.
34
+ Selecting `uv run pytest -q -m eval` is the eval opt-in; do not add a generic
35
+ `RUN_EVALS` skip gate. Provider-backed evals also need `live` plus the
36
+ provider marker and provider-specific env gate.
37
+ - Do not add empty pytest lifecycle hooks, empty test folders, `pass`, `...`, or
38
+ status-only tests as placeholders. Add meaningful assertions or remove the
39
+ placeholder module.
40
+ - Do not add full stack or live-provider behavior to the default test command.
41
+ - Run the local-full command, portable-offline fallback, `uv run pytest -q -m eval`,
42
+ changed layer selectors, and `npx --yes pyright .` after
43
+ test-infrastructure changes.
44
+ - Update `README.md`, `AGENTS.md`, `CLAUDE.md`, and `AiAgentChangesLogs.md`
45
+ whenever testing behavior, markers, fixtures, commands, or dependencies
46
+ change.
@@ -0,0 +1,99 @@
1
+ ## 2026-07-08 — 2.23.0 (TaskBase.thinking_mode, Program AP)
2
+ State: branch feature/task-thinking-mode off main a071a29.
3
+
4
+ zma: user-selectable thinking mode (speed-first vs quality-first) must be explicitly recorded at the keble-task level and inherited task->subtasks.
5
+
6
+ Ai: TaskBase gains first-class `thinking_mode: Optional[str]` (open str per the framework-fields-stay-str convention; camelCase wire `thinkingMode`; None = legacy = QUALITY_FIRST downstream) beside `language`; `TaskClient.acreate` gains the `thinking_mode` kwarg threaded into TaskBase. Tests: camelCase round-trip + legacy-dump-None. 49 offline pass; pyright 0.
7
+
8
+ # Ai Agent Changes Logs
9
+
10
+ Historical entries before 2026-06-30 23:13 were moved to `logs/AiAgentChangesLogs.20260630.md`.
11
+
12
+ ## 2026-07-18 04:25 CST
13
+ State: `fix/review2-exact-task-cost-rates`; REVIEW2 WP2 task-cost dependency
14
+ correction implemented and verified before backend consumer migration.
15
+
16
+ zma:
17
+ - Continue the finalized Data Infra REVIEW2 plan, double-check every edge case,
18
+ and leave all repositories wired, released, and merged only after full proof.
19
+
20
+ Ai:
21
+ - Corrected a WP0 census miss: per-million token prices cannot use ISO `Money`
22
+ because valid prices such as USD 0.075 require fractional cents.
23
+ - Reused shared `LlmTokenPriceBand` integer micros inside `TaskCostTokenRates`,
24
+ added a bounded 2.24.x reader for legacy Money-shaped rows, and locked removal
25
+ to 2.25.0 after the repair sweep.
26
+ - Added exact Decimal FX, exponent-0/2/3 additional-cost decoding, cached-input
27
+ de-duplication, typed missing-price failures, and rejection of sub-micro or
28
+ mixed-currency rates. Removed the public-package local source override and
29
+ resolved the released `keble-helpers 1.54.0` artifact.
30
+ - Proof: 9 focused unit tests, 58 portable tests, 14 cost integrations, and 172
31
+ isolated local-full tests passed; Pyright and Ruff checks passed on source,
32
+ and isolated Mongo/Redis collections were empty before container removal.
33
+
34
+ ## 2026-07-02 21:12 CST
35
+ State: branch `refactor/local-db-evals-keble-task`; local-full pytest default and eval selector cleanup.
36
+
37
+ zma:
38
+ - Change the testing standard so local DB-heavy tests run by default in the Keble local-full lane.
39
+ - Keep portable-offline tests available, move quality/eval tests to the eval layer, and run eval selections separately.
40
+
41
+ Ai:
42
+ - Removed the legacy `RUN_INTEGRATION` collection skip from Mongo/Redis integration tests; local-stack integration tests now run when selected by the local-full command or `-m integration`.
43
+ - Changed missing Mongo/Redis config in selected DB fixtures from lazy skip to clear pytest failure, while keeping live LLM gated by `RUN_LLM_LIVE=1`.
44
+ - Updated README, AGENTS, and CLAUDE testing instructions with the local-full command, portable-offline fallback, direct `-m eval` selection, and no generic `RUN_EVALS` gate.
45
+ - Proof: local-full `161 passed, 1 deselected` in pytest `2.74s` / wall `21.35s`; portable-offline `47 passed, 115 deselected` in pytest `0.35s` / wall `1.92s`; unit `35 passed, 127 deselected`; contract `12 passed, 150 deselected`; integration `114 passed, 48 deselected`; eval and db_stack selected no tests; `npx --yes pyright .` `0 errors`; `uv build` produced `keble_task-2.22.1`.
46
+
47
+ ## 2026-07-02 15:29 CST
48
+ State: branch `refactor/harden-pytests-keble-task`; marker tightening for the cross-repo pytest hardening follow-up.
49
+
50
+ zma:
51
+ - Continue the repo-by-repo pytest hardening.
52
+ - Ensure default tests stay offline while DB/LLM tests remain useful and explicitly marked.
53
+
54
+ Ai:
55
+ - Marked Mongo/Redis integration and live LLM tests as `local_stack` in the collection hook.
56
+ - Added `RUN_INTEGRATION=1` gating for Mongo/Redis integration tests so default pytest no longer runs real local-stack services opportunistically.
57
+ - Updated README, AGENTS, and CLAUDE testing instructions with the stricter command split.
58
+ - Proof: default `47 passed, 115 deselected in 0.28s`; unit `35 passed, 127 deselected in 0.27s`; contract `12 passed, 150 deselected in 0.24s`; integration with `RUN_INTEGRATION=1` `114 passed, 48 deselected in 1.87s`; `db` `114 passed, 1 skipped, 47 deselected in 1.90s`; `mongo` `114 passed, 1 skipped, 47 deselected in 1.90s`; `redis` `114 passed, 1 skipped, 47 deselected in 1.87s`; `local_stack` `114 passed, 1 skipped, 47 deselected in 1.84s`; live guard `1 skipped, 161 deselected in 0.19s`; live LLM with `RUN_LLM_LIVE=1` `1 passed, 161 deselected in 7.18s`; asyncio with `RUN_INTEGRATION=1` `103 passed, 1 skipped, 58 deselected in 1.94s`; `npx --yes pyright .` `0 errors`; `uv build` succeeded.
59
+
60
+ ## 2026-07-02 00:58 CST
61
+ State: branch `refactor/harden-pytests-keble-task`; pytest hardening follow-up for `prompts/202060701/1.5-harden-pytests-and-remove-redundant.md`.
62
+
63
+ zma:
64
+ - Execute the cross-repo pytest hardening plan repo by repo.
65
+ - Reconsider over-trimmed IRL tests, remove weak placeholders, and use `keble.backend/.env` credentials instead of skipping DB/LLM tests for missing repo-local env.
66
+
67
+ Ai:
68
+ - Bumped `keble-task` to `2.22.1` and raised the `keble-db` dependency to `>=1.8.1`.
69
+ - Updated `keble_task.testing.config` to read explicit env / `tests/.env` / backend `.env` for Mongo and Redis, and to map the first backend Azure endpoint/token/deployment into the live LLM canary.
70
+ - Added unit coverage for backend env fallback, Azure provider-list mapping, and explicit-env precedence.
71
+ - Removed empty pytest lifecycle hooks from `tests/conftest.py` and updated docs to forbid placeholder test modules/hooks.
72
+ - Proof: config focus `3 passed`; default pytest `161 passed, 1 deselected`; unit `35 passed, 127 deselected`; contract `12 passed, 150 deselected`; integration `114 passed, 48 deselected`; live LLM guard `1 skipped, 161 deselected`; opt-in live LLM `1 passed, 161 deselected`; pyright `0 errors`; `uv build` succeeded.
73
+
74
+ ## 2026-07-01 03:32
75
+ State: Strict testing-folder follow-up for `keble-task`; no runtime task API behavior, schemas, or dependencies changed.
76
+
77
+ zma:
78
+ - Continue the cross-repo testing refactor after tightening `TESTING_GUIDELINE.md` marker and folder allowances.
79
+ - Enforce canonical test layer folders and package-owned shared test helpers.
80
+
81
+ Ai:
82
+ - Moved test settings into `keble_task.testing.config`.
83
+ - Moved shared in-memory task test doubles and factories into `keble_task.testing.factories`.
84
+ - Removed root `tests/config.py`, `tests/utils.py`, `tests/pytest.ini`, and `tests/__init__.py` so tests no longer import through `tests.*`.
85
+ - Updated docs to keep future shared task test helpers under `keble_task.testing`.
86
+
87
+ ## 2026-06-30 23:13
88
+ State: Documentation-only README compaction and AI log archival; no runtime code, schemas, dependencies, or tests were changed.
89
+
90
+ zma:
91
+ - Auto compact and summarize README.md files across repos unless already small.
92
+ - Cross-check retained README information for validity and keep only critical, necessary information.
93
+ - Move lengthy AiAgentChangesLogs.md files into repo-local logs/AiAgentChangesLogs.2026****.md.
94
+ - Merge the documentation changes to main repo by repo.
95
+
96
+ Ai:
97
+ - Archived the previous long agent change log into `logs/AiAgentChangesLogs.20260630.md`.
98
+ - Compacted `README.md` to current purpose, validated wiring, install/test gates, and high-risk side effects.
99
+ - Kept only critical current README facts cross-checked against manifests, config, source roots, compose scripts, or existing guideline files.
@@ -0,0 +1,5 @@
1
+ @AGENTS.md
2
+
3
+ This CLAUDE.md is an import ALIAS only: the canonical package rules live in
4
+ `AGENTS.md` (imported above). Do NOT load both files — if your tool already
5
+ read AGENTS.md, skip this file (and vice versa). Never add rules here.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keble-task
3
- Version: 2.22.1
3
+ Version: 2.24.0
4
4
  Author-email: zhenhao-ma <bob0103779@gmail.com>
5
5
  Requires-Python: <3.14,>=3.13
6
6
  Requires-Dist: keble-db<2.0.0,>=1.8.1
7
- Requires-Dist: keble-helpers<2.0.0,>=1.40.0
7
+ Requires-Dist: keble-helpers<2.0.0,>=1.54.0
8
8
  Requires-Dist: pydantic-ai-slim<2.0.0,>=1.41.0
9
9
  Requires-Dist: tenacity<10.0.0,>=9
10
10
  Provides-Extra: test
@@ -22,10 +22,10 @@ tool contracts.
22
22
 
23
23
  ## Verified State
24
24
 
25
- Checked on 2026-06-30 against `pyproject.toml`, package exports,
25
+ Checked on 2026-07-18 against `pyproject.toml`, package exports,
26
26
  `keble_task/`, and tests.
27
27
 
28
- - Package: `keble-task 2.22.1`
28
+ - Package: `keble-task 2.24.0`
29
29
  - Python: `>=3.13,<3.14`
30
30
  - Critical deps: `keble-helpers`, `keble-db`, `pydantic-ai-slim`, `tenacity`
31
31
  - Source roots: `schemas/`, `actions/`, `crud/`, `main/`, `agent/`, `utils/`
@@ -42,12 +42,23 @@ Checked on 2026-06-30 against `pyproject.toml`, package exports,
42
42
  websocket fanout and frontend task-list rendering.
43
43
  - Mongo CRUD changes must expose indexed query shapes directly and keep index
44
44
  creation in startup wiring, not request handlers.
45
+ - Token rates are stored as native-currency micros per million tokens through
46
+ the shared `LlmTokenPriceBand`; ISO `Money` remains the contract for concrete
47
+ additional spend. This separation preserves prices such as USD 0.075 without
48
+ rounding them to cents and prevents cached input from being billed twice.
49
+ - Version 2.24.x reads the legacy Money-per-counter rate shape only for migration
50
+ and writes the canonical `currency + priceBand` shape. Migrate stored rows and
51
+ old admin clients before removing that reader in 2.25.0.
45
52
 
46
53
  ## Testing
47
54
 
48
55
  ```bash
49
56
  uv sync --group test
50
- uv run pytest -m "not live and not slow and not eval and not local_stack and not db_stack and not container"
57
+ RUN_INTEGRATION=1 RUN_REAL_DB=1 RUN_LOCAL_STACK=1 RUN_DB_STACK=1 uv run pytest -q -m "not live and not container"
58
+ uv run pytest -q -m "not live and not slow and not eval and not local_stack and not db_stack and not container"
59
+ uv run pytest -q -m eval
60
+ uv run pytest -q -m integration
61
+ RUN_LLM_LIVE=1 uv run pytest -m "live and llm"
51
62
  uv run npx --yes pyright .
52
63
  ```
53
64
 
@@ -60,7 +71,13 @@ Mongo/Redis integration settings load explicit process env first, then
60
71
  `keble_db.testing.resolve_test_env`. Live LLM settings load explicit `LIVE_LLM_*`
61
72
  values first and otherwise map the first backend Azure endpoint/token/deployment
62
73
  entry. Set `KEBLE_BACKEND_ENV_FILE=/path/to/.env` from unusual worktree or CI
63
- layouts. Keep the package-owned test database and collection names isolated.
74
+ layouts. Mongo/Redis tests are `integration`, `db`, `mongo`, `redis`, and
75
+ `local_stack`; they run in the local-full Keble command and stay out of the
76
+ portable-offline fallback command. Selecting integration tests without configured
77
+ Mongo/Redis now fails with a clear environment requirement instead of silently
78
+ skipping. Eval tests use `tests/evals/` plus `eval`; selecting `-m eval` is the
79
+ eval opt-in, with no generic `RUN_EVALS` gate. Keep the package-owned test
80
+ database and collection names isolated.
64
81
 
65
82
  ## Change Logs
66
83
 
@@ -70,5 +87,8 @@ Historical release notes and long AI change history live under `logs/`.
70
87
 
71
88
  - Backend task APIs, owner task lists, task room sockets, cost accounting,
72
89
  and frontend task rows depend on these schemas/events.
90
+ - Backend pricing configuration and task-cost admin clients must use the exact
91
+ micro-rate wire introduced in 2.24.0; optional missing prices are unknown, not
92
+ free usage.
73
93
  - Relation or graph-context changes can affect all feature rooms that load
74
94
  child tasks or background sessions.
@@ -6,10 +6,10 @@ tool contracts.
6
6
 
7
7
  ## Verified State
8
8
 
9
- Checked on 2026-06-30 against `pyproject.toml`, package exports,
9
+ Checked on 2026-07-18 against `pyproject.toml`, package exports,
10
10
  `keble_task/`, and tests.
11
11
 
12
- - Package: `keble-task 2.22.1`
12
+ - Package: `keble-task 2.24.0`
13
13
  - Python: `>=3.13,<3.14`
14
14
  - Critical deps: `keble-helpers`, `keble-db`, `pydantic-ai-slim`, `tenacity`
15
15
  - Source roots: `schemas/`, `actions/`, `crud/`, `main/`, `agent/`, `utils/`
@@ -26,12 +26,23 @@ Checked on 2026-06-30 against `pyproject.toml`, package exports,
26
26
  websocket fanout and frontend task-list rendering.
27
27
  - Mongo CRUD changes must expose indexed query shapes directly and keep index
28
28
  creation in startup wiring, not request handlers.
29
+ - Token rates are stored as native-currency micros per million tokens through
30
+ the shared `LlmTokenPriceBand`; ISO `Money` remains the contract for concrete
31
+ additional spend. This separation preserves prices such as USD 0.075 without
32
+ rounding them to cents and prevents cached input from being billed twice.
33
+ - Version 2.24.x reads the legacy Money-per-counter rate shape only for migration
34
+ and writes the canonical `currency + priceBand` shape. Migrate stored rows and
35
+ old admin clients before removing that reader in 2.25.0.
29
36
 
30
37
  ## Testing
31
38
 
32
39
  ```bash
33
40
  uv sync --group test
34
- uv run pytest -m "not live and not slow and not eval and not local_stack and not db_stack and not container"
41
+ RUN_INTEGRATION=1 RUN_REAL_DB=1 RUN_LOCAL_STACK=1 RUN_DB_STACK=1 uv run pytest -q -m "not live and not container"
42
+ uv run pytest -q -m "not live and not slow and not eval and not local_stack and not db_stack and not container"
43
+ uv run pytest -q -m eval
44
+ uv run pytest -q -m integration
45
+ RUN_LLM_LIVE=1 uv run pytest -m "live and llm"
35
46
  uv run npx --yes pyright .
36
47
  ```
37
48
 
@@ -44,7 +55,13 @@ Mongo/Redis integration settings load explicit process env first, then
44
55
  `keble_db.testing.resolve_test_env`. Live LLM settings load explicit `LIVE_LLM_*`
45
56
  values first and otherwise map the first backend Azure endpoint/token/deployment
46
57
  entry. Set `KEBLE_BACKEND_ENV_FILE=/path/to/.env` from unusual worktree or CI
47
- layouts. Keep the package-owned test database and collection names isolated.
58
+ layouts. Mongo/Redis tests are `integration`, `db`, `mongo`, `redis`, and
59
+ `local_stack`; they run in the local-full Keble command and stay out of the
60
+ portable-offline fallback command. Selecting integration tests without configured
61
+ Mongo/Redis now fails with a clear environment requirement instead of silently
62
+ skipping. Eval tests use `tests/evals/` plus `eval`; selecting `-m eval` is the
63
+ eval opt-in, with no generic `RUN_EVALS` gate. Keep the package-owned test
64
+ database and collection names isolated.
48
65
 
49
66
  ## Change Logs
50
67
 
@@ -54,5 +71,8 @@ Historical release notes and long AI change history live under `logs/`.
54
71
 
55
72
  - Backend task APIs, owner task lists, task room sockets, cost accounting,
56
73
  and frontend task rows depend on these schemas/events.
74
+ - Backend pricing configuration and task-cost admin clients must use the exact
75
+ micro-rate wire introduced in 2.24.0; optional missing prices are unknown, not
76
+ free usage.
57
77
  - Relation or graph-context changes can affect all feature rooms that load
58
78
  child tasks or background sessions.
@@ -25,20 +25,18 @@ from keble_db import AgentDbDeps, ExtendedAsyncRedis, QueryBase
25
25
  from keble_helpers import (
26
26
  AgenticActionEventStatus,
27
27
  AgenticEventEmitter,
28
- Currency,
29
28
  ExchangeRateInUsd,
30
29
  Language,
31
30
  Money,
32
31
  ObjectId,
33
32
  PydanticModelConfig,
34
33
  SharingScope,
35
- UsageAccountingRecorderProtocol,
36
34
  UsageAccountingSource,
37
35
  utc_now,
38
36
  )
39
37
  from motor.motor_asyncio import AsyncIOMotorClient
40
38
  from neo4j import AsyncDriver as Neo4jAsyncDriver
41
- from pydantic import BaseModel, ConfigDict, SkipValidation
39
+ from pydantic import BaseModel, ConfigDict
42
40
  from pydantic_ai.usage import RunUsage
43
41
  from pymongo import ASCENDING, DESCENDING
44
42
  from pymongo.errors import DuplicateKeyError
@@ -632,6 +630,9 @@ class TaskClient:
632
630
  subtitle: Optional[str] = None,
633
631
  metadata: Optional[TaskMetadata] = None,
634
632
  language: Optional[Language] = None,
633
+ # Program AP (2.23.0): the run's thinking mode (keble_helpers
634
+ # AgentThinkingMode wire values); the framework stores it verbatim.
635
+ thinking_mode: Optional[str] = None,
635
636
  task_type: str,
636
637
  timeout_mins: int = 120,
637
638
  sharing_scope: SharingScope = SharingScope.PRIVATE,
@@ -689,6 +690,7 @@ class TaskClient:
689
690
  subtitle=subtitle,
690
691
  metadata=metadata,
691
692
  language=language,
693
+ thinking_mode=thinking_mode,
692
694
  owner=str(owner),
693
695
  consumed_token=consumed_token,
694
696
  expected_token=expected_token,
@@ -2338,8 +2340,7 @@ class TaskClient:
2338
2340
  aneo4j=aneo4j,
2339
2341
  qdrant_client=qdrant_client,
2340
2342
  task_handler_metadata=task_handler_metadata,
2341
- event_emitter=task_lifecycle_event_emitter
2342
- or AgenticEventEmitter(),
2343
+ event_emitter=task_lifecycle_event_emitter or AgenticEventEmitter(),
2343
2344
  )
2344
2345
  except Exception as exc:
2345
2346
  logger.critical(
@@ -2390,9 +2391,7 @@ class TaskClient:
2390
2391
  ):
2391
2392
  """Retry all undone tasks asynchronously."""
2392
2393
  # fetch all undone
2393
- after = utc_now() - timedelta(
2394
- minutes=include_tasks_created_within_minutes
2395
- )
2394
+ after = utc_now() - timedelta(minutes=include_tasks_created_within_minutes)
2396
2395
  db_objs = await self.crud_task.aget_multi(
2397
2396
  amongo,
2398
2397
  query=QueryBase(