Skip to content
PidebugWeb3 files · +189 −86

Fix session title falling back to "New session" in Pi Web bridge

Session from pi-web on Hugging Face by woxQAQ · MIT · condensed by Coders Talk

1h 05msession
0interventions
GOAL

Investigate why the frontend session title logic in a Vue/bridge codebase defaults to "New session" for real sessions, then fix the underlying bugs in title priority and session summary extraction.

  1. Prompt · +0
    我们是如何给新会话赋名的 (How do we name new sessions?)
  2. Agent did · +0m
    Traced session naming logic across bridge and web: default 'New session' constant, first-user-message extraction, set_session_name RPC, and two inconsistent naming priority orders between sessionDisplayName() and the session list summary.
  3. Prompt · +1m
    我们bridge协议中应该有 sessionName 的 (The bridge protocol should have sessionName)
  4. Agent did · +2m
    Confirmed sessionName exists in RpcSessionState and multiple RPC responses, and traced how bridge populates it via sessionDisplayName() and getSessionName().
  5. Prompt · +4m
    我们应该在前端展示这个sessionName吧 (We should display sessionName in the frontend)
  6. Agent did · +5m
    Recommended prioritizing sessionState.sessionName over list-derived name in App.vue, then implemented the change to activeSessionLabel and verified with pnpm run build:web.
  7. Prompt · +10m
    检查一下为什么 cbb636aa-4d3f-4404-811b-46ec2285d8a5 这个会话前端显示的session name 是 New session
  8. Agent did · +10m
    Investigated multiple real sessions via jsonl files and live WebSocket queries, found the ID was a request ID not a session ID, then found another session's title truncated because a large embedded image pushed the first user message past the 64KB prefix read limit, breaking JSON parsing.
  9. Prompt · +39m
    我们有办法略去 image block 吗 (Can we skip the image block when reading the summary?)
  10. Prompt · +43m
    2 (chose option 2: lightweight raw-string text extraction instead of full JSON parse)
  11. Agent did · +43m
    Implemented parseJsonStringLiteral() and extractUserMessageTextFromRawLine() as a fallback in findFirstUserMessageText() so truncated JSON lines with large image payloads still yield the first user text; added a regression test and verified with vitest and pnpm run check.
  12. Outcome · +1h 5m
    Committed f568c08 'fix: improve session title handling': 3 files changed, 115 insertions, 8 deletions; targeted vitest test passed and type check passed.
VERDICT

Next time I'd start by asking directly for the two known root causes at once: the frontend title priority order and the 64KB session-summary read truncation on large image messages, since both turned out to matter. The correction that actually did the work was picking option 2 (raw-string text extraction) over fully reading the whole first line, which let us fix the truncation bug without changing the read strategy everywhere.

I tried this · 0

Discussion · 0

How Builds work