š fix(needs-you): log a failed side-session read once, not every minute
Merged
AT
16d ago+172+172+012345678901234567890123456789-15-15-01234567890123456789
Why
Alok's transcripts filled with dozens of identical lines, one per minute:
needs-you: side sessions not read (SyntaxError: JSON Parse error: Unexpected identifier "No")needs-you: side sessions not read (HooksError: needs-you: $.mcp.call: no connected MCP tool "get_session" on a server named "ccd_session_mgmt")
The band polls the app's session tools every minute and logged every failed read. Two causes:
- Plain-text answers.
get_session/list_sessionsanswer some calls with prose, not JSON (checked live:get_sessionon an unknown id answersSession local_⦠not found.as an MCP error). The band JSON-parsed it. - No session tools. Where
ccd_session_mgmtis not connected (a terminal session), every read throws.
What changes
jsonOf: an answer that is an MCP error or not JSON reads asundefined, soselfstays unknown (retried quietly next minute) and a plain-text list lists nothing. No log.afterFailure(pure, exported): a missing session tool logs one line,needs-you: side sessions are not shown in this session (no app session tools), and stops reading until the session starts again. Any other failure logs once, and again only after a read succeeds.session.startresets the read state (selfId,reading,lastLogged), so a reload re-checks.- README: a paragraph on the above. Plugin
0.1.2(after #23's0.1.1).
Tests (claude plugin test packages/needs-you: 15 pass)
- plain-text and error answers: five reads across four polls, nothing logged;
- missing tool: the engine's real message stops reading with one line (unit: the test kit skips a throwing hook, so a rejection with that text can't be faked end to end);
- repeated failure: six failing reads log one line; after a success, the same failure logs once more.
Evidence from real sessions
See the comment below: two headless sessions with the plugin, one on main's copy and one on this branch, each running ~4 minutes, debug logs counted.
Coordinated with the session that wrote #23 (it merged first; this is rebased on it).
š¤ Generated with Claude Code
Summary by cubic
- Frontend: Page 1
- Cart: Cart page
- Frontend: Page 1
- Frontend: Breadcrumbs
- Description: This is an accessible page.