Skip to content

AI-2146: fix stale notes.md and silent permission errors in init_task_record.py #8

Description

@RachelXiaolan

Mirrored from Linear AI-2146 (parent: AI-2145 — "Bug hunter 自动提交 PR 闭环演示").

Summary

Fix scripts/init_task_record.py so it can no longer silently leave a task folder with mismatched task.json / notes.md, and so it stops crashing with a raw traceback when --root points at a read-only directory.

Changes

  • Refuse to create a task artifact in an existing folder unless --force is passed (exit code 2, clear stderr).
  • --force reuses the folder and rewrites both task.json and notes.md atomically.
  • PermissionError / generic OSError from mkdir are caught and turned into a clean non-zero exit with an actionable message.

Tests

tests/test_init_task_record.py covers: first-run creation, repeat-run refusal, --force refresh, permission-error handling.

PR

#7

Linear

  • AI-2146 (this issue)
  • AI-2145 (parent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions