Skip to content

feat(task-ledger): add durable lifecycle events - #567

Merged
likun666661 merged 1 commit into
apache:mainfrom
somewan820:feat/durable-task-ledger-lifecycle
Jul 6, 2026
Merged

likun666661 merged 1 commit into
apache:mainfrom
somewan820:feat/durable-task-ledger-lifecycle

Conversation

@somewan820

Copy link
Copy Markdown
Contributor

Summary

Implements the durable task lifecycle contract for #559 by hardening the existing session task ledger rather than introducing a second task system.

What changed

  • Adds task lifecycle states: blocked, failed, plus evidence fields:
    • blockedReason
    • failureReason
    • completionEvidence
  • Adds lifecycle validation for allowed status transitions, including explicit reopen rules.
  • Adds append-only task-events.jsonl event records and projection replay.
  • Keeps tasks.json as a legacy/projection cache.
  • Imports legacy tasks.json tasks as task_imported events before the first mutation.
  • Adds event projection diagnostics and fail-closed mutation behavior for corrupt event logs.
  • Adds task_list and task_get model tools.
  • Renames primary task tools to snake_case:
    • task_create
    • task_update
    • task_list
    • task_get
  • Keeps PascalCase aliases behind an explicit legacy compatibility flag.
  • Adds resumeTrust classification while keeping it out of model-visible surfaces.
  • Filters resumeTrust: "untrusted" fallback tasks from turn-tail and model-facing task tools.
  • Documents the lifecycle contract in docs/durable-task-lifecycle.md.

Safety / migration behavior

  • Existing legacy ledgers continue to read from tasks.json if no event log exists.
  • On first mutation, legacy tasks are imported into the event log before appending the mutation event.
  • Once task-events.jsonl exists, corrupt projection is authoritative corruption for writes.
  • Render/debug paths may fall back to tasks.json as untrusted cache, but model-visible surfaces hide untrusted fallback tasks.

Tests

  • npm --workspace @maka/core test
  • npm --workspace @maka/storage test
  • npm --workspace @maka/runtime run build
  • npm --workspace @maka/desktop run build:main
  • node --test packages/runtime/dist/__tests__/task-ledger-tools.test.js
  • node --test apps/desktop/dist/main/__tests__/task-ledger-contract.test.js

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.

2 participants