Skip to content

Quarantine audit trail records a false from_status; claimable route undocumented - #2345

Merged
jaylfc merged 1 commit into
devfrom
exec/tsk-dtanmd
Aug 10, 2026
Merged

jaylfc merged 1 commit into
devfrom
exec/tsk-dtanmd

Conversation

@jaylfc

@jaylfc jaylfc commented Aug 10, 2026

Copy link
Copy Markdown
Owner

CARD TITLE (intent, not commit subject): Quarantine audit trail records a false from_status; claimable route undocumented

Autonomous build of board card tsk-dtanmd.

quarantine_task hardcoded from_status="open" in _record_audit, but its
WHERE clause permits quarantining a claimed card, so the audit trail logged
a false "open to quarantined" transition for claimed cards. Mirror
close_task's race-free derivation from the committed row's claimed_by so
the audit records the true pre-quarantine status. Add a test that
quarantines a claimed task and asserts from_status == "claimed".

Also document the LEAD-only mark-task-claimable route (POST
.../tasks/{id}/claimable) in the project_tasks scope bullet of
docs/agent-coordination.md -- it was allowlisted in auth_middleware.py
but never documented, unlike the unquarantine route added with the
strike-store wiring.

Files:
docs/agent-coordination.md | 5 +++++
tests/test_task_store.py | 21 +++++++++++++++++++++
tinyagentos/projects/task_store.py | 7 ++++++-
3 files changed, 32 insertions(+), 1 deletion(-)

Summary by CodeRabbit

  • Bug Fixes

    • Task quarantine audit records now accurately reflect whether the task was previously claimed or open.
  • Documentation

    • Documented the lead-only endpoint for toggling a task’s claimable status.
    • Clarified access restrictions and label-change behavior.

…le route

quarantine_task hardcoded from_status="open" in _record_audit, but its
WHERE clause permits quarantining a claimed card, so the audit trail logged
a false "open to quarantined" transition for claimed cards. Mirror
close_task's race-free derivation from the committed row's claimed_by so
the audit records the true pre-quarantine status. Add a test that
quarantines a claimed task and asserts from_status == "claimed".

Also document the LEAD-only mark-task-claimable route (POST
.../tasks/{id}/claimable) in the project_tasks scope bullet of
docs/agent-coordination.md -- it was allowlisted in auth_middleware.py
but never documented, unlike the unquarantine route added with the
strike-store wiring.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f917411-aed8-4b14-a1e2-9b205e9f2c38

📥 Commits

Reviewing files that changed from the base of the PR and between 8b2d0a2 and 8c0caca.

📒 Files selected for processing (3)
  • docs/agent-coordination.md
  • tests/test_task_store.py
  • tinyagentos/projects/task_store.py

📝 Walkthrough

Walkthrough

The quarantine audit now records claimed as the prior status when a task remains assigned. A test covers this behavior. Agent coordination documentation now describes the lead-only claimable endpoint and its label restrictions.

Changes

Quarantine audit status

Layer / File(s) Summary
Quarantine audit status and validation
tinyagentos/projects/task_store.py, tests/test_task_store.py
quarantine_task derives the audit from_status from claimed_by. The test verifies claimed-task audit history and closes both stores during cleanup.

Claimable endpoint documentation

Layer / File(s) Summary
Document claimable endpoint
docs/agent-coordination.md
The documentation describes the lead-only POST .../tasks/{id}/claimable endpoint and its label-preserving behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • jaylfc/taOS#2287: Both changes cover task-store behavior for claimed tasks, but this change targets quarantine audit status.
  • jaylfc/taOS#2333: Both changes modify ProjectTaskStore.quarantine_task; this change corrects its audit from_status.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies both the quarantine audit fix and the missing claimable route documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch exec/tsk-dtanmd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gitar-bot

gitar-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

# rather than a separate pre-read (which would have a TOCTOU gap).
# quarantine does not clear claimed_by, so a set claimer means it was
# 'claimed' (cf. close_task's derivation).
from_status = "claimed" if existing and existing.get("claimed_by") else "open"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: from_status derivation is incomplete for non-claimed statuses

The ternary collapses every status except "claimed" to "open", but quarantine_task's UPDATE guard also allows status = 'reopened' tasks (only closed/cancelled/quarantined are excluded). If a reopened task is quarantined, the audit record will incorrectly show "open" → "quarantined" instead of "reopened" → "quarantined". The same two-value pattern exists in close_task (line 393), so this is at least partially pre-existing, but the new code replicates it without addressing it. Consider deriving from existing["status"] directly, or documenting the intentional simplification.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread tests/test_task_store.py


@pytest.mark.asyncio
async def test_quarantine_claimed_task_records_actual_from_status(tmp_path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: New test only covers the claimed→quarantined path — no assertion for the open (unclaimed) path

The test exercises the previously-buggy claimed case but never quarantines an unclaimed open task. If the from_status ternary were accidentally inverted (e.g. "open" if existing.get("claimed_by") else "claimed"), the open-path audit record would silently break without any test catching it. Add a companion assertion that quarantining an unclaimed task records from_status == "open".


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

only. Granting project_tasks also makes the agent a project member.
`POST .../tasks/{id}/claimable` is also reachable, but LEAD-only: the
route (`_authorize_project_lead`) refuses a plain project_tasks worker.
It toggles only the `claimable` label (the fleet-pickup flag), preserving

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: claimable route description is ambiguous about label semantics

"It toggles only the claimable label" could be read as replacing all labels with ["claimable"] rather than adding/removing it in place. The unquarantine entry below it avoids this ambiguity by describing its behaviour explicitly ("clears its strikes"). Consider rephrasing to: "It adds or removes the claimable label while preserving every other label" to match the precision of the neighbouring bullet.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 2
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
tinyagentos/projects/task_store.py 453 from_status ternary collapses all non-claimed statuses to "open", so quarantining a reopened task produces a false "open→quarantined" audit record
tests/test_task_store.py 606 New test covers claimed→quarantined only; no assertion for the open (unclaimed) path, leaving it unprotected against regression

SUGGESTION

File Line Issue
docs/agent-coordination.md 234 "toggles only the claimable label" is ambiguous — could be read as replacing all labels rather than adding/removing it in place
Files Reviewed (3 files)
  • tinyagentos/projects/task_store.py — 1 issue
  • tests/test_task_store.py — 1 issue
  • docs/agent-coordination.md — 1 issue

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 48.3K · Output: 4.4K · Cached: 161.8K

@jaylfc

jaylfc commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

nemotron-super review

VERDICT: Approved
No blocking issues found

Automated first-pass review by the nemotron-super lane. The lead still reviews before merge.

@jaylfc
jaylfc merged commit 9c7b433 into dev Aug 10, 2026
23 checks passed
@jaylfc

jaylfc commented Aug 10, 2026

Copy link
Copy Markdown
Owner Author

Correction to my kilo adjudication above: I wrote that reopen_task leaves a stale claimed_by making reopened tasks unclaimable — that was wrong, built on a truncated read; dev's reopen already clears it (task_store.py:408). With the full status vocabulary (open/claimed/closed/quarantined, reopen→open with claimer cleared), the two-value from_status derivation in this PR is exact, and kilo's 'reopened' scenario remains nonexistent. The correct part of that adjudication stands: kilo finding 1 wrong as stated, findings 2-3 legitimate nits (now landed via #2347's surviving scope).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant