Skip to content

feat(todo): add stable session todo identity - #399

Merged
Astro-Han merged 9 commits into
devfrom
codex/i395-todo-identity
May 3, 2026
Merged

feat(todo): add stable session todo identity#399
Astro-Han merged 9 commits into
devfrom
codex/i395-todo-identity

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add stable per-todo ids to the backend todo model, database table, todo.updated payload, and generated SDK v2 Todo type.
  • Return resolved todos with ids from todowrite output/metadata and preserve existing ids only when they belong to the current session.
  • Make the session todo dock lifecycle id-aware while keeping idless historical tool parts on the existing status-only fallback.
  • Remove the deprecated selectSessionTodoSnapshot compatibility alias.

Why

Fixes #395.

#394 split todo dock lifecycle logic into focused modules, but lifecycle detection still used only todo status arrays. That meant a same-count, same-status task replacement could look identical to a content-only refresh. The backend also had an architecture mismatch: frontend sync already reconciled todos by id, but backend Todo.Info and the todo table had no stable id.

Related Issue

Fixes #395

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

  • packages/opencode/src/session/todo.ts: id resolution rules, especially unknown ids, duplicate ids, and idless replacement behavior.
  • packages/opencode/migration/20260503025430_todo_ids/migration.sql: migration from (session_id, position) identity to stable todo ids for historical rows.
  • packages/app/src/pages/session/todos/todo-model.ts: lifecycle signature uses [id, status] only when all todos have stable ids, otherwise it keeps the old status-only fallback.
  • packages/app/src/pages/session/session-status-extractors.ts: completed todowrite metadata wins over idless tool input.

Risk Notes

Medium data/API risk: this adds a required id to v2 Todo and changes the todo table primary identity. The API shape remains Todo[]; this PR does not introduce a session-level revision envelope. Historical tool parts without ids still use the frontend fallback. Historical database todo rows receive generated ids during migration.

No SSE replay or reconnect recovery is included.

How To Verify

Backend todo and JSON migration tests: 27 passed
Command: bun --cwd packages/opencode test ./test/storage/json-migration.test.ts ./test/session/todo.test.ts

Focused app unit tests: 728 passed
Command: bun --cwd packages/app test:unit -- ./src/pages/session/todos/todo-model.test.ts ./src/pages/session/todos/todo-source.test.ts ./src/pages/session/todos/todo-dock-machine.test.ts ./src/pages/session/session-todos.test.ts ./src/pages/session/session-status-extractors.test.ts

SDK generation: passed
Command: bun --cwd packages/sdk/js build

Typecheck: 8/8 packages successful
Command: bun run typecheck

Todo dock e2e: 12 passed
Command: bun --cwd packages/app test:e2e -- session/session-composer-dock.spec.ts -g "todo dock"

Migration check: passed
Command: bun --cwd packages/opencode script/check-migrations.ts

Alias removal check: no matches
Command: rg "selectSessionTodoSnapshot" packages/app/src packages/opencode/src packages/sdk/js/src

Diff check: no whitespace errors
Command: git diff --check

Screenshots or Recordings

Not attached. This PR does not intentionally change visible UI. Existing todo dock behavior is covered by focused unit tests and the todo dock e2e suite.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, scope, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for desktop, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Maintainer labeling request: please add appropriate type, scope, and priority labels if needed.

Summary by CodeRabbit

  • Refactor

    • Introduced stable todo identifiers and a narrower session todo item shape; lifecycle signatures now factor item identity.
  • New Features

    • Session todo UI and selection APIs return session-scoped todo items with optional IDs; tool execution prefers resolved/persisted todos.
  • Migration

    • DB and JSON migrations populate and deduplicate todo IDs; schema/indexes adjusted for id-based todos.
  • Tests

    • Added tests for ID resolution, persistence, migration, extractor fallbacks, and lifecycle signature behavior.
  • Documentation

    • Clarified guidance on stable todo ID usage.

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds stable optional todo IDs across backend, storage, tooling, and frontend: DB schema and migration add todo.id; ID primitives and schemas introduced; service resolves/persists IDs; todowrite uses resolved todos for metadata; frontend types/selectors/components adopt SessionTodoItem[]; tests updated for ID resolution and lifecycle-signature behavior.

Changes

Session todo ID migration & resolution

Layer / File(s) Summary
ID primitives & schema
packages/opencode/src/id/id.ts, packages/opencode/src/session/schema.ts
Add todo identifier prefix and exported TodoID schema/type with statics.
SQL table schema & migration
packages/opencode/src/session/session.sql.ts, packages/opencode/migration/20260503025430_todo_ids/migration.sql, packages/opencode/migration/.../snapshot.json
Add single-column id: TodoID primary key to todo table, remove composite PK, add unique index on (session_id, position), include migration SQL and snapshot.
Persistence & service API
packages/opencode/src/session/todo.ts
Introduce Input (id optional) and Info (id present), add resolveTodoIDs(previous,incoming), change Interface.update to accept Input[] and return resolved Info[]; update resolves ids, persists rows with ids, publishes Event.Updated, and returns resolved todos; get includes id.
JSON migration
packages/opencode/src/storage/json-migration.ts, packages/opencode/test/storage/json-migration.test.ts
Deterministic legacy TodoID generation; prefer stored todo_* ids when safe and unused; prevent duplicate reuse per run; tests assert generated ids and idempotence.
Tool integration & docs
packages/opencode/src/tool/todo.ts, packages/opencode/src/tool/todowrite.txt
Tool Parameters.todos items accept optional id; todowrite handler uses todo.update(...) result for title/output/metadata; docs add “Stable Todo IDs” guidance.
Backend tests
packages/opencode/test/session/todo.test.ts
Add unit/integration tests for resolveTodoIDs ID rules and service persistence behavior.

Frontend: shapes, extraction, selectors, UI, and tests

Layer / File(s) Summary
Model / data shape
packages/app/src/pages/session/todos/todo-model.ts
Add SessionTodoItem (content/priority/status, optional id); TodoSnapshot.items and todoSnapshot accept SessionTodoItem[]; todoLifecycleSignature serializes [id,status] when all ids present, else status-only.
Extractor logic
packages/app/src/pages/session/session-status-extractors.ts, packages/app/src/pages/session/session-status-extractors.test.ts
TodoItem adds optional id; add todosFromMetadata to prefer validated part.state.metadata.todos for completed todowrite parts; tests cover metadata precedence and malformed-metadata fallback.
Selectors / source & exports
packages/app/src/pages/session/todos/todo-source.ts, packages/app/src/pages/session/session-todos.ts
selectSessionTodos now returns SessionTodoItem[]; removed deprecated selectSessionTodoSnapshot export; partTodos no longer coerces to Todo[].
Store / hooks
packages/app/src/pages/session/todos/use-session-todos.ts
Store todos typed as `SessionTodoItem[]
UI typing
packages/app/src/pages/session/composer/session-todo-dock.tsx
SessionTodoDock and internal TodoList props updated to todos: SessionTodoItem[].
Frontend tests & helpers
packages/app/src/pages/session/todos/*.test.ts, packages/app/src/pages/session/session-todos.test.ts, packages/app/src/pages/session/todos/todo-dock-machine.test.ts
Test helpers and assertions updated for optional ids, lifecycle-signature behavior, extractor preference, and dock lifecycle signature updates.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Tool as TodoTool
    participant Service as TodoService
    participant DB as Database
    participant FE as Frontend
    Tool->>Service: call todowrite(params.todos with optional ids)
    Service->>Service: resolveTodoIDs(previousTodos, incomingTodos)
    Service->>DB: upsert resolved todos (include ids)
    DB-->>Service: persisted rows (with ids)
    Service-->>Tool: return resolved todos (used for title/output/metadata)
    Tool->>FE: part includes metadata.todos (with ids)
    FE->>FE: extractTodos prefers metadata.todos when completed
    FE->>FE: compute lifecycleSignature using ids when present
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement, P2, app, harness

Poem

"I hop through code and plant each bean,
A tiny id where tasks convene.
When lists refresh, no names are lost—
My stable seeds withstand the frost.
Hooray — each todo now has a home!" 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding stable per-todo identity in the session todo system.
Description check ✅ Passed The PR description comprehensively covers all required sections: summary, why, related issue, review focus, risk notes, verification steps, and checklist completion.
Linked Issues check ✅ Passed The PR fully addresses issue #395 by implementing stable per-todo IDs, updating backend/API/SDK/frontend code, maintaining status-array fallback, removing deprecated alias, and passing comprehensive verification tests.
Out of Scope Changes check ✅ Passed All changes are in-scope: stable ID implementation, database migration, API/SDK updates, lifecycle signature refactoring, and alias removal align with #395 objectives and explicitly exclude UI redesign and SSE replay.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 codex/i395-todo-identity

Review rate limit: 7/10 reviews remaining, refill in 17 minutes and 58 seconds.

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces stable IDs for todo items across the database, backend services, and frontend UI to improve task tracking and lifecycle management. Key changes include a database migration adding a primary key id to the todo table, logic in the Todo service to resolve and maintain IDs for incoming tasks, and updates to the frontend to incorporate these IDs into lifecycle signatures. Feedback is provided regarding the SQL migration's ID generation method, which may conflict with the system's standard identifier format that expects timestamp metadata.

Comment thread packages/opencode/migration/20260503025430_todo_ids/migration.sql Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/app/src/pages/session/session-todos.test.ts (1)

29-33: The as Todo cast is imprecise but not a regression risk; id is optional in the actual output type.

The todo() helper intentionally omits id because the downstream function selectSessionTodos returns SessionTodoItem, which makes id optional (Partial<Pick<Todo, "id">>). Rather than splitting fixtures, improve type safety by casting to as SessionTodoItem instead of as Todo, or remove the cast entirely since the object already satisfies SessionTodoItem.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/app/src/pages/session/session-todos.test.ts` around lines 29 - 33,
The test helper todo() currently casts fixtures to Todo which is imprecise
because id is intentionally omitted; change the cast to as SessionTodoItem (or
remove the cast entirely) so the returned object matches the downstream
selectSessionTodos output type; update the todo() helper definition (referencing
todo(), Todo and SessionTodoItem and usages in selectSessionTodos tests) to
either cast to SessionTodoItem or omit the cast to improve type safety.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/src/session/session.sql.ts`:
- Around line 109-112: The current schema defines a non-unique index
todo_session_position_idx on table.session_id and table.position, which allows
duplicate positions per session; change this to a UNIQUE constraint by replacing
the plain index with a unique index/constraint on (session_id, position) in the
session table definition (update the expression using table.session_id and
table.position and the index identifier todo_session_position_idx or rename to
todo_session_sessionid_position_uq), and add a corresponding migration that
creates the unique constraint (and handles/cleans any existing duplicate rows
before applying) so the database enforces uniqueness after dropping the old
composite PK/id change.

In `@packages/opencode/src/session/todo.ts`:
- Around line 61-69: The current guard (if (!id && !todo.id)) skips
content-based reuse when a non-reusable todo.id is provided; change it to run
content fallback whenever id is still unset by replacing the condition with if
(!id) so the unusedPreviousByExactContent lookup can attempt to assign id for
unchanged items; keep using unusedPreviousByExactContent.get(todo.content), the
while loop that shifts candidates, and the used.has(candidate.id) check to avoid
reusing already-used IDs.

---

Nitpick comments:
In `@packages/app/src/pages/session/session-todos.test.ts`:
- Around line 29-33: The test helper todo() currently casts fixtures to Todo
which is imprecise because id is intentionally omitted; change the cast to as
SessionTodoItem (or remove the cast entirely) so the returned object matches the
downstream selectSessionTodos output type; update the todo() helper definition
(referencing todo(), Todo and SessionTodoItem and usages in selectSessionTodos
tests) to either cast to SessionTodoItem or omit the cast to improve type
safety.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ba6938ac-eb33-4e17-96c3-6b002c6548bd

📥 Commits

Reviewing files that changed from the base of the PR and between 7635333 and 6307542.

⛔ Files ignored due to path filters (1)
  • packages/sdk/js/src/v2/gen/types.gen.ts is excluded by !**/gen/**
📒 Files selected for processing (20)
  • packages/app/src/pages/session/composer/session-todo-dock.tsx
  • packages/app/src/pages/session/session-status-extractors.test.ts
  • packages/app/src/pages/session/session-status-extractors.ts
  • packages/app/src/pages/session/session-todos.test.ts
  • packages/app/src/pages/session/session-todos.ts
  • packages/app/src/pages/session/todos/todo-dock-machine.test.ts
  • packages/app/src/pages/session/todos/todo-model.test.ts
  • packages/app/src/pages/session/todos/todo-model.ts
  • packages/app/src/pages/session/todos/todo-source.test.ts
  • packages/app/src/pages/session/todos/todo-source.ts
  • packages/app/src/pages/session/todos/use-session-todos.ts
  • packages/opencode/migration/20260503025430_todo_ids/migration.sql
  • packages/opencode/migration/20260503025430_todo_ids/snapshot.json
  • packages/opencode/src/id/id.ts
  • packages/opencode/src/session/schema.ts
  • packages/opencode/src/session/session.sql.ts
  • packages/opencode/src/session/todo.ts
  • packages/opencode/src/tool/todo.ts
  • packages/opencode/src/tool/todowrite.txt
  • packages/opencode/test/session/todo.test.ts
💤 Files with no reviewable changes (1)
  • packages/app/src/pages/session/session-todos.ts

Comment thread packages/opencode/src/session/session.sql.ts
Comment thread packages/opencode/src/session/todo.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/src/storage/json-migration.ts`:
- Around line 331-333: The fallback todo.id generation is non-deterministic
because JsonMigration currently calls TodoID.ascending() with no seed, producing
a new ID each run; change the fallback in the values push so that when todo.id
is missing you derive a stable ID from the legacy identity (for example use
TodoID.ascending(`${todo.session_id}:${todo.position}`) or another deterministic
combination of the legacy fields) or look up and reuse an already-migrated row
for that (session_id, position) before creating a new id; update the branch that
currently checks typeof todo.id and todo.id.startsWith("todo_") to use the
deterministic seed or reuse logic so repeated runs are idempotent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 87a9f995-c491-4e78-aeed-6381a0dcb892

📥 Commits

Reviewing files that changed from the base of the PR and between 6307542 and 00b9446.

📒 Files selected for processing (2)
  • packages/opencode/src/storage/json-migration.ts
  • packages/opencode/test/storage/json-migration.test.ts

Comment thread packages/opencode/src/storage/json-migration.ts Outdated
@Astro-Han
Astro-Han force-pushed the codex/i395-todo-identity branch from 00b9446 to b7326f5 Compare May 3, 2026 03:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/opencode/src/storage/json-migration.ts (1)

319-343: ⚠️ Potential issue | 🟠 Major

Sort todo files to ensure deterministic migration output.

Line 340–343 resolves duplicate todo_... IDs by keeping the first occurrence seen. Since todoFiles comes directly from Glob.scan() without explicit sorting, the outcome depends on filesystem traversal order—which is not guaranteed to be consistent across different systems or even repeated runs. This causes migration results to vary for identical input data.

Sort the todo files before processing (e.g., todoFiles.sort()) to make the migration output deterministic.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/opencode/src/storage/json-migration.ts` around lines 319 - 343, The
migration iterates todoFiles (used in the batch loop and referenced when
computing sessionID and legacyTodoID) without a stable order, so duplicate
todo_... IDs are resolved non-deterministically; sort the todoFiles array before
building todoSessions / starting the batch loop (i.e., call sort() on todoFiles
early in the function that contains seenTodoIDs, todoSessions, and the for-loop)
so processing order is deterministic and the seenTodoIDs de-duplication yields
consistent migration output.
🧹 Nitpick comments (1)
packages/opencode/test/session/todo.test.ts (1)

54-115: ⚡ Quick win

Use the Effect test helper here.

These tests exercise Effect services, so testEffect(...) would remove the manual Instance.provide / Effect.runPromise plumbing and keep the harness consistent.

As per coding guidelines, use testEffect(...) from test/lib/effect.ts for tests that exercise Effect services or Effect-based workflows.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/opencode/test/session/todo.test.ts` around lines 54 - 115, Replace
the manual Instance.provide / Effect.runPromise plumbing in both tests with the
testEffect helper from test/lib/effect.ts: wrap each test body with
testEffect(...) so you can call effectful operations directly (e.g.,
Session.create, Todo.Service.use, Todo.defaultLayer) without Instance.provide
and Effect.runPromise; update the two tests ("update returns ids and get
persists them" and "second update preserves id and persists status changes") to
use testEffect and drop explicit Instance.provide, Effect.runPromise, and tmpdir
usage inside the provide block while still calling Session.remove at the end.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/test/session/todo.test.ts`:
- Around line 39-50: The test only checks that the unknown/duplicate resolved
ids are not equal to previous[0].id, which misses regressions that reuse other
previous ids; update the assertions in the "ignores unknown and duplicate ids"
test (around Todo.resolveTodoIDs and the resolved/previous variables) to assert
that resolved[0].id and resolved[2].id are not included in the full set of
previous ids (e.g., compare against previous.map(p => p.id) or similar) instead
of only checking previous[0].id, ensuring unknown/duplicate branches are
validated against all previous IDs.

---

Outside diff comments:
In `@packages/opencode/src/storage/json-migration.ts`:
- Around line 319-343: The migration iterates todoFiles (used in the batch loop
and referenced when computing sessionID and legacyTodoID) without a stable
order, so duplicate todo_... IDs are resolved non-deterministically; sort the
todoFiles array before building todoSessions / starting the batch loop (i.e.,
call sort() on todoFiles early in the function that contains seenTodoIDs,
todoSessions, and the for-loop) so processing order is deterministic and the
seenTodoIDs de-duplication yields consistent migration output.

---

Nitpick comments:
In `@packages/opencode/test/session/todo.test.ts`:
- Around line 54-115: Replace the manual Instance.provide / Effect.runPromise
plumbing in both tests with the testEffect helper from test/lib/effect.ts: wrap
each test body with testEffect(...) so you can call effectful operations
directly (e.g., Session.create, Todo.Service.use, Todo.defaultLayer) without
Instance.provide and Effect.runPromise; update the two tests ("update returns
ids and get persists them" and "second update preserves id and persists status
changes") to use testEffect and drop explicit Instance.provide,
Effect.runPromise, and tmpdir usage inside the provide block while still calling
Session.remove at the end.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d3addb9-9893-4613-b931-21809ae7713e

📥 Commits

Reviewing files that changed from the base of the PR and between 774b96b and 3331107.

📒 Files selected for processing (7)
  • packages/app/src/pages/session/session-status-extractors.test.ts
  • packages/app/src/pages/session/todos/todo-model.test.ts
  • packages/opencode/src/session/todo.ts
  • packages/opencode/src/storage/json-migration.ts
  • packages/opencode/src/tool/todo.ts
  • packages/opencode/test/session/todo.test.ts
  • packages/opencode/test/storage/json-migration.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/app/src/pages/session/todos/todo-model.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/opencode/src/session/todo.ts
  • packages/opencode/src/tool/todo.ts

Comment thread packages/opencode/test/session/todo.test.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/opencode/test/session/todo.test.ts (1)

56-117: ⚡ Quick win

Switch these service tests to the Effect test harness (testEffect + it.live).

These cases run Effect services and depend on live FS/git behavior, so prefer Effect-native test wrappers over Effect.runPromise + Promise-style Instance.provide.

As per coding guidelines for packages/opencode/test/**/*.test.{ts,tsx}: use testEffect(...), use it.live(...) for live OS behavior, and prefer provideTmpdirInstance(...) / provideInstance(...) over manual Instance.provide(...) in Promise-style tests.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/opencode/test/session/todo.test.ts` around lines 56 - 117, The tests
use Promise-style Instance.provide and Effect.runPromise for Effect services and
live FS/git behavior; replace them with the Effect test harness by converting
each test to testEffect(...) and wrapping live behavior with it.live(...),
replace manual tmpdir/Instance.provide usage with provideTmpdirInstance(...) /
provideInstance(...) utilities, and run Todo.Service.use and
Session.create/remove inside the Effect test so you can supply Todo.defaultLayer
via .provide(provideTmpdirInstance(...)) instead of Instance.provide and remove
all Effect.runPromise calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/opencode/test/session/todo.test.ts`:
- Around line 56-117: The tests use Promise-style Instance.provide and
Effect.runPromise for Effect services and live FS/git behavior; replace them
with the Effect test harness by converting each test to testEffect(...) and
wrapping live behavior with it.live(...), replace manual tmpdir/Instance.provide
usage with provideTmpdirInstance(...) / provideInstance(...) utilities, and run
Todo.Service.use and Session.create/remove inside the Effect test so you can
supply Todo.defaultLayer via .provide(provideTmpdirInstance(...)) instead of
Instance.provide and remove all Effect.runPromise calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ea97cd8-1471-4f19-9d74-b891eb0abd15

📥 Commits

Reviewing files that changed from the base of the PR and between 3331107 and 48edf5c.

📒 Files selected for processing (1)
  • packages/opencode/test/session/todo.test.ts

@Astro-Han
Astro-Han merged commit 5fb78d9 into dev May 3, 2026
27 checks passed
@Astro-Han
Astro-Han deleted the codex/i395-todo-identity branch May 3, 2026 04:17
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.

[Task] Add stable todo identity or session todo revision

1 participant