diff --git a/cmd/core-runtime/main.go b/cmd/core-runtime/main.go index 8f371e5..9083494 100644 --- a/cmd/core-runtime/main.go +++ b/cmd/core-runtime/main.go @@ -1483,6 +1483,10 @@ func main() { candidates, err = capabilityRepository.LoadCognitiveCandidates(r.Context(), requirement.CapabilityID, requirement.OwnerPrincipalID) } if err != nil { + // The resolver is an internal capability boundary. Keep request identity + // and content out of logs, but preserve the repository error so a 503 + // can be distinguished from a true empty/unsuitable binding set. + log.Printf("cognitive registry resolve unavailable: %v", err) http.Error(w, "cognitive registry unavailable", http.StatusServiceUnavailable) return } diff --git a/dev/ACTIVE_TASK.json b/dev/ACTIVE_TASK.json index 386c9a6..d7a3af1 100644 --- a/dev/ACTIVE_TASK.json +++ b/dev/ACTIVE_TASK.json @@ -1 +1 @@ -{"task_file":"dev/tasks/GEN2-DEPLOY-003-isolated-release-slots.json","task_id":"GEN2-DEPLOY-003","task_revision":1} +{"task_file":"dev/tasks/GEN2-COGNITIVE-002-restore-production-cognitive-route.json","task_id":"GEN2-COGNITIVE-002","task_revision":1} diff --git a/dev/tasks/GEN2-COGNITIVE-002-restore-production-cognitive-route.json b/dev/tasks/GEN2-COGNITIVE-002-restore-production-cognitive-route.json new file mode 100644 index 0000000..b95ba7f --- /dev/null +++ b/dev/tasks/GEN2-COGNITIVE-002-restore-production-cognitive-route.json @@ -0,0 +1,61 @@ +{ + "task_id": "GEN2-COGNITIVE-002", + "task_revision": 1, + "architecture_revision": "ARCH-GEN2-000", + "base_repo_revision": "gen2-integration", + "risk_tier": "E", + "intent": "Восстановить доказанно рабочий production cognitive route для обычного household и memory-recall запроса через существующие Capability и Cognitive Gateway boundaries, без подмены primary route Lifeboat-ом.", + "requirement_ids": ["REQ-GEN2-COGNITIVE-002-TRACE", "REQ-GEN2-COGNITIVE-002-ROUTING", "REQ-GEN2-COGNITIVE-002-RECOVERY"], + "allowed_change_scope": { + "modules": ["capability", "cognitive-worker", "core-runtime", "production deployment"], + "paths": [ + "cmd/cognitive-worker/**", + "cmd/core-runtime/**", + "contracts/capability/**", + "contracts/cognitive/**", + "modules/capability/**", + "adapters/models/**", + "adapters/postgres/capability_repository.go", + "deploy/run-production-canary.sh", + "deploy/docker-compose.candidate-slot.yml", + "tests/**", + "docs/evidence/**", + "docs/**", + "dev/ACTIVE_TASK.json", + "dev/tasks/GEN2-COGNITIVE-002-restore-production-cognitive-route.json" + ] + }, + "forbidden_change_scope": { + "paths": ["architecture/**", "security/**", "database/**", "go.mod", "go.sum", ".gitea/workflows/**", "GEN2-028", "GEN2-029", "GEN2-030"] + }, + "allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 1, "new_third_party_dependencies": 0, "new_database_owner_roles": 0}, + "contracts": { + "consume": ["existing Capability binding lifecycle", "existing cognitive gateway/advisory contracts", "existing Supervisor ReleaseSet control plane"], + "may_change": ["typed capability/provider selection and invocation wiring only within declared paths"] + }, + "semantic_owner": "Capability remains the sole owner of provider/model/binding lifecycle; cognitive-worker invokes providers through adapters; Core consumes the governed gateway; Supervisor alone controls traffic promotion and rollback.", + "canonical_state": ["existing Capability provider/model/binding/evaluation evidence", "no new canonical writer, owner, schema, role, or migration"], + "state_transitions": ["trace stable and candidate loaded binding heads -> correct stale/divergent lifecycle or invocation defect -> governed repair/qualification -> isolated candidate validation -> Supervisor canary -> promote or rollback"], + "side_effects_and_privileges": ["production candidate deployment and Supervisor canary/promotion are explicitly authorized", "adapters/models/** may change only after trace proves a model adapter, provider endpoint, injection, timeout, rate-limit, context budget, or invocation defect there", "cmd/core-runtime/** may change only after trace proves Core-to-worker request construction, route selection, or response handling is causal", "no direct SQL semantic mutation", "no credential, cookie, token, prompt, or user content read/emitted", "Lifeboat may be observed as fallback but cannot mask Local MEDIUM primary failure"], + "persistence_and_migrations": ["no schema/migration change is authorized", "adapters/postgres/capability_repository.go may change only after trace proves durable Capability head/state loading diverges from the correct persisted state; reuse its existing repository boundary"], + "failure_retry_restart": ["discovery health, invocation health, and availability remain distinct", "CPU/GPU gaps must not suppress a valid Local MEDIUM", "restart reloads a durable active/validated binding head", "failed candidate rolls traffic to Supervisor LKG without stable recreation"], + "assumptions": ["isolated candidate slot B and Supervisor controls from GEN2-DEPLOY-003 are available", "an existing authenticated production session may be used only through ordinary runtime interaction", "GEN2-COMPAT-OBS-001 remains paused and V1 paths remain unchanged"], + "acceptance_scenarios": [ + "COGNITIVE-002-SCN-01: factual stable/candidate trace records Core request, requirement, binding selection, loaded binding head, fleet availability, provider eligibility, invocation result, and response/error without sensitive content", + "COGNITIVE-002-SCN-02: Local MEDIUM is shown ACTIVE, VALIDATED, AVAILABLE, and actually invoked for bounded OK, Russian household, and prepared-context recall requests", + "COGNITIVE-002-SCN-03: health endpoint success alone is not used as inference proof; discovery and invocation failures are separately classified", + "COGNITIVE-002-SCN-04: candidate four-component health/revision check, real canary household request, memory write/multiple turns/recall, and candidate Core plus cognitive-worker restart/recovery pass", + "COGNITIVE-002-SCN-05: only after candidate success, Supervisor promotes it; evidence retains LKG and rollback readiness", + "COGNITIVE-002-EXIT: ordinary household and memory-recall response use Local MEDIUM through the governed route and remain usable after candidate restart" + ], + "required_tests": [ + "FAST: targeted go test ./cmd/cognitive-worker/... ./cmd/core-runtime/... ./modules/capability/... ./adapters/models/... ./adapters/postgres/... only for changed packages", + "FAST: targeted go vet for changed packages", + "FAST governance: go run ./cmd/devctl preflight -active dev/ACTIVE_TASK.json", + "FAST scope: go run ./cmd/devctl check-diff -active dev/ACTIVE_TASK.json", + "FAST independent: go run ./cmd/devctl/independent", + "FAST whitespace: git diff --check gen2-integration --", + "production: stable/candidate trace, isolated candidate health/canary, Local MEDIUM invocation, restart recovery, and Supervisor promotion/rollback evidence" + ], + "terminal_gap_states": ["BLOCKED_BY_SPEC_GAP", "BLOCKED_BY_ARCHITECTURE_GAP", "BLOCKED_BY_MISSING_CAPABILITY", "BLOCKED_BY_CONFLICT", "REQUIRES_MIGRATION_DECISION"] +}