Skip to content

feat(witan): add a compose-style terminal editor for tasks - #772

Open
jkachel wants to merge 7 commits into
mainfrom
feat/witan-task-tui
Open

jkachel wants to merge 7 commits into
mainfrom
feat/witan-task-tui

Conversation

@jkachel

@jkachel jkachel commented Dec 3, 2026

Copy link
Copy Markdown

witan task new and witan task edit <slug> open a Textual screen with the
task's metadata fields above a large description pane. An edit writes only the
changed fields, re-links parent and blockers through task_link, and offers
reload or overwrite when the task changed since it was opened. Unsaved work is
autosaved as a draft under $XDG_STATE_HOME/witan/drafts.

Every service call runs on a worker thread with terminal prompts off: the CLI's
tool dispatch drives async tools and the remote proxy with asyncio.run, which
cannot nest inside Textual's running loop, and a console prompt would fight
Textual for the terminal.

Textual is the optional tui extra, so servers and the image do not pick it up.

Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com

`witan task new` and `witan task edit <slug>` open a Textual screen with the
task's metadata fields above a large description pane. An edit writes only the
changed fields, re-links parent and blockers through task_link, and offers
reload or overwrite when the task changed since it was opened. Unsaved work is
autosaved as a draft under $XDG_STATE_HOME/witan/drafts.

Every service call runs on a worker thread with terminal prompts off: the CLI's
tool dispatch drives async tools and the remote proxy with asyncio.run, which
cannot nest inside Textual's running loop, and a console prompt would fight
Textual for the terminal.

Textual is the optional `tui` extra, so servers and the image do not pick it up.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@agent-optibot agent-optibot 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.

Summary

Adds compose-style terminal editing for creating and updating tasks.

  • Adds: compose-style terminal editing with metadata fields, description editing, and keyboard actions.
  • Changes: task updates to write only changed fields and detect external changes before saving.
  • Adds: draft autosaving under $XDG_STATE_HOME/witan/drafts with restore and discard actions.

Dependencies changed: mcp/servers/witan/pyproject.toml, uv.lock
New environment variables read: EDITOR, VISUAL, XDG_STATE_HOME

Details for reviewers

Risks

  • Parent additions use task_update instead of task_link, so link-specific validation or behavior may be skipped.
  • A successful field update followed by a failed task_link can leave the task partially changed while the editor reports a failed save.

Core files: mcp/servers/witan/witan/tui/app.py, mcp/servers/witan/witan/tui/service.py, mcp/servers/witan/witan/cli/tasks.py

More changes

  • Adds: worker-thread service calls with terminal prompts disabled while Textual owns the terminal. (service.py, app.py)
  • Adds: the optional tui extra with Textual and documents the new task commands. (pyproject.toml, README.md, cli.md and 2 more)
  • Adds: coverage for form validation, drafts, stale tasks, partial updates, and save outcomes. (test_task_tui_app.py, test_task_tui_service.py)

Unchanged

  • Scripted task creation and updates remain available through the existing non-interactive commands.
  • Claiming, releasing, and closing remain outside the editor.

Summary of a3195e4 · React 👍 or 👎 on my comments to tune what I raise · Commands · Review config

@agent-optibot agent-optibot 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.

Status: Needs Changes 🔧

Blocking Issues:

  • Restoring a draft can revert concurrent task edits without warning.
  • A failed blocker replacement can remove a real dependency and reopen the task.
  • Reload can silently revert a teammate’s description on the next save.
  • Overwriting a concurrent reparent uses the wrong edge.
  • Drafts are shared across unrelated deployment targets.
  • Offline saves cannot reliably queue the complete edit.
  • Saving an unrelated change can split existing multiword tags.

📌 Reviewed up to the latest commit · ⏱️ Review completed in 8 minutes

  • 🔄 re-review this PR

Comment thread mcp/servers/witan/witan/tui/app.py Resolved
Comment thread mcp/servers/witan/witan/tui/service.py Resolved
Comment thread mcp/servers/witan/witan/tui/app.py Resolved
Comment thread mcp/servers/witan/witan/tui/service.py Resolved
Comment thread mcp/servers/witan/witan/tui/app.py Resolved
Comment thread mcp/servers/witan/witan/tui/service.py Resolved
Comment thread mcp/servers/witan/witan/tui/service.py Resolved
Comment thread mcp/servers/witan/witan/tui/app.py Resolved
Comment thread docs/reference/cli.md Resolved
Comment thread mcp/servers/witan/witan/tui/service.py Resolved
F2 no longer takes the editor down when $EDITOR is missing, unreadable or the
terminal cannot be handed over, and the draft is flushed before suspending.

Esc and Ctrl-S no longer act beneath the stale-task prompt, and Esc is not a
priority binding any more, so it closes an open dropdown instead of cancelling.

A restored draft now carries only the fields the user edited (the draft keeps
the form it was diffed against), so it cannot write old values back over
someone else's later changes. New-task drafts are keyed by repo.

When the update is queued in the offline journal the parent and blocker changes
are queued behind it instead of being dropped, and a failing link is a warning
rather than a failed save. Tags split on commas only, so a tag with a space
survives. Draft writes tolerate an unwritable state dir, and the debounce timer
is stopped before a draft is discarded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jkachel

jkachel commented Dec 3, 2026

Copy link
Copy Markdown
Author

Claude Code reviewed this change at a3195e4 for the author: 7 findings, 7 fixed.

  • mcp/servers/witan/witan/tui/app.py:365: F2 crashed the editor when the editor command was missing, unreadable, or the terminal could not be handed over. Fixed in d75d1c0, and the draft is now flushed before suspending.
  • mcp/servers/witan/witan/tui/service.py:288: a queued update dropped the parent and blocker changes, and a failing link left a half-written task. Fixed in d75d1c0: the link writes are queued behind the update, and a failing link is reported as a warning.
  • mcp/servers/witan/witan/tui/app.py:85: Esc and Ctrl-S fired beneath the stale-task prompt, and Esc could not close a dropdown. Fixed in d75d1c0.
  • mcp/servers/witan/witan/tui/app.py:170: a restored draft in edit mode wrote old values back over later changes by others. Fixed in d75d1c0: a draft now keeps the form it was diffed against and restores only the fields the user edited.
  • mcp/servers/witan/witan/tui/service.py:23: tags were split on whitespace as well as commas. Fixed in d75d1c0.
  • mcp/servers/witan/witan/tui/app.py:250: draft writes could crash on an unwritable state directory, and the debounce timer could recreate a discarded draft. Fixed in d75d1c0.
  • mcp/servers/witan/witan/tui/app.py:170: the new-task draft was shared across repos. Fixed in d75d1c0: it is keyed by repo.

Each fix has a test. The 5 failures in the omnigraph server entrypoint tests also fail on a clean main and are not from this change.

Every new parent or blocker is looked up before the first write, so a
mistyped slug, or a task named as its own parent or blocker, is refused with
nothing applied. New links are added before old ones are removed, and if one
fails the existing parent and blockers are kept. The parent removed is the one
stored now, not the one the editor opened with, so an overwrite after a
concurrent re-parent drops the right edge. A warning returned by a close, about
dependents that could not be reopened, now reaches the result.

Reload lays only the fields the user edited over the latest task instead of
carrying the old description back. A form that is clean again drops its draft,
and untouched tags keep their stored value exactly. Drafts are namespaced by
the store they would be written to, so one --target never restores another's.

The CLI and the editor share one formatter for the queued-in-the-journal
answer. The task edit help now says that setting a status here behaves as in
task update.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@agent-optibot agent-optibot 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.

Status: Needs Changes 🔧

Blocking Issues:

  • A failed blocker addition can leave a task linked to two parents.
  • An unusable draft directory can discard unsaved work or crash after a successful save.
⚠️ Unresolved blockers from previous reviews (1)

Disagree with one? 👎 its comment or mark the thread resolved and it won't be raised again.

✅ Resolved since last review (10)
  • mcp/servers/witan/witan/tui/service.py:426 — Replacing a valid blocker with a mistyped tk-… slug removes the existing blocker and can reopen the task before the new link fails; any fi…
  • mcp/servers/witan/witan/tui/app.py:370 — Reload always carries over the old description, even when the user never edited it, so the next save can revert a teammate’s newer descripti…
  • mcp/servers/witan/witan/tui/service.py — After a concurrent reparent from P to Q, overwriting with R removes P rather than Q, leaving Q’s ParentOf edge behind; overwriting with a…
  • mcp/servers/witan/witan/tui/app.py — The same new key and task slugs are reused across every --target, so opening the editor against production can silently restore a draft…
  • mcp/servers/witan/witan/tui/app.py — The tag field splits on whitespace, so an existing tag such as needs review becomes two tags and is written back even when the user only e…
  • mcp/servers/witan/witan/tui/service.py — This repeats the journal-response detection and message formatting in mcp/servers/witan/witan/cli/tasks.py:360–374. Extract a shared forma…
  • mcp/servers/witan/witan/tui/service.py:353 — task_update(status="closed") can return a warning naming dependents that could not be reopened (server.py:7679-7685, applied at 8771-877…
  • mcp/servers/witan/witan/tui/app.py — _write_draft only saves when the form is dirty and never deletes an existing draft, and action_cancel exits without discarding when the…
  • docs/reference/cli.md — The task edit docs say "Claiming, releasing and closing stay on their own commands", but the editor's status Select offers in_progress/`…
  • mcp/servers/witan/witan/tui/service.py — _queued here reimplements the queued-journal detection and message format already in witan/cli/tasks.py:360-374 (`Queued as journal entr…

📌 Reviewed up to the latest commit · ⏱️ Review completed in 8 minutes

  • 🔄 re-review this PR

Comment thread mcp/servers/witan/witan/tui/service.py Resolved
Comment thread mcp/servers/witan/witan/tui/app.py Resolved
Comment thread mcp/servers/witan/witan/tui/service.py Resolved
…side failures

Replacing a parent no longer waits on blocker additions, since task_update has
already written the new parent; only blocker removals are held back when an add
fails. Both the stored parent and the one the editor opened with are dropped, so
a concurrent re-parent plus overwrite cannot leave a second parent edge.

Draft cleanup is best effort, so an unusable state directory cannot turn a
committed save into a crash, and Close-keep-draft only exits once the draft is
actually on disk.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@agent-optibot agent-optibot 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.

Status: Needs Changes 🔧

Blocking Issues:

  • Discard exits without deleting the draft when cleanup fails.
  • Stale-parent cleanup can erase a concurrent re-parent.
⚠️ Unresolved blockers from previous reviews (1)

Disagree with one? 👎 its comment or mark the thread resolved and it won't be raised again.

✅ Resolved since last review (13)
  • docs/reference/cli.md — The task edit docs say "Claiming, releasing and closing stay on their own commands", but the editor's status Select offers in_progress/`…
  • mcp/servers/witan/witan/tui/service.py:433 — Replacing a valid blocker with a mistyped tk-… slug removes the existing blocker and can reopen the task before the new link fails; any fi…
  • mcp/servers/witan/witan/tui/app.py:378 — Reload always carries over the old description, even when the user never edited it, so the next save can revert a teammate’s newer descripti…
  • mcp/servers/witan/witan/tui/service.py — After a concurrent reparent from P to Q, overwriting with R removes P rather than Q, leaving Q’s ParentOf edge behind; overwriting with a…
  • mcp/servers/witan/witan/tui/app.py — The same new key and task slugs are reused across every --target, so opening the editor against production can silently restore a draft…
  • mcp/servers/witan/witan/tui/app.py — The tag field splits on whitespace, so an existing tag such as needs review becomes two tags and is written back even when the user only e…
  • mcp/servers/witan/witan/tui/service.py — This repeats the journal-response detection and message formatting in mcp/servers/witan/witan/cli/tasks.py:360–374. Extract a shared forma…
  • mcp/servers/witan/witan/tui/service.py:353 — task_update(status="closed") can return a warning naming dependents that could not be reopened (server.py:7679-7685, applied at 8771-877…
  • mcp/servers/witan/witan/tui/app.py — _write_draft only saves when the form is dirty and never deletes an existing draft, and action_cancel exits without discarding when the…
  • mcp/servers/witan/witan/tui/service.py — _queued here reimplements the queued-journal detection and message format already in witan/cli/tasks.py:360-374 (`Queued as journal entr…
  • mcp/servers/witan/witan/tui/service.py — task_update(parent=...) already adds the new parent edge and changes parent_slug, but a failed blocker addition skips removal of the old…
  • mcp/servers/witan/witan/tui/app.py — With the non-directory XDG_STATE_HOME covered by the new test, draft cleanup raises NotADirectoryError after a task has already been com…
  • mcp/servers/witan/witan/tui/service.py:400 — The overwrite re-parent path only removes the parent stored now; the edge from the parent the editor opened with (base.parent) is never…

📌 Reviewed up to the latest commit · ⏱️ Review completed in 6 minutes

  • 🔄 re-review this PR

Comment thread mcp/servers/witan/witan/tui/app.py Resolved
Comment on lines +396 to +410
drop_parents = (
sorted({p for p in (stored_parent, base.parent) if p and p != form.parent})
if parent_changed
else []
)
# The new parent is already written by task_update above, so replacing
# the old one never depends on a blocker addition having worked.
for old_parent in drop_parents:
relink(
f"unparent from {old_parent}",
from_slug=old_parent,
to_slug=slug,
kind="parent",
remove=True,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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


The extra unlink of base.parent can erase a newer re-parent: if the editor opened with P, reads Q, and writes R, another writer can restore P before cleanup; task_link(remove=True) then deletes P’s edge and clears the live parent_slug. Move parent replacement and stale-edge cleanup into one fenced server-side mutation so cleanup cannot undo a later re-parent.

[Bug]

Solve it in vscode or cursor.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude Code here, for the author: I traced this and left it. The race is real but narrow: it needs the editor to overwrite a stale task while another writer puts the original parent back inside that window. Removing the opened-with parent was added in e41fc54 to clear the edge that task_update leaves behind on a re-parent. Closing the window needs the parent swap and the stale-edge cleanup to be one fenced server-side mutation, which is a change to task_update and outside this PR. I'm bringing it to the author as a follow-up.

An explicit Discard now closes only once the autosaved draft is actually gone;
otherwise the discarded changes would be restored on the next open. Cleanup
after a committed save or on a clean form stays best effort.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@agent-optibot agent-optibot 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.

Status: Needs Changes 🔧

Blocking Issues:

  • Previously-raised issue(s) remain unaddressed (see below).
⚠️ Unresolved blockers from previous reviews (1)

Disagree with one? 👎 its comment or mark the thread resolved and it won't be raised again.

✅ Resolved since last review (14)
  • mcp/servers/witan/witan/tui/service.py:433 — Replacing a valid blocker with a mistyped tk-… slug removes the existing blocker and can reopen the task before the new link fails; any fi…
  • mcp/servers/witan/witan/tui/service.py — After a concurrent reparent from P to Q, overwriting with R removes P rather than Q, leaving Q’s ParentOf edge behind; overwriting with a…
  • mcp/servers/witan/witan/tui/service.py — This repeats the journal-response detection and message formatting in mcp/servers/witan/witan/cli/tasks.py:360–374. Extract a shared forma…
  • mcp/servers/witan/witan/tui/service.py:353 — task_update(status="closed") can return a warning naming dependents that could not be reopened (server.py:7679-7685, applied at 8771-877…
  • docs/reference/cli.md — The task edit docs say "Claiming, releasing and closing stay on their own commands", but the editor's status Select offers in_progress/`…
  • mcp/servers/witan/witan/tui/service.py — _queued here reimplements the queued-journal detection and message format already in witan/cli/tasks.py:360-374 (`Queued as journal entr…
  • mcp/servers/witan/witan/tui/service.py — task_update(parent=...) already adds the new parent edge and changes parent_slug, but a failed blocker addition skips removal of the old…
  • mcp/servers/witan/witan/tui/service.py:400 — The overwrite re-parent path only removes the parent stored now; the edge from the parent the editor opened with (base.parent) is never…
  • mcp/servers/witan/witan/tui/app.py:384 — Reload always carries over the old description, even when the user never edited it, so the next save can revert a teammate’s newer descripti…
  • mcp/servers/witan/witan/tui/app.py — The same new key and task slugs are reused across every --target, so opening the editor against production can silently restore a draft…
  • mcp/servers/witan/witan/tui/app.py — The tag field splits on whitespace, so an existing tag such as needs review becomes two tags and is written back even when the user only e…
  • mcp/servers/witan/witan/tui/app.py — _write_draft only saves when the form is dirty and never deletes an existing draft, and action_cancel exits without discarding when the…
  • mcp/servers/witan/witan/tui/app.py — With the non-directory XDG_STATE_HOME covered by the new test, draft cleanup raises NotADirectoryError after a task has already been com…
  • mcp/servers/witan/witan/tui/app.py:296 — Swallowing the deletion error makes an explicit “Discard” close the editor even though the autosaved draft is still on disk. If the state di…

📌 Reviewed up to the latest commit · ⏱️ Review completed in 6 minutes

  • 🔄 re-review this PR

Comment thread mcp/servers/witan/witan/tui/app.py Resolved
else "Reloaded the latest task."
)

def action_cancel(self) -> None:

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.

Overwrite can be cancelled mid-save, and the CLI then reports "Cancelled; nothing saved." after the write has landed.

A normal Ctrl-S save is safe: action_save awaits _save, so Esc is not handled until the save finishes. The Overwrite path is different. The stale Choice callback starts _on_stale with run_worker, so _save(overwrite=True) runs in the background while the editor keeps taking keys. action_cancel checks _modal_open() but not self._saving. So:

  1. Ctrl-S on a task that changed since it was opened → the stale prompt
  2. Overwrite → task_update starts on a worker thread
  3. Esc → the form is still dirty (self.base has not moved), so "You have unsaved changes" appears
  4. Discard → the draft is deleted and the app exits with None

_run_task_editor prints "Cancelled; nothing saved.", but the task_update already in flight still completes. The user believes nothing was written, and the draft holding their text is gone.

Reproduced with the PR's own FakeSrv, with task_update delayed by 1.5 s (deployed writes run about 5 s at p95, per the comment in server.task_update): the run ended with return_value=None and task_update calls=1. The same sequence after a plain Ctrl-S correctly returned saved.

Suggested fix: make action_cancel (and probably action_save / action_external_editor too) do nothing while self._saving is set, or have _on_stale await the save in a way that blocks key handling the way action_save does. A pilot test would cover it: Overwrite, then Esc, should not open the unsaved-changes prompt.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude Code here, for the author: confirmed and fixed. action_cancel and action_external_editor now do nothing while a save is in flight, so Esc during an Overwrite cannot reach Discard. A pilot test covers it.

An Overwrite save runs on a worker with keys still live, so Esc could reach
Discard and report "nothing saved" after the write had landed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@agent-optibot agent-optibot 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.

Status: Needs Changes 🔧

Blocking Issues:

  • Previously-raised issue(s) remain unaddressed (see below).
⚠️ Unresolved blockers from previous reviews (1)

Disagree with one? 👎 its comment or mark the thread resolved and it won't be raised again.

✅ Resolved since last review (13)
  • mcp/servers/witan/witan/tui/service.py:433 — Replacing a valid blocker with a mistyped tk-… slug removes the existing blocker and can reopen the task before the new link fails; any fi…
  • mcp/servers/witan/witan/tui/service.py — After a concurrent reparent from P to Q, overwriting with R removes P rather than Q, leaving Q’s ParentOf edge behind; overwriting with a…
  • mcp/servers/witan/witan/tui/service.py — This repeats the journal-response detection and message formatting in mcp/servers/witan/witan/cli/tasks.py:360–374. Extract a shared forma…
  • mcp/servers/witan/witan/tui/service.py:353 — task_update(status="closed") can return a warning naming dependents that could not be reopened (server.py:7679-7685, applied at 8771-877…
  • docs/reference/cli.md — The task edit docs say "Claiming, releasing and closing stay on their own commands", but the editor's status Select offers in_progress/`…
  • mcp/servers/witan/witan/tui/service.py — _queued here reimplements the queued-journal detection and message format already in witan/cli/tasks.py:360-374 (`Queued as journal entr…
  • mcp/servers/witan/witan/tui/service.py — task_update(parent=...) already adds the new parent edge and changes parent_slug, but a failed blocker addition skips removal of the old…
  • mcp/servers/witan/witan/tui/service.py:400 — The overwrite re-parent path only removes the parent stored now; the edge from the parent the editor opened with (base.parent) is never…
  • mcp/servers/witan/witan/tui/app.py:384 — Reload always carries over the old description, even when the user never edited it, so the next save can revert a teammate’s newer descripti…
  • mcp/servers/witan/witan/tui/app.py — The same new key and task slugs are reused across every --target, so opening the editor against production can silently restore a draft…
  • mcp/servers/witan/witan/tui/app.py — _write_draft only saves when the form is dirty and never deletes an existing draft, and action_cancel exits without discarding when the…
  • mcp/servers/witan/witan/tui/app.py — With the non-directory XDG_STATE_HOME covered by the new test, draft cleanup raises NotADirectoryError after a task has already been com…
  • mcp/servers/witan/witan/tui/app.py:296 — Swallowing the deletion error makes an explicit “Discard” close the editor even though the autosaved draft is still on disk. If the state di…

📌 Reviewed up to the latest commit · ⏱️ Review completed in 4 minutes

  • 🔄 re-review this PR


def test_escape_is_ignored_while_a_save_is_in_flight():
"""An Overwrite save runs on a worker with keys live; Esc must not offer Discard."""
from tests.test_task_tui_app import Service # noqa: PLC0415

Copy link
Copy Markdown

Choose a reason for hiding this comment

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


This imports Service from the sibling test module, but Local at the top of this file is the identical subclass (store_id "local", same default_repo) — use Local(FakeSrv(task=TASK)) and drop the cross-module import and its noqa.

[Duplicate] · non-blocking — test-only duplication; no runtime impact

Solve it in vscode or cursor.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude Code here, for the author: fixed in 607d18d. The test now uses the file's own Local service, so the cross-module import and its unused noqa are gone (that noqa was also what turned the prek check red).

Comment on lines +311 to +316
app._saving = True
await pilot.press("escape")
await pilot.pause()
return app.screen.__class__.__name__

assert run(go()) != "Choice"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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


The test pokes the private _saving flag by hand and only asserts the screen != "Choice", so a wholly broken escape binding would also pass. Drive a real in-flight save (a fake whose task_update blocks on an event, released before the context exits) and assert the screen is still the default Screen.

[Test] · non-blocking — weak regression test, guard itself is correct

Solve it in vscode or cursor.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude Code here, for the author: fixed in 607d18d. The test now drives a real Overwrite save whose task_update blocks on an event, presses Esc mid-save, and asserts no prompt opens, then releases the save. It no longer sets the private flag by hand.

…ion test

The test now blocks task_update on an event and presses Esc mid-save, instead of
setting the private flag, and uses the file's own Local service so the
cross-module import (and its unused noqa that failed ruff) is gone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@agent-optibot agent-optibot 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.

Status: Needs Changes 🔧

Blocking Issues:

  • Previously-raised issue(s) remain unaddressed (see below).
⚠️ Unresolved blockers from previous reviews (1)

Disagree with one? 👎 its comment or mark the thread resolved and it won't be raised again.

✅ Resolved since last review (14)

📌 Reviewed up to the latest commit · ⏱️ Review completed in 3 minutes

  • 🔄 re-review this PR

Comment on lines +334 to +339
during = type(app.screen).__name__
release.set()
await pilot.pause()
return during

assert run(go()) != "Choice"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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


The assertion only inspects the screen before the save finishes, so a regression that re-runs the staleness check on the overwrite pass (e.g. _on_stale dropping overwrite=True, making the second save stale again) would push Choice only after release.set() and still pass. After release.set(), assert the write actually landed — e.g. srv.named("task_update") is non-empty or app.return_value.kind == "saved".

[Test] · non-blocking — test-coverage gap only; feature itself verified elsewhere

Solve it in vscode or cursor.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude Code here, for the author: agreed, asserting that the overwrite write lands after the save is released is a worthwhile addition. It is marked non-blocking, so it will go up with the next push rather than start one.

Comment on lines +314 to +316
def blocked(**kwargs):
release.wait(5)
return plain(**kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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


If any assertion above fails, release is never set and the worker thread stays in release.wait(5), so asyncio.run's executor shutdown stalls the full 5s before the failure surfaces. Set the event in a finally (or shorten the wait) so failures report promptly.

[Test] · non-blocking — only slows failure reporting; no wrong result

Solve it in vscode or cursor.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude Code here, for the author: agreed, the event should be set in a finally so a failing assertion reports promptly. It is marked non-blocking, so it will go up with the next push rather than start one.

This branch has not been deployed

No deployments
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