Skip to content

feat: add session label system (backend + sidebar UI)#12

Open
huiyuanXP wants to merge 6 commits into
Ninglo:mainfrom
huiyuanXP:pr/label-split
Open

feat: add session label system (backend + sidebar UI)#12
huiyuanXP wants to merge 6 commits into
Ninglo:mainfrom
huiyuanXP:pr/label-split

Conversation

@huiyuanXP
Copy link
Copy Markdown
Contributor

Summary

  • add session label definitions and assignment APIs
  • add auto-distill prompt context wiring for labels
  • add sidebar label picker UI and follow-up UI fixes

Scope

  • includes both backend and frontend for labels only
  • excludes ops/report/trigger and theme toggle changes

huiyuanXP and others added 6 commits March 29, 2026 14:24
Backend:
- session-labels.mjs: label CRUD, setSessionLabel(), boot recovery
- session-auto-distill.mjs: auto-generate experience notes via Haiku
  when label transitions to done/pending-review
- Auto-set 'started' label on message send
- Boot-time recovery for asked-for-restart labels
- Config: SESSION_LABELS_FILE, TASKS_FILE, REPORTS_DIR paths

Frontend:
- Sidebar: colored label badge (◆) displayed in session meta line
- Label definitions fetched on app init (/api/session-labels)
- CSS: .session-label-badge styling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ◆ button in session action bar opens label dropdown
- Click to assign/change label, shows current label as active
- Clear option to remove label
- Dropdown auto-dismisses on outside click
- CSS: dropdown styling with hover states

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
API returns {labels: [...]} not a bare array. Fix init.js to extract
.labels field, and add defensive Array.isArray check in renderer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Label badge in session meta line is now directly clickable
- Empty state shows subtle "◇ label" placeholder (hover to reveal)
- Remove redundant ◆ button from session action bar
- Cleaner UX: label lives where it's displayed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d5614da36

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread chat-server.mjs Outdated
Comment on lines +14 to +15
import('./chat/task-manager.mjs'),
import('./chat/scheduler.mjs'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Remove imports for modules absent from this commit

chat-server.mjs now unconditionally imports ./chat/task-manager.mjs and ./chat/scheduler.mjs, but this commit does not add either file (it only adds chat/session-auto-distill.mjs and chat/session-labels.mjs under chat/). Because these imports are inside top-level Promise.all(...), Node throws ERR_MODULE_NOT_FOUND during startup and the chat server cannot boot at all.

Useful? React with 👍 / 👎.

Comment on lines +318 to +320
await fetch(`/api/sessions/${session.id}/label`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Persist label changes only after a successful API call

The new label picker calls PATCH /api/sessions/${session.id}/label, but the session PATCH handler accepts only /api/sessions/:id (it rejects paths where parts.length !== 3 in chat/router-control-routes.mjs), so this request returns an error instead of updating metadata. Since the client code does not check response.ok and updates session.label locally anyway, users see a successful label change in the sidebar that is not actually saved and disappears after refresh.

Useful? React with 👍 / 👎.

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