omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(linear-app): resolve team targets and sanitize issue identifiers ($50 proposed)

Open shuoYun114 opened this issue 2 months ago • 0 comments

Summary

Currently, plugins/omi-linear-app experiences several reliability and correctness issues when managing Linear issues, teams, and workflows:

  1. Silent Misrouting of Issues: When calling tool_create_issue without a specified team_id, if the user belongs to multiple teams and no default team is configured, it silently falls back to teams[0]. This causes issues to be created in the wrong team/project. Furthermore, if a caller supplies a team key (e.g., ENG) or human-readable team name instead of an internal Linear UUID, the GraphQL mutation fails.
  2. Identifier Fragility: Callers and chat tools frequently provide issue identifiers formatted with leading prefixes (e.g., #ENG-123, issue: #ENG-123), full Linear web URLs (https://linear.app/workspace/issue/ENG-123/slug), or untyped primitives, causing issue(id: ...) queries to fail or throw unhandled exceptions.
  3. GraphQL Null-Field Crashes: If an issue's GraphQL response contains null optional fields (such as team: null, state: null, project: null, or labels: null), tool_get_issue and tool_update_issue_status crash with AttributeError or KeyError upon property access. Furthermore, if teams or states return nodes: null, iteration crashes with TypeError: 'NoneType' object is not iterable (causing a 500 error on the home route).
  4. State Lookup Space-Leak: Passing whitespace-only or non-string status values to find_state_by_name triggers weak partial matching or crashes with AttributeError: 'int' object has no attribute 'strip'.
  5. Tool Manifest Gap: linear_create_issue in /.well-known/omi-tools.json omitted team and status parameter definitions, preventing LLMs from passing team targets after ambiguity prompts.

Proposed Fix

  1. Tiered Team Disambiguation: Implement resolve_team(uid, team_target) with 4 tiers (UUID exact -> simultaneous Key and Name exact match -> substring match). Ambiguous matches return candidate lists and refuse silent mutation. When no team is specified, honors default team or prompts when multiple teams exist rather than silently picking teams[0].
  2. Identifier Sanitization: Implement sanitize_issue_identifier(raw) safely handling leading hashes/prefixes, full URLs, and dirty types.
  3. Complete Null-Safety: Short-circuit (issue.get("field") or {}).get(...) across tool_get_issue, tool_update_issue_status, and tool_add_comment, and defensively extract nodes lists (((result.get("teams") or {}).get("nodes") or [])).
  4. State Disambiguation & Alias Support: Reject empty/whitespace state targets in find_state_by_name, support optional workflow status/state binding upon issue creation, and map string numeric priorities ("1" -> 1).
  5. Manifest & Models Alignment: Declare team and status in /.well-known/omi-tools.json and models.py.
  6. Hermetic Test Suite: Add 22 hermetic unit tests in test_team_disambiguation.py covering all edge cases (0.2s runtime, 0 dependencies).

Bounty Proposal

  • Proposed Bounty: $50 (Backend Plugin Reliability & Bug Fix)
  • Preferred Payment (USDT-TRC20): TGKmfSUmt2dggErAo8BicaCoXhkMwLetxV
  • Alternative Payment (BTC): 1NkUnv23H65ZYJn64pseAcWRA6sJitxh2f
  • Email: [email protected]

shuoYun114 avatar Sep 17 '26 14:09 shuoYun114