这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@K-Mistele
Copy link
Contributor

@K-Mistele K-Mistele commented Oct 17, 2025

What problem(s) was I solving?

Fixed ENG-2293 - Draft sessions in the table view showed empty cells when no title was set, making it impossible for users to identify their drafts.

The root cause was that draft sessions store prompt text in the editorState field as TipTap JSON (rich editor format) rather than in the query field. The query field only gets populated when a draft is launched, meaning unlaunch drafts always had an empty query field and would display as blank in the table.

What user-facing changes did I ship?

  • Before: Draft sessions without titles showed as empty rows in the drafts table, providing no way to identify them
  • After: Draft sessions now display a truncated preview (80 chars) of the prompt text, making them easily identifiable

The drafts table now shows content with this priority:

  1. User-set title (if available)
  2. AI-generated summary (if available)
  3. Query text from launched sessions (if available)
  4. NEW: Extracted text from editor state for unlaunched drafts
  5. Empty string as final fallback

How I implemented it

Added text extraction utility (humanlayer-wui/src/utils/formatting.ts)

  • Created extractTextFromEditorState() function that parses TipTap JSON and extracts plaintext
  • Handles text nodes, mention nodes (file references), and nested content structures
  • Returns empty string gracefully if parsing fails

Updated SessionTable display logic (humanlayer-wui/src/components/internal/SessionTable.tsx)

  • Added extractTextFromEditorState to the import list
  • Extended the fallback chain for title display to include extracted editor state text
  • Applied 80-character truncation to prevent table overflow

The implementation follows existing patterns in the codebase (similar to getSessionNotificationText) and requires no backend changes since the editorState field is already returned by the ListSessions API.

How to verify it

Automated Testing

  • Type checking passes: make -C humanlayer-wui check
  • Linting passes: make -C humanlayer-wui lint
  • Unit tests pass: make -C humanlayer-wui test

Manual Testing

  1. Test draft with prompt but no title:

    • Create a new draft session
    • Enter some prompt text (e.g., "Help me refactor this authentication code")
    • Do NOT set a custom title
    • Navigate back to the drafts list
    • ✅ Verify the prompt text appears truncated in the Title column
  2. Test existing behavior is preserved:

    • Create a draft with a custom title set
    • ✅ Verify the custom title still takes precedence
    • Launch a draft to generate a summary
    • ✅ Verify summary shows when no title is set
  3. Test truncation:

    • Create a draft with a very long prompt (200+ characters)
    • ✅ Verify it shows truncated with "..." at 80 characters
    • ✅ Verify the table layout isn't broken

Description for the changelog

Fixed draft sessions showing as blank in the drafts table when no title was set. The table now displays a preview of the draft's prompt text, making it easy to identify drafts at a glance.

Draft sessions store prompts in editorState field as TipTap JSON rather
than in the query field. Added utility to extract plaintext from TipTap
editor state and updated SessionTable to use this extracted text as a
fallback when displaying drafts without titles or summaries.

This ensures users can see their draft prompts in the table view even
when they haven't set a custom title.
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to fad74fa in 2 minutes and 0 seconds. Click for details.
  • Reviewed 86 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. humanlayer-wui/src/utils/formatting.ts:169
  • Draft comment:
    Good defensive JSON parsing in extractTextFromEditorState. Optionally log the parse error for debugging, and consider adding delimiters (e.g., spaces) when joining text nodes to avoid run-together words.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 30% vs. threshold = 50% The error logging suggestion is not critical - if parsing fails, returning empty string is a reasonable fallback. The delimiter suggestion is more interesting since joining without spaces could cause text to run together incorrectly. However, we don't have enough context about the TipTap editor structure to know if this is actually a problem - paragraphs might already have spaces, or running text together might be intended. I might be underestimating the importance of error logging for debugging. Also, even without full context, preventing run-together words seems like a reasonable suggestion. While valid points, neither suggestion shows clear evidence of being necessary. The code works as written, and we'd need more context about TipTap's structure to know if word spacing is actually an issue. The suggestions are reasonable but speculative without more context. Following our principle of only keeping comments with strong evidence of being necessary, we should remove this comment.

Workflow ID: wflow_5iROzFZBeqdbhRng

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@K-Mistele K-Mistele merged commit 62f1784 into main Oct 17, 2025
8 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.

3 participants