T0: absorb shared/ into backend — cot_logger→src/core, CotJsonFormatter→src/core/cot_formatter.py, _llm_http/_llm_health/ssl→src/core/utils; imports rewritten (26 prod + tests, patch targets); run.sh/backend.Dockerfile/requirements/.axiom source_dirs/semantic_health/AGENTS/INSTALL cleaned; ADR-0022 supersedes ADR-0015; fixed latent CI defects (ss_tools ImportError, record.message in logger tests, same-name test-module collision). ADR-0021 wire enrichment (additive): contract_id/claim/error_code/loc fields; _contract_id ContextVar + resolve_contract_id (explicit > belief_scope > declared-src mirror, derived src never mirrors); EXPLORE auto-loc via single frame walk; facade error auto-fill; 2KB payload cap with payload_truncated/payload_bytes markers; migrated 85 error="CODE" sites to error_code= (12 files); pilot editor/load.py; superset preview payload-bomb inlined bodies removed. Analytics SSOT src/core/log_stats.py (bond transition matrix, orphan-EXPLORE ratio, REFLECT pairing, intent families, coverage, insufficient-sample flag); pretty_cot.py --stats/--digest/--trajectory/--story over one engine; log_gap_service three-tier ground-truth triangulation (FAILED w/o EXPLORE etc.) + GET /api/reports/log-stats|task-log-gaps (polling-suppressed); scripts/cot_audit.py CLI; enriched fields persisted into task_logs.payload for tier queries. Frontend: ReportsAnalyticsModel + AnalyticsStatsPanel (Logs tab) + TaskGapPanel and per-row T1/T2/T3 gap badges (Tasks tab); cot-logger.ts ADR-0021 opts; i18n en/ru. Scheduler console spam fixed: apscheduler logger demoted to WARNING via LoggingConfig.scheduler_log_level. .axiom belief patterns -> $OBJ.* (alias undercount). molecular-cot-logging skill updated (fields, decision rules, tie-break, CLI) and synced. Reviewed orthogonally: F1 cot_span contract pollution, F2 cap boundary accounting, F3 digest over-dedup, F4 trace-state bound, F5 tier metadata — fixed with regression tests. Validation: backend 11287 passed + ruff + compileall; frontend 3446 passed + lint + build; CLI smoke on live app.log.
1.9 KiB
1.9 KiB
@{ Doc.Adr.ADR0015 [C:1] [TYPE ADR]
@STATUS SUPERSEDED
@REPLACED_BY Doc.Adr.ADR0022
@BRIEF Define package and Docker boundaries for the standalone conversational agent and its shared utilities.
@RELATION BINDS_TO -> [agent/pyproject.toml]
@RELATION BINDS_TO -> [shared/pyproject.toml]
@RELATION BINDS_TO -> [docker/Dockerfile.agent]
@RATIONALE The agent has a different Python runtime and dependency surface from the FastAPI backend. Keeping it under backend/src made Docker copy rules fragile and coupled agent imports to backend internals.
@REJECTED Copying selected backend/src/core modules into the agent image — rejected because package extraction provides explicit dependencies and makes the container build reproducible.
@REJECTED Copying the complete backend into the agent image — rejected because it expands the dependency and security surface without a runtime need.
Decision
The conversational agent and common lightweight utilities are independent Python packages:
agent/ # ss-tools-agent, Python >=3.11
shared/ # ss-tools-shared, Python >=3.11
backend/ # FastAPI application, its own runtime boundary
docker/Dockerfile.agent # installs shared first, then agent
docker/Dockerfile.agent copies and installs shared/ and agent/ as editable
packages. It must not copy backend/src to satisfy agent imports. Shared code is
limited to utilities that have no dependency on backend API, models, database, or
service layers. Dependencies required only by the agent belong in agent/.
Consequences
- Agent dependencies can evolve independently from the backend image.
- Imports between agent and backend require an explicit API or shared-package contract; direct imports across those boundaries are forbidden.
- A change to the agent Docker build must be verified with
docker buildusing the repository root as build context.