|
|
@@ -0,0 +1,36 @@
|
|
|
+# Todo 49.2 Session Load Race and Visible Repair Plan
|
|
|
+
|
|
|
+**Status:** in_progress
|
|
|
+
|
|
|
+## Goal
|
|
|
+
|
|
|
+Close reviewed session restoration races without changing the completed Todo 49/49.1 records.
|
|
|
+
|
|
|
+## Scope
|
|
|
+
|
|
|
+- Guard asynchronous session replay with a monotonically increasing load token and the selected session id so stale responses cannot overwrite current UI state.
|
|
|
+- Ignore stale success and failure status updates from superseded loads.
|
|
|
+- Treat whitespace-only assistant content with `tool_calls` as protocol-only in replay.
|
|
|
+- When repairing an incomplete persisted tool-call group, retain non-blank assistant content as a provider-valid assistant message without `tool_calls`; continue dropping orphan tool replies.
|
|
|
+
|
|
|
+## Files
|
|
|
+
|
|
|
+- Modify: `src/agent_lab/application/runtime.py`
|
|
|
+- Modify: `src/agent_lab/presentation/static/app.js`
|
|
|
+- Modify: `tests/test_debug_runtime.py`
|
|
|
+- Modify: `tests/test_websocket_api.py`
|
|
|
+
|
|
|
+## Requirement Execution Loop
|
|
|
+
|
|
|
+### Plan
|
|
|
+
|
|
|
+1. Add RED tests for out-of-order session replay, whitespace-only protocol messages, and incomplete tool rounds with visible text.
|
|
|
+2. Add the smallest load-token and transcript-repair changes.
|
|
|
+3. Run focused tests, JS syntax, full tests, diff check, and bounded review.
|
|
|
+
|
|
|
+## Verification
|
|
|
+
|
|
|
+- `uv run pytest tests/test_debug_runtime.py tests/test_websocket_api.py -q`
|
|
|
+- `node --check src/agent_lab/presentation/static/app.js`
|
|
|
+- `uv run pytest`
|
|
|
+- `git diff --check`
|