Skip to content

feat(web): rename tasks from the banner#7

Open
Antisophy wants to merge 2 commits into
CyberShadow:masterfrom
Antisophy:feat/task-rename
Open

feat(web): rename tasks from the banner#7
Antisophy wants to merge 2 commits into
CyberShadow:masterfrom
Antisophy:feat/task-rename

Conversation

@Antisophy

Copy link
Copy Markdown
Contributor

Task titles are auto-generated from the first user message, and on long-lived tasks they drift out of date as the work evolves, which makes the sidebar hard to navigate once a few tasks have outgrown their opening prompt.

This adds a Rename button to the banner (next to the session buttons). Clicking it swaps the button for an input pre-filled with the current name:

  • the name is pre-selected, so typing replaces it immediately
  • Enter or the Apply button commits, Escape cancels, empty names are ignored
  • the input width tracks the typed string: field-sizing: content where implemented, with the size attribute as a character-approximate fallback, both floored at the default 20-character input width

On the backend, a rename_task websocket message updates the title in memory and SQLite and rebroadcasts it through the existing title_update path, so the sidebar and all connected clients update live. The exported static viewer is unaffected (no handler is passed there, so the button does not render).

Tested with the full nix flake check suite.

Task titles are auto-generated from the first user message and drift
out of date as long-lived tasks evolve, leaving the sidebar hard to
navigate. Add a Rename button to the banner (next to the session
buttons) that swaps to an input pre-filled with the current name;
Enter or the Apply button commits, Escape cancels, and empty names are
ignored. The input pre-selects the name so typing replaces it
immediately, and its width tracks the typed string (field-sizing:
content where implemented, with the size attribute as an approximate
fallback, both floored at the default 20-character width).

On the backend, a rename_task websocket message updates the title in
memory and SQLite and rebroadcasts it via the existing title_update
path, so the sidebar and all connected clients update live.
Title generation runs as an async one-shot after the first message; its
completion handler applied the generated title unconditionally, so a
manual rename issued while generation was still in flight would be
clobbered when the one-shot landed. Capture the title at generation
start and apply the result only if the title is still unchanged.

Add an e2e spec covering the rename flow end to end against each agent
(it surfaced this race): the input opens pre-filled with the current
title, Enter and the Apply button each commit a new name to the
sidebar, Escape cancels without renaming, and the renamed title
survives a page reload, proving it came back from the server store.
@Antisophy

Copy link
Copy Markdown
Contributor Author

Added e2e coverage in tests/e2e/task-rename.spec.ts, running for all three agents. It exercises the full flow: the input opens pre-filled with the current title (whatever the agent's title one-shot produced), Enter and the Apply button each commit a new name to the sidebar, Escape cancels without renaming, and the renamed title survives a page reload, proving the value came back from the server store rather than client state.

Writing the test surfaced a real race, fixed in the same commit: title generation runs as an async one-shot after the first message, and its completion handler applied the generated title unconditionally, so a manual rename issued while generation was still in flight would be clobbered when the one-shot landed. The handler now captures the title at generation start and applies the result only if the title is still unchanged.

Full nix flake check suite is green on the branch tip.

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.

1 participant