4.2 KiB
4.2 KiB
Phase 2 Evidence: Chat Run Write Path
Date: 2026-07-10
Scope
Phase 2 switched Chat writes from session-scoped execution state to run-scoped execution state:
- Chat creates/updates
chat_sessionmetadata. - Each valid
/api/chatexecution creates onediagnosis_run. - Chat execution context carries
sessionId + runIdthroughRunnableConfigandSessionContextHolder. agent_step.run_idandtool_invocation.run_idare written for Chat runs.- Chat completion/failure/status/answer/self-evaluation/counts are written to
diagnosis_run. - verifier/gatekeeper/evaluation reads use run-scoped tool rows when
runIdis available. /api/chatresponse includes officialrunId.
Static / Unit Verification
Commands:
mvn -q clean test-compile
mvn -q "-Dtest=ChatControllerTest,ChatServiceSequentialAgentTest,ToolInvocationRecorderTest,ToolTraceSummaryServiceTest,ExecutorGatekeeperServiceTest" test
openspec validate session-run-trace-isolation --strict
Result:
test-compilepassed.- Focused Phase 2 tests passed.
- OpenSpec strict validation passed.
Focused coverage:
- valid Chat creates
chat_sessionanddiagnosis_run; - invalid blank Chat request returns before
ChatService, so no run is created; - same
sessionIdacross two Chat turns creates two distinctrunIdvalues; ToolInvocationRecordercopiesrunIdfrom execution context;- verifier trace summary reads by run;
- gatekeeper validates by run;
- evaluation writes rule evaluation to
diagnosis_run.self_evaluation.
E2E Verification
Startup command:
mvn spring-boot:run -Dspring-boot.run.profiles=mvp-demo
Process stdout/stderr:
target/e2e/phase2-mvn-20260710-185102.out.logtarget/e2e/phase2-mvn-20260710-185102.err.log
Primary E2E session:
sessionId = e2e-phase2-codex-20260710-1856
round 1 runId = run-24b6f04c-94a0-43cb-b94f-4f0141f9050d
round 2 runId = run-a7a2be77-697f-495a-a779-91afd1d8589c
HTTP evidence:
target/e2e/phase2-utf8-request-round1.jsontarget/e2e/phase2-utf8-response-round1.jsontarget/e2e/phase2-utf8-request-round2.jsontarget/e2e/phase2-utf8-response-round2.json- both Chat responses returned
code=200,data.success=true, the samesessionId, and distinctrunIdvalues.
Redis/session continuity evidence:
target/e2e/phase2-utf8-chat-session-response.json- response returned
messagePairCount=2. - logs show the second request entered with
会话历史消息对数: 1and completed with当前消息对数: 2.
Database Inspection
DB inspection used scripts/query_mysql.py.
Saved query outputs:
target/e2e/phase2-utf8-db-runs.txttarget/e2e/phase2-utf8-db-chat-session.txttarget/e2e/phase2-utf8-db-agent-steps.txttarget/e2e/phase2-utf8-db-tool-invocations.txttarget/e2e/phase2-utf8-db-missing-runid.txt
Observed rows:
diagnosis_run:
run-24b6f04c-94a0-43cb-b94f-4f0141f9050d | SUCCESS | CHAT | step_count=8 | tool_call_count=12
run-a7a2be77-697f-495a-a779-91afd1d8589c | SUCCESS | CHAT | step_count=2 | tool_call_count=1
chat_session:
e2e-phase2-codex-20260710-1856 | ACTIVE | message_pair_count=2
agent_step grouped by run_id:
run-24b6f04c-94a0-43cb-b94f-4f0141f9050d | 8
run-a7a2be77-697f-495a-a779-91afd1d8589c | 2
tool_invocation grouped by run_id:
run-24b6f04c-94a0-43cb-b94f-4f0141f9050d | 12
run-a7a2be77-697f-495a-a779-91afd1d8589c | 1
missing run_id for this session:
agent_step = 0
tool_invocation = 0
Log Review
Saved log excerpts:
target/e2e/phase2-utf8-application-log-excerpt.txttarget/e2e/phase2-utf8-mvn-log-excerpt.txt
Findings:
- Chat logs show second turn reused Redis history for the same session.
EvaluationServicewrote scoring results to both run ids.- No E2E-specific application exception was observed for
e2e-phase2-codex-20260710-1856. - Earlier
/actuator/healthprobes produced expected 500/no-resource noise because the actuator health endpoint is not exposed; the E2E readiness check used/api/chatinstead.
Notes
codebase-retrieval and LSP tools were not available in this environment. Call-chain confirmation used OpenSpec context, rg, targeted file reads, compilation, focused tests, E2E, DB inspection, and logs.