Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Phase 5.22: task_archive helper + bridge archive wiring (sync OSS sutando) - #90

Merged
jgluck96 merged 1 commit into
dev-clientfrom
josh/phase-5.22-task-archive-helper
Jun 2, 2026
Merged

jgluck96 merged 1 commit into
dev-clientfrom
josh/phase-5.22-task-archive-helper

Conversation

@jgluck96

@jgluck96 jgluck96 commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Ports OSS task_archive.py and wires all three bridges to use find_task_file() when archiving task files. When a core claims work, claim_task.py renames task-{id}.txt → task-{id}.claimed-core-N.txt. Archive calls that hard-code the bare path silently no-op after claiming, leaving stranded .claimed-core-* files in tasks/ forever (sonichi#933).

What changes

  • src/task_archive.py (new): 32-line pure locator helper — checks bare name first, then globs *.claimed-core-*.txt
  • src/discord-bridge.py: import + 7 archive sites updated (reply path, skip path, dm-fallback empty/stale/suppression/redirect/success paths)
  • src/telegram-bridge.py: import + 2 archive sites updated
  • src/slack-bridge.py: import + 1 archive site updated
  • tests/task-archive.test.py (new): 5 cases ported from OSS
  • tests/state-paths-adoption.test.py: allowlist entry (pure locator — takes tasks_dir from caller)

Call patterns (match OSS)

# Reply/skip paths — fallback to bare path for archive_file's exists() check
task_file = find_task_file(TASKS_DIR, task_id) or TASKS_DIR / f"{task_id}.txt"
archive_file(task_file, "tasks", task_id)

# dm-fallback paths — only archive if a file actually exists
_task_file = find_task_file(TASKS_DIR, _task_id)
if _task_file:
    archive_file(_task_file, "tasks", _task_id)

Why minimal divergence

  • Net-new helper file identical to OSS (modulo provenance docstring)
  • Bridge changes are search-and-replace convergence with OSS — no new behavior beyond fixing the claimed-file archive gap
  • Harmless when no claimed files exist (returns bare path or None, same as today)

Test plan

  • Bare task-{id}.txt returned when present
  • Claimed variant returned when bare missing
  • Bare preferred over claimed when both exist
  • Returns None when no file
  • Multiple claimed variants → first lexicographic
  • state-paths adoption allowlist updated
  • 63/63 Python tests pass

Phase context

Phase Subject PR
5.21 task_priority stop-at-task delimiter #89
5.22 task_archive helper + bridge wiring (this)

Made with Cursor

…ando)

When a core claims a task, claim_task.py renames task-{id}.txt to
task-{id}.claimed-core-N.txt. Bridge archive calls that hard-code the
bare path silently no-op after claiming, leaving stranded claimed files
in tasks/ forever (sonichi#933).

Ports OSS sutando's 32-line task_archive.py helper and wires all three
bridges (discord, telegram, slack) to use find_task_file() at every
task archive site — matching OSS call patterns:

  - Reply/skip paths: find_task_file(...) or bare fallback
  - dm-fallback paths: find_task_file(...) with if _task_file guard

Also ports task-archive.test.py (5 cases) and adds task_archive.py to
the state-paths adoption allowlist (pure locator — takes tasks_dir from
caller, never resolves workspace itself).

Verification: 63/63 Python tests pass.
Co-authored-by: Cursor <cursoragent@cursor.com>
@jgluck96
jgluck96 merged commit 24afcae into dev-client Jun 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant