5.7 KiB
5.7 KiB
1. Schema and Compatibility Foundation
- 1.1 Add Flyway migration for
chat_sessionanddiagnosis_runwith indexes for uniquesession_id, uniquerun_id, latest-run lookup, and run summary listing. - 1.2 Add nullable
run_idcolumns toagent_stepandtool_invocationwith indexes for run-scoped trace queries. - 1.3 Backfill one compatibility
diagnosis_runfor each existingdiagnosis_sessionrow. - 1.4 Backfill historical
agent_step.run_idandtool_invocation.run_idfrom the compatibility run for the samesession_id. - 1.5 Add JPA entities and repositories for
ChatSessionandDiagnosisRun, including latest-run and run-id lookup methods. - 1.6 Add focused migration/repository verification that proves old data remains queryable and run lookup methods work.
- 1.7 Phase 1 gate: run the smallest relevant test/build check, inspect DB migration behavior, update OpenSpec task status, archive phase evidence, and commit before starting Phase 2.
2. Chat Run Write Path
- 2.1 Add a unified execution context that carries both
sessionIdandrunIdthrough Chat service, Agent hooks, and tool recording. - 2.2 Change valid
/api/chatexecutions to create or updatechat_sessionmetadata and create one newdiagnosis_run. - 2.3 Change
AgentLoggingHookto writeagent_step.run_idfor Chat runs while retainingsession_id. - 2.4 Change
ToolInvocationRecorderand evidence tools to writetool_invocation.run_idfor Chat runs while retainingsession_id. - 2.5 Change Chat completion, failure, answer, self-evaluation, duration, token, step, and tool count writes from
diagnosis_sessionto the currentdiagnosis_run. - 2.6 Change
ToolTraceSummaryService,ExecutorGatekeeperService, andEvaluationServiceChat reads from session-scoped tool rows to run-scoped tool rows. - 2.7 Change
/api/chatresponse DTO to include officialrunId. - 2.8 Add focused tests for valid Chat run creation, invalid request no-run behavior, run-scoped counts, run-scoped verifier/gatekeeper/evaluation reads, and multi-turn context preservation.
- 2.9 Phase 2 gate: run focused tests plus a same-session two-round Chat E2E when needed, inspect DB with
scripts/query_mysql.py, reviewlogs/, update task status, archive phase evidence, and commit before starting Phase 3.
3. Trace Read Path and Run Listing
- 3.1 Change
DiagnosisTraceServiceto resolve latest run bydiagnosis_run.created_at DESC, id DESCwhenrunIdis omitted. - 3.2 Add exact trace lookup for
sessionId + runId, including validation that the run belongs to the session. - 3.3 Change trace response DTOs to include resolved
runIdand run summary fields. - 3.4 Add
GET /api/chat/session/{sessionId}/runsreturning lightweight run summaries without expanding trace detail rows. - 3.5 Preserve read-only trace behavior for latest-run and exact-run requests.
- 3.6 Add tests for latest run, exact first run, exact second run, wrong-session run rejection, missing session, and read-only behavior.
- 3.7 Phase 3 gate: run focused trace tests and same-session E2E trace checks, update task status, archive phase evidence, and commit before starting Phase 4.
4. Feedback and Case Library Run Binding
- 4.1 Change feedback request handling to prefer
runIdand validate run/session ownership. - 4.2 Implement legacy feedback fallback to latest run with observable
fallbackToLatestRun=trueand actual boundrunId. - 4.3 Change feedback persistence to update
diagnosis_run.feedbackfor new data. - 4.4 Change
CaseLibraryServiceto create automatic cases fromdiagnosis_run.queryanddiagnosis_run.answer. - 4.5 Preserve transitional case-library semantics where old
diagnosis_idvalues may besession_idand new automatic values arerun_id. - 4.6 Add tests for run-specific feedback, legacy fallback, useful case creation, idempotency, and old-data compatibility.
- 4.7 Phase 4 gate: run focused feedback/case tests, inspect DB with
scripts/query_mysql.py, update task status, archive phase evidence, and commit before starting Phase 5.
5. AIOps Run Isolation
- 5.1 Change valid
/api/ai_opsexecutions to creatediagnosis_runwithagent_flow=AI_OPS. - 5.2 Expose
runIdin the AIOps SSE-compatible metadata stream while preserving existing report streaming. - 5.3 Propagate
runIdthrough AIOps Agent hooks and tool recording. - 5.4 Change AIOps final report, status, counts, and
diagnosis_run.self_evaluation.aiops_rule_evaluationwrites to the current run. - 5.5 Add tests for repeated AIOps executions with the same
sessionIdand run-scoped rule evaluation. - 5.6 Phase 5 gate: run focused AIOps tests and E2E when needed, inspect DB/logs, update task status, archive phase evidence, and commit before starting Phase 6.
6. Demo, Trace UI, Documentation, and Verification
- 6.1 Update demo scripts to read
runIdfrom Chat/AIOps responses and pass?runId=...to Trace API. - 6.2 Update Trace UI to accept
?sessionId=...&runId=...and query exact trace whenrunIdis present. - 6.3 Update MVP table and architecture docs for
chat_session,diagnosis_run,run_id, and transitionalcase_library.diagnosis_idsemantics. - 6.4 Run final same-session multi-turn E2E using Maven startup if needed; collect DB evidence through
scripts/query_mysql.pyand inspectlogs/. - 6.5 Run or explicitly evaluate the relevant baseline diff command and document whether drift is expected or a regression.
- 6.6 Final gate: ensure all OpenSpec tasks are checked, no new writes depend on
diagnosis_session, phase evidence is archived, final commit is created, and the change is ready for OpenSpec archive.