Skip to content

fix(clickup-app): safely coerce assignee IDs, timestamp due dates, and priority in create_task - #13921

Closed
Ivansky1 wants to merge 2 commits into
BasedHardware:mainfrom
Ivansky1:fix/clickup-app-assignee-coercion
Closed

Ivansky1 wants to merge 2 commits into
BasedHardware:mainfrom
Ivansky1:fix/clickup-app-assignee-coercion

Conversation

@Ivansky1

@Ivansky1 Ivansky1 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In plugins/omi-clickup-app/clickup_client.py:

  1. Assignee ID Coercion & Crash Prevention: Task creation previously used task_data["assignees"] = [int(user_id) for user_id in assignees if user_id]. If assignees contained non-numeric strings (e.g. member names, "None", or whitespace tokens when name matching fails), int(user_id) raised an unhandled ValueError which aborted the entire task creation call. The user's task was never created on ClickUp.
  2. Timestamp Due Date Support: The method docstring documents due_date: Optional due date in ISO format or Unix timestamp (milliseconds). However, passing a numeric millisecond timestamp (integer, float, or digits string) crashed on 'T' in due_date (TypeError: argument of type 'int' is not iterable) or datetime.fromisoformat (ValueError).
  3. Priority Validation & Coercion: Priority inputs are now safely validated against ClickUp's 1–4 priority scale, omitting non-numeric or invalid out-of-range values.
  4. Hermetic Test Coverage: Added comprehensive test cases in test_clickup_client.py covering valid/invalid assignees, timestamp and ISO due dates, priority coercion, and API failure paths. Registered clickup-client-tests in .github/checks-manifest.yaml.

Testing

  • python -m unittest plugins/omi-clickup-app/test_clickup_client.py: All 14 tests pass in 0.02s.
  • python -m unittest plugins/omi-clickup-app/test_settings_page.py: All 2 tests pass.
  • git diff --check origin/main: 0 whitespace or formatting warnings.

Failure-Class: new


Bounty Payout Destination (EVM / Base USDC): 0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0
cc @josancamon19 @kodjima33

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@Ivansky1

Copy link
Copy Markdown
Contributor Author

Addressed feedback from static review in commit 759496d:

  1. Fractional Priority & Booleans: Explicitly validated that \priority\ is an integral type (rejecting boolean values and fractional floats like \4.9\ or \3.5\ before validation) to avoid silent truncation.
  2. Timezone Offset Preservation: Normalized \Z\ to +00:00\ and preserved exact instant on offset-aware ISO strings, only applying \ z.localize\ to naive datetimes.
  3. Failure Path Test Coverage: Added tests in \ est_clickup_client.py\ for non-200 API responses (asserting \success: False\ with error), unparseable due dates (asserting graceful creation without \due_date), and invalid/fractional priority values.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @Ivansky1 - verified this end to end. Notes per file:

plugins/omi-clickup-app/clickup_client.py

  • _coerce_assignee_ids correctly filters None/bools/containers/"None" sentinels, dedupes preserving order, and never raises; the isinstance((dict, list, set, bool)) check running before the numeric branch is what makes booleans safe, and it is ordered right.
  • Confirmed the old failure mode: [int(user_id) for user_id in assignees if user_id] raised ValueError that escaped to the outer except and failed the whole create_task call. With the fix, unassignable tokens only drop the assignee while the task is still created - test_create_task_with_only_invalid_assignees_does_not_crash locks that in.
  • The Z -> +00:00 normalization preserves the exact instant (2026-09-15T12:00:00Z -> 1789473600000 checks out), and offset-aware strings now bypass pytz.localize, which raises on already-aware datetimes - previously those due dates were silently dropped. Nice catch.
  • Priority gate (bool/fractional/non-integer-string rejection plus the 1-4 range check, omit instead of crash) matches ClickUp's documented scale.
  • One non-blocking nit: float assignees like 101.9 truncate to 101 via int(item); the same is_integer() guard used for priority would make it symmetrical if you ever care.

plugins/omi-clickup-app/test_clickup_client.py

  • Ran the suite in a clean, network-isolated environment: 17/17 pass, stdlib-only (the requests/dotenv module stubs are confined to the import). The failure-path coverage (404 response, unparseable date, invalid priorities) is appreciated.

.github/checks-manifest.yaml

  • The clickup-client-tests entry mirrors the sibling linear-exact-issue-lookup-tests format (id/command/triggers/lanes/reason) exactly.

No CI check runs are visible on the PR yet, so worth a glance at the manifest lane before merge - otherwise this looks merge-ready to me. Leaving final sign-off to a human maintainer.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution python labels Sep 15, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Real bug confirmed not fixed on main (plugins/omi-clickup-app/clickup_client.py still does int(user_id) for user_id in assignees raw, aborting task creation on non-numeric assignee IDs). Root cause stated, 14 tests added covering assignees/timestamps/priority coercion, scoped diff. Merging: CI has no failing required checks, not a draft, no abuse signals.

…d priority in create_task

ClickUp's create_task previously used a naive list comprehension [int(user_id) for user_id in assignees if user_id] without error handling. When passed non-numeric names, None, string 'None', or whitespace tokens, it raised an unhandled ValueError that aborted task creation entirely. In addition, numeric Unix timestamps passed to due_date crashed with TypeError or ValueError due to unconditional 'T' in due_date string testing.

This change:
1. Adds a resilient ClickUpClient._coerce_assignee_ids helper extracting positive integer IDs, skipping invalid/non-numeric tokens and booleans without throwing, and deduplicating unique IDs.
2. Gracefully continues task creation even if assignees cannot be resolved rather than failing the whole task.
3. Supports millisecond Unix timestamps (int, float, numeric string) alongside ISO date strings.
4. Coerces and validates priority to ClickUp's 1-4 scale.
5. Adds full unit test coverage in test_clickup_client.py and registers clickup-client-tests in checks-manifest.yaml.
…ority, and add failure tests

1. Prevented silent truncation of fractional priorities (e.g. 4.9 -> 4) and boolean types by explicitly requiring integer types before validation.
2. Preserved exact instant and timezone offsets for ISO due dates with UTC 'Z' or offset annotations (+HH:MM), only localizing naive datetimes.
3. Added comprehensive failure path test coverage in test_clickup_client.py covering non-200 API responses, unparseable due dates, and fractional/boolean priorities.
@Ivansky1

Copy link
Copy Markdown
Contributor Author

Note for maintainers / bounty payout: Please ensure all bounty rewards for this PR are routed to my verified EVM / Base wallet: 0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0. Thank you!

@Ivansky1

Copy link
Copy Markdown
Contributor Author

Payout information update:

  • PayPal: [email protected]
  • Base / EVM (USDC): 0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0

Thank you!

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase check first: I diffed all three PR files between the commit @kodjima33 reviewed and this head. The ClickUp changes are identical; the only additional deltas (the data= OAuth token exchange and log redaction to exception class names) came from main's side of the rebase, not this branch. The reviewed substance is unchanged.

Notes per file on this head:

plugins/omi-clickup-app/clickup_client.py

  • _coerce_assignee_ids fixes the original crash correctly: the isinstance(item, (dict, list, set, bool)) guard runs before any numeric coercion so booleans can't pass as 0/1, "None"/"NONE" sentinels are filtered case-insensitively, only positive IDs survive, and dedup keeps first-seen order. create_task now creates the task without assignees instead of aborting on int(user_id) with a non-numeric token.
  • The priority gate rejects booleans, fractional floats, and non-integer strings, and omits out-of-range values (ClickUp's documented 1-4 scale) instead of crashing.
  • Due-date handling now accepts int/float/digit-string millisecond timestamps directly, and normalizes a trailing Z to +00:00 before fromisoformat, so offset-aware ISO strings keep their exact instant - previously pytz.localize raised on already-aware datetimes and those due dates were silently dropped.

plugins/omi-clickup-app/test_clickup_client.py

  • Ran the suite on this head: 17/17 pass. The failure-path tests (all-invalid assignees -> task still created without assignees; unparseable due dates -> graceful omission; non-200 responses -> success: False) are exactly the coverage this fix needs.

.github/checks-manifest.yaml

  • clickup-client-tests is registered as a proper new entry under checks: with both lanes and correct triggers - schema and placement match the neighboring entries.

One blocking item, and it's metadata rather than code: PR Metadata Preflight fails on failure-class-protocol because both commit subjects start with fix:, which requires a Failure-Class: declaration in the PR body. Adding exactly one of the accepted forms on its own line - e.g. Failure-Class: new, or an existing class from .github/failure-classes/ if one fits - should turn it green (re-run the job if the body edit doesn't retrigger it).

Nice work keeping the fix scoped; once the declaration is in, this is ready from my side.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction to my previous review — the Failure-Class: new line I asked for was my error, and here is the working version. I read the checker (scripts/failure-class) end to end: for a PR that adds no new class definition, new is invalid — it requires exactly one added .github/failure-classes/FC-<slug>.json file in the commit range. That is why PR Metadata Preflight still failed on the 19:02Z run after your body edit. You followed the instruction exactly; the instruction was wrong.

Two verified ways to turn it green:

  1. Quickest — replace the declaration line in the PR body with:
    Failure-Class: none
    The validator accepts none unconditionally. I checked the existing ~300 class definitions and none matches this failure mode closely enough to point you at, so none is the honest minimal declaration here.
  2. If you want the class registered — keep Failure-Class: new and add exactly one definition file, e.g. .github/failure-classes/FC-unvalidated-external-id-crashes-operation.json, containing schema_version: 1, an id matching the filename, non-empty violated_contract and canonical_prevention, evidence_prs: [] (explicitly allowed — this PR is the evidence), and status: "open". No other definition files may be touched in the same PR.

If the body edit alone doesn't retrigger the job, re-run PR Metadata Preflight manually.

The code itself is unchanged since my last pass on this head, so the per-file assessment stands:

  • plugins/omi-clickup-app/clickup_client.py — _coerce_assignee_ids type-guards (dict, list, set, bool) before any numeric coercion, filters "None"/"NONE" sentinels case-insensitively, and keeps only positive, order-preserved deduped IDs; the due-date path accepts millisecond timestamps directly and normalizes a trailing Z to +00:00 so offset-aware ISO strings keep their exact instant; the priority gate rejects booleans and fractional floats and omits out-of-range values on ClickUp's 1–4 scale.
  • plugins/omi-clickup-app/test_clickup_client.py — 17/17 when I ran the suite on this head; the failure-path tests (all-invalid assignees → task still created without assignees; unparseable due date → graceful omission; non-200 → success: False) are exactly the coverage this fix needed.
  • .github/checks-manifest.yaml — the clickup-client-tests entry sits correctly under checks: with the right triggers and lanes.

@kodjima33 gave maintainer sign-off on the pre-rebase commit and I verified all three files' ClickUp substance is identical after the rebase, so once the declaration is fixed this is ready from my side for a maintainer merge.


by AI on behalf of David

@aryanorastar

Copy link
Copy Markdown
Collaborator

Closing because this is already on main (ClickUp task priority, assignee, and due-date coercion). The keep is #14268. This head does not add a unique production file.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Ivansky1 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants