feat(inbox): agent-actionable — mark-read + rich JSON metadata (0.13.0)#26
Conversation
Actions: --read <id> (repeatable) marks notification(s) read via
notificationUpdate; --read-all via notificationMarkReadAll. Richer --json:
each notification now carries issue{identifier,url,state}, comment{id,url,body},
parentComment (thread), actor, and the notification url/inboxUrl — enough for an
agent to follow the ticket/thread and act (reply via 'linear update <id>
--comment'). Listing prints the follow-up recipe. 0.12.0 -> 0.13.0; adds a
mark-read unit test.
Code ReviewerVerdict: Changes requested (minor) Build: N/A — single-file Python script, no build step. No Changes that work well
Issues that need attention1. success = (((data.get("data") or {}).get("notificationUpdate") or {}).get("success"))
(ok if success and "errors" not in data else failed).append(nid)Every other per-item mutation loop in this file calls An agent (or human) hitting a bad id, a permissions error, or a rate limit gets no signal why the mutation failed — just the bare id back. Suggest reusing 2. if getattr(args, "read_all", False):
data = gql(api_key, "mutation { notificationMarkReadAll { success } }")
if check_errors(data):
return
ok = (((data.get("data") or {}).get("notificationMarkReadAll") or {}).get("success"))
print("Marked all notifications read." if ok else "Failed to mark all read.")
returnIf the mutation returns if check_errors(data) or not (data.get("data") or {}).get("projectDelete", {}).get("success"):
print("Project remove failed.", file=sys.stderr)
sys.exit(1)Since the whole point of this PR is to make Neither of these is covered by the new test — it only exercises the all-succeed path for Things to verify manually
Reviewed by Code Reviewer — actually ran the build and tests on this branch. |
… --read-all failure 1. _mark_notifications_read now calls check_errors(data) per iteration so a bad id / permission / rate-limit error prints 'Error: <message>' to stderr, matching the other per-item mutation loops (was swallowing data['errors']). 2. --read-all now prints failure to stderr and sys.exit(1) on success:false, consistent with --read and the projectDelete convention.
Code ReviewerVerdict: Ready to merge Build: Green — No repo-level Changes that work well
Things to verify manually
Reviewed by Code Reviewer — actually ran the build and tests on this branch. |
What
Makes
linear inboxactionable for agents (follow-up to #25).Actions
linear inbox --read <id>— mark notification(s) read (repeatable)linear inbox --read-all— mark everything readRicher
--json— each notification now carries enough to follow the ticket/thread and act:issue { identifier, url, state }— to open/comment on the ticketcomment { id, url, body }+parentComment— the threadactor, notificationurl/inboxUrl,type,readAtComment back uses the existing surface: an agent reads the
issue.identifierfrom--json, thenlinear update <identifier> --comment "...". The plain listing now prints this recipe.Verified
python3 -m unittest— 24/24 pass (added a mark-read test asserting onenotificationUpdateper id).--jsonreturns the full metadata set;inbox --read <id>marked a notification read (tested non-destructively on an already-read one);--read/--read-allin--help.Backed by
notificationUpdate/notificationMarkReadAll(schema-introspected). 0.12.0 -> 0.13.0.