375 lines · 11.0 KB · JSONRaw
{ "pair": "sessions", "rust": "crates/cotton-tools/src/mcp/handlers/records_2/sessions.rs", "worker": "apps/business/src/mcp/tools/sessions/log.ts, list.ts", "cases": [ { "name": "log_session refusals", "steps": [ { "tool": "log_session", "args": { "tool": "notepad", "externalId": "x", "machine": "mac-a", "lastActiveAt": "2026-08-01T10:00:00Z" }, "expect": { "refusal": "tool must be one of claude-code, codex, kimi, gemini, opencode, other" } }, { "tool": "log_session", "args": { "tool": "claude-code", "machine": "mac-a", "lastActiveAt": "2026-08-01T10:00:00Z" }, "expect": { "refusal": "externalId is required — the tool's own session id" } }, { "tool": "log_session", "args": { "tool": "claude-code", "externalId": "x", "lastActiveAt": "2026-08-01T10:00:00Z" }, "expect": { "refusal": "machine is required — this machine's hostname" } }, { "tool": "log_session", "args": { "tool": "claude-code", "externalId": "x", "machine": "mac-a", "lastActiveAt": "yesterday" }, "expect": { "refusal": "lastActiveAt must be an ISO-8601 timestamp" } }, { "tool": "log_session", "args": { "tool": "claude-code", "externalId": "x", "machine": "mac-a", "lastActiveAt": "2026-08-01T10:00:00Z", "turnCount": -1 }, "expect": { "refusal": "turnCount must be a non-negative integer" } }, { "tool": "log_session", "args": { "tool": "claude-code", "externalId": "x", "machine": "mac-a", "lastActiveAt": "2026-08-01T10:00:00Z", "prompts": "hello" }, "expect": { "refusal": "prompts must be an array" } } ] }, { "name": "list and get refusals", "steps": [ { "tool": "list_sessions", "args": { "since": "last week" }, "expect": { "refusal": "since must be an ISO 8601 timestamp" } }, { "tool": "list_sessions", "args": { "cursor": "not-a-cursor" }, "expect": { "refusal": "cursor is not one list_sessions handed out — pass nextCursor from the previous page exactly as it came, or drop it to start the list again" } }, { "tool": "get_session", "args": {}, "expect": { "refusal": "sessionId is required — the id list_sessions answers with" } }, { "tool": "get_session", "args": { "sessionId": "00000000-0000-4000-8000-000000000999" }, "expect": { "refusal": "no session with id 00000000-0000-4000-8000-000000000999" } } ] } ], "differs": [ { "name": "log a session filed by its remote, then read it back", "why": "A session logged with no prompt reads prompt \"\" on the phone and null on the Worker (list_sessions and get_session).", "seed": [ { "kind": "project", "id": "00000000-0000-4000-8000-000000000001", "data": { "slug": "widgets", "name": "Widgets", "repos": [ "https://git.example.test/acme/widgets.git" ], "status": "active" } } ], "steps": [ { "tool": "log_session", "args": { "tool": "claude-code", "externalId": "golden-a", "machine": "mac-a", "lastActiveAt": "2026-08-01T10:00:00Z", "startedAt": "2026-08-01T10:00:00Z", "turnCount": 0, "repoUrl": "git@git.example.test:acme/widgets.git", "branch": "main", "cwd": "/work/widgets", "title": "mac-a · widgets" }, "expect": { "answer": { "sessionId": "<id1>", "promptCount": 0, "inserted": 0 } } }, { "tool": "log_session", "args": { "tool": "claude-code", "externalId": "golden-a", "machine": "mac-a", "lastActiveAt": "2026-08-01T10:05:00Z", "turnCount": 1, "prompts": [ { "seq": 0, "ts": "2026-08-01T10:01:00Z", "text": "Add the widget count." } ] }, "expect": { "answer": { "sessionId": "<id1>", "promptCount": 1, "inserted": 1 } } }, { "tool": "list_sessions", "args": {}, "rust": { "answer": { "sessions": [ { "id": "<id1>", "tool": "claude-code", "externalId": "golden-a", "machine": "mac-a", "deviceId": null, "account": null, "project": "widgets", "repoUrl": "git.example.test/acme/widgets", "branch": "main", "startedAt": "<instant>", "lastActiveAt": "<instant>", "endedAt": null, "title": "mac-a · widgets", "model": null, "summary": null, "shipped": [], "turnCount": 1, "promptCount": 1, "transcriptRef": null, "state": null, "stateAt": null, "waitingKind": null, "waitingRef": null, "lastLine": null, "hostOwned": false, "prompt": "", "requestedDeviceId": null, "chosenBy": null, "holdReason": null, "error": null, "todoId": null, "todoDatabase": null, "kind": "thread", "parentSessionId": null, "tasksDone": 0, "tasksTotal": 0 } ] } }, "worker": { "answer": { "sessions": [ { "id": "<id1>", "tool": "claude-code", "externalId": "golden-a", "machine": "mac-a", "deviceId": null, "account": null, "project": "widgets", "repoUrl": "git.example.test/acme/widgets", "branch": "main", "startedAt": "<instant>", "lastActiveAt": "<instant>", "endedAt": null, "title": "mac-a · widgets", "model": null, "summary": null, "shipped": [], "turnCount": 1, "promptCount": 1, "transcriptRef": null, "state": null, "stateAt": null, "waitingKind": null, "waitingRef": null, "lastLine": null, "hostOwned": false, "prompt": null, "requestedDeviceId": null, "chosenBy": null, "holdReason": null, "error": null, "todoId": null, "todoDatabase": null, "kind": "thread", "parentSessionId": null, "tasksDone": 0, "tasksTotal": 0 } ] } } }, { "tool": "get_session", "args": { "sessionId": "{{0.sessionId}}" }, "rust": { "answer": { "id": "<id1>", "tool": "claude-code", "externalId": "golden-a", "machine": "mac-a", "deviceId": null, "account": null, "project": "widgets", "repoUrl": "git.example.test/acme/widgets", "branch": "main", "cwd": "/work/widgets", "title": "mac-a · widgets", "model": null, "prompt": "", "summary": null, "state": null, "stateAt": null, "waitingKind": null, "lastLine": null, "holdReason": null, "error": null, "todoId": null, "todoDatabase": null, "startedAt": "<instant>", "lastActiveAt": "<instant>", "endedAt": null, "hostOwned": false, "kind": "thread", "parentSessionId": null, "prompts": [ { "seq": 0, "ts": "<instant>", "role": "user", "text": "Add the widget count." } ], "tasksDone": 0, "tasksTotal": 0, "tasks": [] } }, "worker": { "answer": { "id": "<id1>", "tool": "claude-code", "externalId": "golden-a", "machine": "mac-a", "deviceId": null, "account": null, "project": "widgets", "repoUrl": "git.example.test/acme/widgets", "branch": "main", "cwd": "/work/widgets", "title": "mac-a · widgets", "model": null, "prompt": null, "summary": null, "state": null, "stateAt": null, "waitingKind": null, "lastLine": null, "holdReason": null, "error": null, "todoId": null, "todoDatabase": null, "startedAt": "<instant>", "lastActiveAt": "<instant>", "endedAt": null, "hostOwned": false, "kind": "thread", "parentSessionId": null, "prompts": [ { "seq": 0, "ts": "<instant>", "role": "user", "text": "Add the widget count." } ], "tasksDone": 0, "tasksTotal": 0, "tasks": [] } } } ] } ]}