From e6a42d9297e7e863e8be65826addd3e68677e10e Mon Sep 17 00:00:00 2001 From: Mikhail Putilovskij Date: Sun, 19 Apr 2026 21:22:19 +0300 Subject: [PATCH] =?UTF-8?q?wip:=20pause=20session=20=E2=80=94=203=20fixes?= =?UTF-8?q?=20committed,=20file=20ingestion=20next?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .planning/HANDOFF.json | 78 +++++++++++------------------------------- 1 file changed, 20 insertions(+), 58 deletions(-) diff --git a/.planning/HANDOFF.json b/.planning/HANDOFF.json index 0f01358..630bd40 100644 --- a/.planning/HANDOFF.json +++ b/.planning/HANDOFF.json @@ -1,6 +1,6 @@ { "version": "1.0", - "timestamp": "2026-04-17T12:34:43.144Z", + "timestamp": "2026-04-19T18:21:44.189Z", "phase": "04", "phase_name": "Matrix MVP: shared agent context and context management commands", "phase_dir": ".planning/phases/04-matrix-mvp-shared-agent-context-and-context-management-comma", @@ -9,68 +9,30 @@ "total_tasks": null, "status": "paused", "completed_tasks": [ - {"id": 1, "name": "Phase 4 CONTEXT.md — design decisions from session", "status": "done"}, - {"id": 2, "name": "Phase 4 RESEARCH.md — AgentApi lifecycle, platform findings", "status": "done"}, - {"id": 3, "name": "Phase 4 planning — 3 PLAN.md files (planner + checker + revision)", "status": "done"} + {"id": 1, "name": "fix(sdk): correct WebSocket URL — /agent_ws/?thread_id= instead of /v1/agent_ws/{id}/", "status": "done", "commit": "fbcf449"}, + {"id": 2, "name": "docs: README runbook for Matrix + platform-agent setup, feature status table", "status": "done", "commit": "b333146"}, + {"id": 3, "name": "feat(matrix): !reset via new platform_chat_id — no platform endpoint needed", "status": "done", "commit": "73c472e"} ], "remaining_tasks": [ - {"id": 4, "name": "Execute 04-01: Replace AgentSessionClient with AgentApi + AgentApiWrapper", "status": "not_started"}, - {"id": 5, "name": "Execute 04-02: !save/!load/!reset/!context commands + PrototypeStateStore extensions", "status": "not_started"}, - {"id": 6, "name": "Execute 04-03: Dockerfile + docker-compose.yml + .env.example", "status": "not_started"} + {"id": 4, "name": "File ingestion MVP — inline text content for text/code/PDF files", "status": "not_started"}, + {"id": 5, "name": "Execute original Phase 4 plans (04-01, 04-02, 04-03) if still relevant", "status": "not_started"} + ], + "blockers": [ + {"description": "!save/!load cross-chat broken — StateBackend files are per thread_id, not shared", "type": "external", "workaround": "inform user; full fix requires FilesystemBackend in platform-agent"}, + {"description": "tokens_used always 0 — platform-agent hardcodes MsgEventEnd(tokens_used=0)", "type": "external", "workaround": "none until platform fixes it"}, + {"description": "File attachments — no upload API, StateBackend has no upload_files support", "type": "external", "workaround": "inline text content for text/code/PDF (MVP)"} ], - "blockers": [], "human_actions_pending": [ - { - "action": "Request platform team to add POST /reset endpoint to platform-agent", - "context": "!reset needs POST {AGENT_BASE_URL}/reset to reinitialize AgentService singleton. Currently returns unavailable. ~3 lines on their side.", - "blocking": false - }, - { - "action": "Rotate credentials used during manual testing", - "context": "Matrix password and OpenRouter API key sk-or-v1-d27c07... were shared in chat session.", - "blocking": false - } + {"action": "Send platform team the file upload ТЗ (POST /upload endpoint, python-multipart, aiofiles)", "context": "Documented in session — 3 files, ~20 lines total change on their side", "blocking": false}, + {"action": "Ask platform team to fix tokens_used in MsgEventEnd (hardcoded 0)", "context": "One line fix in external/platform-agent/src/api/external.py", "blocking": false} ], "decisions": [ - { - "decision": "Wrap AgentApi in AgentApiWrapper (sdk/agent_api_wrapper.py) to add last_tokens_used tracking", - "rationale": "AgentApi.send_message() drops MsgEventEnd without yielding it. Wrapper subclasses AgentApi and overrides _listen() to capture tokens_used. Avoids modifying external/ platform package.", - "phase": "04" - }, - { - "decision": "Remove build_thread_key and thread_id from WS URL entirely", - "rationale": "platform-agent origin/main does not support thread_id query param. Architecture: one container = one chat = isolated context by design.", - "phase": "04" - }, - { - "decision": "!reset calls POST /AGENT_BASE_URL/reset, returns unavailable message if 404", - "rationale": "MemorySaver is in-memory — endpoint reinitializes singleton. Endpoint not yet in platform-agent origin/main.", - "phase": "04" - }, - { - "decision": "!save/!load are agent-mediated via formatted text messages to the agent", - "rationale": "Agent has write_file/read_file tools for /workspace/contexts/. No direct FS access from surfaces-bot to agent container.", - "phase": "04" - }, - { - "decision": "!load numeric selection intercepted in on_room_message before dispatcher.dispatch()", - "rationale": "Numeric input arrives as IncomingMessage not IncomingCommand. Keeps dispatcher clean.", - "phase": "04" - } + {"decision": "!reset assigns new platform_chat_id (matrix:!roomId#timestamp) instead of calling /reset endpoint", "rationale": "thread_id in LangGraph is just a string key — new ID = fresh context, no platform changes needed", "phase": "04"}, + {"decision": "AgentApiWrapper._build_ws_url uses /agent_ws/?thread_id={chat_id}", "rationale": "platform-agent only exposes /agent_ws/ with thread_id query param, not path segments", "phase": "04"}, + {"decision": "StateBackend is platform-agent default — no real /workspace filesystem exists", "rationale": "create_deep_agent() called without backend param defaults to StateBackend (in-memory)", "phase": "04"}, + {"decision": "platform-agent is a 6-commit prototype — no Docker, no isolation, MemorySaver in-memory", "rationale": "Intentional placeholder while Master + LXC infra is built by platform team", "phase": "04"} ], - "uncommitted_files": [ - ".planning/STATE.md", - ".planning/HANDOFF.json", - ".planning/phases/04-matrix-mvp-shared-agent-context-and-context-management-comma/04-CONTEXT.md", - ".planning/phases/04-matrix-mvp-shared-agent-context-and-context-management-comma/04-RESEARCH.md", - ".planning/phases/04-matrix-mvp-shared-agent-context-and-context-management-comma/04-01-PLAN.md", - ".planning/phases/04-matrix-mvp-shared-agent-context-and-context-management-comma/04-02-PLAN.md", - ".planning/phases/04-matrix-mvp-shared-agent-context-and-context-management-comma/04-03-PLAN.md", - "adapter/matrix/bot.py", - "sdk/agent_session.py", - "tests/adapter/matrix/test_dispatcher.py", - "tests/platform/test_agent_session.py" - ], - "next_action": "Pull platform-agent origin/main (git -C external/platform-agent pull), then execute Phase 4: /gsd-execute-phase 4. Wave 1: 04-01 alone. Wave 2: 04-02 + 04-03 in parallel.", - "context_notes": "Phase 4 planning complete and verified (1 checker revision round). Plans are ready to execute. Key gotcha: lambda_agent_api pyproject.toml says requires-python>=3.14 but runs on 3.11 — Dockerfile needs uv pip install --ignore-requires-python. platform-agent local clone is 11 commits behind origin/main — must pull before execution. Wave structure: 04-01 (Wave 1, alone) → 04-02 + 04-03 (Wave 2, parallel). All old thread_id/AgentSessionClient logic gets replaced — sdk/agent_session.py becomes mostly dead code or deleted." + "uncommitted_files": [], + "next_action": "File ingestion MVP: handle Matrix m.file/m.image events, inline text content for text/code/PDF, honest decline for binary/images", + "context_notes": "Session was architectural investigation + 3 hotfixes. Key finding: platform-agent is much more primitive than assumed (StateBackend not FilesystemBackend, no Docker, singleton process). All 3 fixes are committed and pushed to feat/matrix-direct-agent-prototype (now 29 commits ahead of main). 163 tests green." }