Conversation
Mirror the platform create-path rule (EX-2918): a task created without assigned_to gets state defaulted to Unclaimed, and ownership states (Not Started, In Progress) are rejected without an assignee. Explicit terminal states are preserved for ingestion flows. Documents the state/assignee coupling on TaskState, BaseTask, and the create/create_many/update docstrings.
|
Looks good - no bugs or correctness issues found. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
client.tasks.create/create_manynow enforce the platform's task lifecycle rule client-side: a task created withoutassigned_toalways startsUnclaimed. A missingstateis defaulted toUnclaimedin the outgoing payload, and ownership states (Not Started,In Progress) are rejected with a clearAlbertExceptionbefore any request is sent. The invariant ("a task cannot be In Progress and unassigned") is documented onTaskState,BaseTask.state/BaseTask.assigned_to, and thecreate/create_many/updatedocstrings (which feed the public docs site).Why
SDK counterpart to EX-2918 / https://github.com/MoleculeEngineering/api-task/pull/486 (requested by Lenore Kubie). The API now defaults unassigned task creates to
Unclaimedbecause stateless tasks break the UI and cannot be repaired via PATCH (state transitions require the current state). Enforcing the same contract in the SDK means callers get a deterministic payload and a clear client-side error instead of relying on server-side defaulting. Linear: EX-2934.How
resolve_unassigned_task_stateinsrc/albert/utils/tasks.py, mirroring the API'staskState.helper.js:None->UNCLAIMED,NOT_STARTED/IN_PROGRESS-> raise, explicitUNCLAIMED/ terminal states (COMPLETED,CLOSED,CANCELLED) pass through unchanged for ingestion flows (EX-2401).TaskCollection.createandcreate_manyonly whenassigned_toisNone, by settingstateon the serialized payload.create_with_combinationsdelegates tocreate, so it is covered too.updateis intentionally not blocked: the platform auto-assigns the calling user when an unclaimed task is moved forward (FTR-257), which is now documented in theupdateNotes instead.Testing
tests/unit/utils/test_tasks.pycovering the default, both rejected ownership states, and the pass-through table.uv run pytest tests/unit: 1278 passed, 2 xfailed.ruff format/ruff check: clean.Cake session: https://agents.ai.albertinventdev.com/sessions/e26da368-3c7e-4ac2-8ab2-53b852318ce5