Skip to content

Keep unsent input when switching pages, tabs or closing dialogs (GODM-31) - #32

Merged
danielehrhardt merged 6 commits into
mainfrom
agent/c-pro/c3a2f557b614
Sep 29, 2026
Merged

danielehrhardt merged 6 commits into
mainfrom
agent/c-pro/c3a2f557b614

Conversation

@danielehrhardt

Copy link
Copy Markdown
Contributor

Closes GODM-31.

What does this change?

Anything you've typed but haven't sent now stays put. It survives moving to another page, switching an agent's tabs, clicking outside a dialog, or reloading the window. Come back and it's exactly where you left it, with the cursor at the end so you can keep typing.

Chat draft with its attachment, after visiting other pages

Where drafts are kept

  • Chats: the message and any attached files, in every conversation and on the home screen.
  • New chat: the agent, model, folder, browser profile, VM, instructions and shared window you picked also stay. A message you come back to can't go to a different agent by accident.
  • New agent:
    • The "Describe it" text and the form are kept, one draft per template.
    • The page now opens with Pick up where you left off, which lists unfinished agents with Continue and Discard.
  • Agent → Settings: unsaved edits survive switching to Overview, Chats and the other tabs.
  • Dialogs: Run task (one draft per agent), New and Edit automation, and New and Edit workspace keep their content when you click outside them, press Esc or leave the page.
  • Automations: the "Describe what to automate" text is kept.

Unfinished agents on the New agent page

How drafts behave

  • A draft exists only while the input differs from where it started. It's cleared when you send or save.
  • Forms and dialogs show a quiet Draft saved · Discard line when there's something to throw away.
  • Only the fields you edited are stored. Fields you didn't touch come from the latest data when the draft comes back, so changes made elsewhere in the meantime are kept. For example, pausing an automation from the list while its edit dialog holds a draft, or Godmode rewriting an agent's instructions from a chat.
  • An open Settings form now takes in realtime updates for the fields you haven't changed. Before, it ignored them as soon as you edited anything.
  • Drafts last for the app session (sessionStorage). Attached files and the shared window stay in memory only.
  • Passwords, 2FA and MCP secrets are never stored as drafts.

Draft saved in the New workspace dialog after clicking outside it

Code: everything goes through apps/desktop/src/lib/drafts.ts. useDraft(key, initial) works like useState but keeps the value as a draft under key. DraftStatus in components/common.tsx renders the "Draft saved · Discard" line.

Also fixed: the chat composer used to save its draft 250 ms after the last keystroke. Anything typed just before switching pages was lost.

How was it tested?

  • pnpm typecheck and pnpm test pass (core: 670 pass, 0 fail).
  • Desktop dashboard against an isolated core (separate GODMODE_HOME and ports), driven with Playwright in Chromium. 36 checks pass with no console errors:
    • Chat text and attachments survive switching pages, including clicking away right after typing, and a reload.
    • New agent: the describe text and the form survive leaving the page. The resume card continues and discards drafts.
    • Settings edits survive tab switches. Instructions changed on the server flow into the open form while the edited description stays. Discard is clean.
    • Run task, automation and workspace dialogs keep their content after an outside click or Esc. Quick-start templates aren't overridden by an unrelated draft.
    • Editing a paused automation keeps its prompt draft, and "Enabled" follows the live state. The draft doesn't turn it back on.
    • A /?prompt= deep link starts on the default agent with a clean setup.
    • After a workspace is created or saved, the dialog opens blank with no draft.

Start from scratch with a kept draft

Checklist

  • pnpm typecheck and pnpm test pass
  • cargo clippy / cargo test pass (if apps/desktop/src-tauri changed): not changed
  • API changes are reflected in packages/shared and apps/desktop/src/lib/api.ts: no API changes
  • No secrets, tokens or personal data in code, fixtures, logs or screenshots
  • Docs updated where behaviour changed: UI only

…-31)

Chat messages (with attached files), the new chat setup, the new agent page and
form, agent settings, Run task, automation and workspace dialogs keep what was
typed as a session draft until it is sent, saved or discarded. Drafts only
override the fields that were edited, so changes made elsewhere meanwhile are
not reverted. The new agent page offers unfinished agents to pick up again.
# Conflicts:
#	apps/desktop/src/components/agents/agent-actions.tsx
#	apps/desktop/src/components/automations/one-prompt-card.tsx
#	apps/desktop/src/pages/agents/agent-new.tsx
@danielehrhardt
danielehrhardt merged commit 1d8bb16 into main Sep 29, 2026
4 of 5 checks passed
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