fix(linear-slack): actually create Linear issues (stop fabricating them)

Merged
KH
5mo ago
+312-16

The bug (the second half of the investigation)

#53 fixed Slack delivery. This fixes correctness: when asked to make an issue, linear-slack never actually created one.

The harness "created" the issue by hand-writing a file into the read-only Linear mirror — inventing the AR-83 ref + a UUID and copying an existing issue's full shape (including read-only fields the Linear writeback explicitly rejects). That is not a Linear mutation, so nothing was created — yet the reply said "Done! Created AR-83…". (The adapter's create path is POST /linear/issues/<draft>.json → issueCreate, requiring a bare IssueCreateInput with teamId + title, no id/identifier.)

The fix: route writes through the real writeback, confirm by receipt

Reads stay in the VFS (the whole point of this persona). Writes no longer touch the filesystem — the harness emits a structured block the handler executes via linearClient():

  • persona.ts — the harness treats ./linear as read-only; to change the board it resolves real ids from the VFS and emits one fenced block:
    [ { "action": "create_issue", "teamId": "<uuid>", "title": "…", "projectId": "<uuid>" } ]
    
    It must not invent ids/refs, must not announce success in prose, and is told a milestone can't be set on create (so it stops claiming it did).
  • agent.ts — parses the block and runs each action through linearClient().createIssue() / .comment() (draft → issueCreate → receipt). It allow-lists IssueCreateInput fields so a stray read-only field can't fail the create, and reports the confirmed Linear url. Crucially, relay-helpers created() falls back to the draft path when no receipt arrives (the same swallow-the-timeout footgun as Slack), so a non-http url is surfaced as "unconfirmed — please double-check" instead of claimed done. Missing/again-unresolvable ids are refused, not guessed.

Behaviour now

AskBeforeAfter
"make an issue …"fake AR-83, false "Done!"real issueCreate, reply links the confirmed issue
writeback didn't ackclaimed success"submitted but Linear didn't confirm — double-check"
missing teamId/titleinvented oneasks instead of guessing
just discussing(n/a)prose only, no writes

Test

New tests/linear-slack-agent.test.mjs: confirmed create, unconfirmed (no-receipt) create, missing-id refusal, comment, read-only turn, malformed block. npm test 60/60, npm run typecheck clean.

Follow-up to #53. Framework-level "make writeback failures loud" is still tracked in AgentWorkforce/cloud#2029.

🤖 Generated with Claude Code


Summary by cubic

Fixes a bug where linear-slack claimed it created issues without actually doing so. Writes now go through the real Linear writeback, and replies include confirmed Linear links or a clear unconfirmed warning.

  • Bug Fixes
    • Route board writes via linearClient() and report only confirmed URLs; flag unconfirmed writes instead of claiming success.
    • Treat ./linear as read-only; the persona emits a single linear-actions block (create_issue, comment) using real IDs only and no success prose.
    • Allow-list IssueCreateInput fields to avoid read-only rejections; refuse missing IDs and malformed action blocks without changing anything.
    • Added tests for confirmed/unconfirmed creates, missing-ID refusal, comments, read-only turns, and malformed blocks.