Housekeeping expires assigned executions but never re-evaluates the task close
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
Research direction
Start with _EXPIRE_ASSIGNED_SQL and _expire_assigned in server/orcaster_server/housekeeping.py, then read _SQL_MAYBE_CLOSE_TASK and its caller in server/orcaster_server/api/tasks.py. Run the housekeeping and task completion tests to understand both event orders and the protected pre-assignment case. Done means the shared close check updates only eligible all_available tasks after expiry, with tests, a changelog entry, and the user manual note updated.
Written by the indexing model from the issue text.
Description
Problem
An all_available task closes only when every execution of its current snapshot epoch is terminal (server/orcaster_server/api/tasks.py:328-335). That close check, _SQL_MAYBE_CLOSE_TASK, runs only from the worker complete route (server/orcaster_server/api/tasks.py:726-729).
Housekeeping expires assigned executions whose claim_timeout_seconds has passed (server/orcaster_server/housekeeping.py:255-275). _expire_assigned returns only a row count (housekeeping.py:445-448), and the caller only logs it (housekeeping.py:555-560). The task status is never re-evaluated.
So if the expired execution was the last non-terminal one, the task stays dispatching for good. The operator sees no error. This happens whenever a worker in the snapshot never claims its pre-assignment, for example a worker that went offline after the snapshot, or a worker that cannot receive the task's stored secrets (the residual case in docs/user-manual.md:3928-3933).
The result depends on the order of events. If the execution expires before the last other execution completes, the complete route runs the close check and the task closes. If it expires after, the task never closes.
Steps to reproduce
- Create an
all_availabletask with a shortclaim_timeout_secondswhile two workers are enrolled. - Stop one worker before it claims its execution.
- Let the other worker complete its execution.
- Wait until housekeeping expires the remaining
assignedexecution. - The task stays
dispatching.
Proposed change
- Make
_EXPIRE_ASSIGNED_SQLreturn the task id and workspace id of each expired row (RETURNING). - After the expiry, run the same close check as the complete route once per distinct task, in the same transaction.
- Move
_SQL_MAYBE_CLOSE_TASKto a module that bothserver/orcaster_server/api/tasks.pyandserver/orcaster_server/housekeeping.pycan import, or expose a helper. Do not copy the SQL. - Keep the close rule unchanged. An
expiredexecution counts as terminal but not completed, so the task closesfailed, exactly as it does today when the expiry happens before the last complete. - Log the number of tasks closed by this step.
- Update the residual-case note in
docs/user-manual.md:3928-3933with the final task status.
Tasks with claim_timeout_seconds unset never expire an execution. That is out of scope here.
Compatibility
- No schema change and no API change.
- After the upgrade, the first housekeeping pass closes tasks that are stuck in
dispatchingwith an expired execution. Most will closefailed. Operators and scripts that listdispatchingtasks will see them leave that list. - Upgrade note: to see the affected tasks before the upgrade, list
all_availabletasks indispatchingwhose remaining executions are allexpiredor terminal.
Acceptance criteria
- A test with an
all_availabletask where one worker completes and the other'sassignedexecution then expires shows the task closed after one housekeeping pass, with the same status, outcome andcompleted_atthat the complete route would set. - A test with the opposite order (expiry first, complete second) still closes the task as today.
- A test with a
counttask shows that an expired execution does not change its status, as today. - A test shows that the protected pre-assignment (worker refused secret delivery) is still not expired and the task is not closed.
-
_SQL_MAYBE_CLOSE_TASKhas one definition used by both callers. - Tasks in other states and tasks without expired executions are not changed. Existing deployments keep working without config changes.
- CHANGELOG entry under Unreleased, with an upgrade note that stuck
dispatchingtasks close on the first housekeeping pass.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day