Skip to content

feat(studio): align Settings > Learning with the prototype - #2232

Merged
kantord merged 7 commits into
mainfrom
feat/studio-learning-1855
Oct 14, 2026
Merged

kantord merged 7 commits into
mainfrom
feat/studio-learning-1855

Conversation

@peppescg

@peppescg peppescg commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This is the learning slice of the Studio alignment (part of #2210). It's stacked on #2229, so review that first. Settings > Learning now uses the prototype's page: a read-only Learning card, a Suggestions queue with status pills, Refresh, Load more and a Details disclosure per row, and a "Learn from a chat" card on the Select primitive. The BFF gains cursor paging for the queue and a single-proposal read with evidence, both on the published SDK 0.4.0.

Studio's semantics stay the same. Every Approve, Reject and Undo approval is still confirmed first and sends the loaded version; a version conflict still refreshes the queue and is never retried; reflection still offers only completed chats and refreshes the queue. The "No regression" section below has the proof.

What changed

BFF and contracts (apps/contracts, apps/server)

  • GET /api/v1/learning-proposals takes the daemon's cursor and an optional limit (1 to 200), and returns nextCursor. Without a limit the page stays 100, as before.
  • New GET /api/v1/learning-proposals/{proposalId} re-reads one proposal with its evidence: each source chat, whether it still resolves to the recorded digest, and the daemon's bounded, redacted preview. It is gated on the learningProposals capability (501 learning_proposals_unsupported), like the other proposal routes.
  • Only this read carries evidence. The daemon checks availability only when it re-reads a single proposal; in a list it reports every source as unavailable with no preview. List items keep evidenceCount and nothing else.
  • A missing proposal answers 404 not_found. The daemon reports it with its generic session_not_found code, so the BFF names it. Other refusals keep their code (a manifest that no longer resolves is 409 failed_precondition).
  • Contract changes, all in apps/contracts/src/schemas/knowledge.ts: new learningEvidenceSchema and learningProposalDetailSchema (learningProposalSchema plus evidence), and nextCursor on learningProposalsResponseSchema. feat(studio): show the proposal that wrote a memory fact #2229's sourceProposalId is untouched; the generated files were regenerated on top of it.

Settings > Learning (apps/web/src/features/learning/)

The files moved from features/knowledge/learning-review.tsx in a move-only commit, then split as in the prototype:

  • learning-mode-section.tsx: the read-only "Learning" card.
  • learning-settings-page.tsx: the page, the Suggestions card and the "Learn from a chat" card.
    • Pending, Deferred, Approved and Rejected pills, with aria-pressed. Each sends the daemon's exact status token, and the filter is kept across pages.
    • The queue is an infinite query over the generated listLearningProposalsInfiniteOptions, 50 per page. Load more appends the next page, and an id that a moving queue already showed is not listed twice. Refresh restarts from the first page. A decision refreshes every loaded page.
    • Success is a toast ("Suggestion approved", "Suggestion rejected", "Approval undone"), as in the prototype. The conflict notice and errors stay inline, with role="status" and role="alert".
    • "Learning is off" when the agent offers neither capability; a note when it offers only one.
    • The session picker is the Select primitive (it was a native <select>, Studio: use shadcn/ui primitives like the prototype and SEP (no custom components) #2201).
  • proposal-row.tsx: the prototype's row. Details re-reads the proposal by id the first time it opens, and lists each source with a View chat link (/workspace/chat?sessionId=…), Available or Unavailable with the daemon's reason, and the excerpt as plain text in a <pre>. A learned skill links to its detail. If the re-read finds a newer version, the row says so and the list takes it, so the next decision sends the current version.

Test infrastructure

test-setup.ts now dismisses sonner toasts after every test. sonner keeps its toasts in a module-level store and replays the active ones to every Toaster that mounts, so under isolate: false a toast from one test showed up in the next test's Toaster.

Docs

user-docs/operating/studio.md gains "Review learning suggestions".

Visible change

  • Learning card: titled "Learning" (was "Learning settings"), without the "You can review proposals below" lead-in.
  • Queue card: "Suggestions" in the settings eyebrow style, without the icon tile and description. Four pills (was three: "Promoted" is now "Approved", and "Deferred" is new) and a Refresh button.
  • Rows:
    • title in 14px, with the kind and project badges and a relative time ("2h ago") on the same line
    • no key line, trigger tags, evidence count or "Updated" date
    • the value in proportional muted text (was monospace)
    • the reason Approve is unavailable shown inline (before, only a title)
    • "Undo approval" (was "Undo promotion"), and a Details disclosure
  • Paging: Load more replaces "Showing the first 100 proposals in this state."
  • Conflict: the prototype's wording on Studio's warning tint (was an info tint). The raw "proposal version changed" error no longer appears under it.
  • Reflection: the "Learn from a chat" card, "Choose a finished chat…", "Find suggestions" / "Looking…", and the receipt in the card ("Done: 2 to review · 1 clashed with existing memory.").
  • Confirmation: the same dialog, with "suggestion" wording.
  • Phones: the pills share one row in four equal columns, Refresh sits on its own line at the right, and titles wrap instead of truncating. As in every settings section, the card chrome and titles dissolve below 500px.

Differences from the prototype

  • Confirmation kept. The prototype approves, rejects and undoes on one click and relies on the daemon's version check. Studio keeps its confirmation dialog for all three.
  • Approve is not gated on evidence. The prototype disables Approve when a proposal has no evidence or any source is unavailable, reading evidence from the list. The daemon's list reports every source as unavailable, so that gate would disable every approval; and the daemon approves legacy proposals with no evidence. Approve stays enabled exactly where the daemon says the partition can promote (promotionAvailable), and Details shows availability without gating. The daemon re-checks evidence when deciding.
  • Evidence loads on demand. Details reads the proposal by id instead of showing list evidence, for the same reason.
  • Deferred approvals for procedures only. The prototype offers Approve on every deferred proposal. The daemon materializes a deferred procedure as a learned-skill draft but refuses a deferred fact, so Studio offers Approve only on a deferred procedure. Reject stays pending-only, as in the prototype.
  • Learning mode and sensitivity are not shown. Neither the BFF nor SDK 0.4.0 reports the effective mode or sensitivity, so there is nothing true to display, even read-only. The card keeps Studio's "managed by this deployment" note (the prototype's ExternalManagedNote belongs to the settings alignment). Settings already shows its offline state above the section, so the prototype's OfflineNote isn't needed.
  • Unsupported reflection is explained. The prototype hides "Learn from a chat" when reflection is off; Studio shows the card with "Learning from a chat is not available right now.", as the issue asks.
  • Receipt keeps the disposition. The prototype always says "Done:". A receipt that did not complete (queued, duplicate, rate_limited) leads with that disposition instead ("Rate limited: 0 to review.").
  • 44px targets. Pills, Refresh, Approve, Reject, Undo, Details, View chat, Load more and the picker keep Studio's 44px minimum (the prototype uses 28 to 36px). On phones the pills use equal columns instead of overflowing.
  • Truncated titles. On wider screens the truncated title discloses the rest through Tooltip onlyWhenTruncated; on phones it wraps.
  • Tokens. Notices use Studio's warning tokens instead of the prototype's amber tint.
  • Page size. 50 per page, as in the prototype; the BFF default without a limit stays 100.

For design review (not a deviation): below 500px, SettingsCard hides its eyebrow title, exactly as the prototype's SettingsCard does (max-[499px]:hidden). On phones the Suggestions and Learn from a chat cards therefore have no visible heading, and the chat picker sits under the queue without a label. The picker keeps its accessible name ("Finished chat"). This needs a call from design on whether phones should show these headings.

No regression

Pinning tests

learning-settings-page.pinning.test.tsx (14 tests) was committed first, alone, as features/knowledge/learning-review.pinning.test.tsx. It passes on the old component, both on #2226 and on #2229's head, and it passes on the port. It drives the rendered page against a faked BFF and pins:

  • the default Pending filter and each filter's exact status token
  • Approve, Reject and Undo each opening a confirmation that names the proposal; Cancel sends nothing; Confirm sends the loaded version (expectedVersion) and reason: "", then refreshes the queue
  • Approve disabled, Reject enabled, when the deployment cannot promote
  • a proposal_conflict showing the conflict notice, refreshing the queue once, and never retrying; a refused decision showing its detail
  • the empty and unsupported queue states
  • reflection offering only completed chats, at most 20; sending the chosen session; showing the receipt and refreshing the queue; explaining a failure, no finished chats, and unsupported reflection

Copy lives in one copy object and the session picker in two helpers. The port changes only those: the copy values, and the picker helpers from selectOptions on a native select to opening the Select primitive. No assertion changed.

New tests

  • learning-queue.test.tsx (10): Load more sends the cursor and keeps the filter and the page size; duplicates across pages are dropped; a failed next page keeps the rows; Refresh restarts from page one; a deferred procedure offers Approve and not Reject, and a deferred fact offers neither; the inline blocked reason; Details loads once, on demand, shows the excerpt as text (an <img onerror> preview renders no element), the View chat and learned-skill links, and both availability states; a newer version found by Details is the one the next decision sends; a failed re-read; and both capability-off states.
  • learning-settings-page.test.ts: the receipt template, plus a non-completed disposition.
  • server/src/routes/knowledge.test.ts (+2): cursor and limit forwarding, limit bounds (0, 201 and "ten" are 400), the detail route; the detail route is added to the 501 and 503 tables.
  • server/src/mecatl/knowledge.test.ts (+4): the SDK mapping for a page (cursor, default page size 100, list items without evidence), the detail mapping (bigint eventSeq as a string), 404 for session_not_found and not_found, and a refused re-read keeping its code.
  • server/test/integration/mecated-mock.test.ts: against a real mecated --mock, a page returns nextCursor and a missing proposal answers 404 not_found. This caught the daemon's session_not_found code.
  • test-setup.test.ts (+2): toasts don't outlive a test. It fails without the reset, and so do two pinning tests.

Mutation check: with the Details version replacement removed, "takes a newer version from Details before the next decision" fails.

Modified tests

  • settings-workspace.test.tsx:
    • the Learning section's card titles become ["Learning", "Suggestions", "Learn from a chat"] (were ["Learning settings"])
    • the queue seed moves to the infinite query key
    • "Approve" and "Reject" are matched as exact button text. The pills now read "Approved" and "Rejected", so the old substring check would have passed even with no row.
  • settings-accessibility.test.tsx:
    • the runtime fixture adds learningProposals: true, because the page now follows that capability
    • the 44px check covers the four pills (with "Approved" for "Promoted") and Refresh
    • the picker is found as [role="combobox"][aria-label="Finished chat"] instead of a native select[aria-label="Completed session"]
    • the min-h-11 assertions are unchanged

Gate counts

Both columns were run through the shared gate lock. The base is #2229's head, 401911671, with this branch rebased on it.

Gate #2229 (401911671) This branch (435e6258f)
Biome 420 files 424 files, clean
Typecheck clean clean
Server 24 files / 189 tests 24 files / 195 tests
Web 132 files / 835 tests 134 files / 862 tests
Generated-artifact check clean clean
Browser (task studio:browser) 60 passed 60 passed
Server integration (mecated --mock) not run 8 passed

The base's browser run used this worktree's bin/mecated through STUDIO_MECATED_BIN, because the throwaway base checkout has no daemon binary.

Test evidence

  • task studio:check: passed. Biome, typecheck and the generated-artifact check are clean.
  • task studio:browser: 60 passed, on desktop and mobile Chromium.
  • pnpm --filter @mecatl-studio/server run test:integration with STUDIO_REQUIRE_MECATED=1: 8 passed.
  • task docs: passed, with matlatl --strict reporting 0 broken links.

Screenshots

Captured with a throwaway Playwright journey (Chromium, not committed) with offline BFF routes, a fixed clock (2026-09-25 12:30 UTC), Europe/Rome, and en-US. Each surface was shot at desktop 1280×800 and mobile 390×844, in light and dark; page shots grow the viewport to 1700px (2600px on mobile) so the whole Settings panel is visible. The conflict comes from a decision that answers 409 proposal_conflict, and the off states from runtime capabilities set to false. Before is #2229's head (401911671), after is this PR's head (435e6258f). Each tree was captured twice, and the two runs matched pixel for pixel. Every pair was pixel-compared; red boxes mark the regions that differ. Desktop composites are downscaled to 1600px wide. States that do not exist before (Details, Load more, Deferred, the open picker) are shown after only.

Settings > Learning

Pending suggestions

Intended change: the read-only card is titled "Learning" and loses the "You can review proposals below" lead-in; the queue becomes the prototype's "Suggestions" card, with Pending, Deferred, Approved and Rejected pills and a Refresh button. Rows take the prototype's denser layout: no key line, trigger tags or evidence count, a relative time beside the badges, proportional text for the value, a Details disclosure, and the blocked-approval reason inline (before, it was only a title). "Showing the first 100 proposals" becomes Load more. The reflection card becomes "Learn from a chat" with the Select primitive and "Find suggestions". On phones the pills share one row in four columns, and titles wrap instead of truncating.

Pending suggestions, desktop light

Dark and mobile

Desktop, dark:

Pending suggestions, desktop dark

Mobile, light:

Pending suggestions, mobile light

Mobile, dark:

Pending suggestions, mobile dark

Approve confirmation

Intended change: the dialog wording uses "suggestion" ("Approve Communication preference? Mecatl will remember this suggestion."); the dialog, its title and its buttons are otherwise unchanged.

Approve confirmation, desktop light

Dark and mobile

Desktop, dark:

Approve confirmation, desktop dark

Mobile, light:

Approve confirmation, mobile light

Mobile, dark:

Approve confirmation, mobile dark

Version conflict after Confirm

Intended change: the conflict notice uses the prototype's wording and Studio's warning tokens (was an info tint), and is announced with role="status". Before, the raw "proposal version changed" error also appeared under the notice; a conflict now shows only the notice. The queue is refreshed as before.

Version conflict after Confirm, desktop light

Dark and mobile

Desktop, dark:

Version conflict after Confirm, desktop dark

Mobile, light:

Version conflict after Confirm, mobile light

Mobile, dark:

Version conflict after Confirm, mobile dark

Reflection receipt

Intended change: the receipt moves from the queue's notice line into the "Learn from a chat" card and reads "Done: 2 to review · 1 clashed with existing memory." (was "Reflection completed: 2 staged · 0 promoted · 1 conflicted."); the chosen chat shows in the Select trigger. The earlier conflict notice stays until the next decision.

Reflection receipt, desktop light

Dark and mobile

Desktop, dark:

Reflection receipt, desktop dark

Mobile, light:

Reflection receipt, mobile light

Mobile, dark:

Reflection receipt, mobile dark

Nothing pending

Intended change: "Nothing waiting for review." in the prototype's dashed empty state, announced with role="status".

Nothing pending, desktop light

Dark and mobile

Desktop, dark:

Nothing pending, desktop dark

Mobile, light:

Nothing pending, mobile light

Mobile, dark:

Nothing pending, mobile dark

Reflection unsupported

Intended change: the reflection card keeps explaining why it is unavailable, now as the "Learn from a chat" card with "Learning from a chat is not available right now." (the prototype hides the card).

Reflection unsupported, desktop light

Dark and mobile

Desktop, dark:

Reflection unsupported, desktop dark

Mobile, light:

Reflection unsupported, mobile light

Mobile, dark:

Reflection unsupported, mobile dark

Learning off

Intended change: with neither capability the prototype's "Learning is off" tile replaces the two cards (before, the queue showed the BFF's "not enabled" reason and the reflection card its own).

Learning off, desktop light

Dark and mobile

Desktop, dark:

Learning off, desktop dark

Mobile, light:

Learning off, mobile light

Mobile, dark:

Learning off, mobile dark

New states (after only)

Details: where a suggestion came from

New: Details re-reads the proposal and lists each source with a View chat link, Available or Unavailable (with the daemon's reason), and the daemon's excerpt as plain text.

Details: where a suggestion came from, desktop light

Dark and mobile

Desktop, dark:

Details: where a suggestion came from, desktop dark

Mobile, light:

Details: where a suggestion came from, mobile light

Mobile, dark:

Details: where a suggestion came from, mobile dark

Load more

New: Load more appends the next page from the daemon's cursor; the button goes away on the last page.

Load more, desktop light

Dark and mobile

Desktop, dark:

Load more, desktop dark

Mobile, light:

Load more, mobile light

Mobile, dark:

Load more, mobile dark

Deferred filter

New: the Deferred pill lists deferred_unsupported suggestions; a deferred procedure offers Approve (it becomes a learned-skill draft), never Reject.

Deferred filter, desktop light

Dark and mobile

Desktop, dark:

Deferred filter, desktop dark

Mobile, light:

Deferred filter, mobile light

Mobile, dark:

Deferred filter, mobile dark

Finished-chat picker

New look: the Select primitive lists completed chats only (before, a native select, whose open list a page screenshot cannot show).

Finished-chat picker, desktop light

Dark and mobile

Desktop, dark:

Finished-chat picker, desktop dark

Mobile, light:

Finished-chat picker, mobile light

Mobile, dark:

Finished-chat picker, mobile dark

Review fixes

Fixes from the final regression and security review of the stack (stack #2227). Each one comes with a test that fails without the fix.

  • Details reused a stale read and downgraded the row (minor to major). Opening Details called fetchQuery with the app's 30-second staleTime. A row that remounted, for example after a filter round trip, reused the cached read: Details showed the old sources, said the suggestion had changed, and handed the list the older version. The next decision then sent a stale expectedVersion and was certain to draw proposal_conflict. A slow read that landed after the list moved on could also overwrite the newer row. (e08df122a)
    • Details now reads with staleTime: 0.
    • When the read lands, the row compares it with the version the list shows at that moment. If the list moved while the read was in flight, and the read is not newer by the daemon's updatedAt (versions are opaque tokens), the row reads once more instead of showing or applying the late read. If the list moves again, the row asks the user to reopen Details.
    • A row that unmounted ignores its late read.
    • Tests: the queue tests can now render with a finite staleTime and hold a detail read until the list has moved. Five new tests fail without the fix: remount with a 30-second staleTime, a slow read after Refresh, a late read after unmount, a re-read after an in-place refresh, and a second late read. A sixth test pins that a newer slow read still replaces the row.
    • No visible change in the normal path. The only new text is the rare "changed while its sources were loading" message.
Gate Before After
task studio:check passed (web 862, server 195 tests) passed (web 868, server 195 tests)
task studio:browser 60 passed 60 passed

Re-verification (2026-10-11)

  • Details could still adopt an older read already in flight (minor). staleTime: 0 skips the cache, but fetchQuery still hands back a read that is already running for the same proposal. A row remounted during its earlier read (a filter round trip, or Refresh with real latency) adopted that read on reopen; the list had not moved since the reopen, so the guard took it as fresh, downgraded the row, and Approve drew proposal_conflict. Details now cancels any read in flight for the proposal before it reads. (4f2724cb3) Test: learning-queue.test.tsx "starts a fresh read when a remounted row reopens Details during an older read" (fails without the fix: one detail call, the older version). No visible change.

Gates on the restacked head 4f2724cb3: studio:check passes (web 896, server 210 tests). At the stack top (#2256): studio:browser 118 passed, 30 skipped; the mecated --mock integration suite 8 passed. The browser suite takes 5.3 minutes on a CI runner.

Commit hashes cited earlier in this body predate the restacks; the current commits keep the same subjects. Hashes in Review fixes are updated.

Closes #1855

🤖 Generated with Claude Code

@peppescg
peppescg added this pull request to stack #2227 October 9, 2026 15:59
@peppescg peppescg self-assigned this Oct 9, 2026
@peppescg
peppescg force-pushed the feat/studio-learning-1855 branch from 435e625 to a17c911 Compare October 11, 2026 14:57
peppescg added a commit that referenced this pull request Oct 11, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 11, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 11, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 11, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@peppescg
peppescg force-pushed the feat/studio-learning-1855 branch from 723bb7c to cfeb4d5 Compare October 13, 2026 13:29
peppescg added a commit that referenced this pull request Oct 13, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 13, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg added a commit that referenced this pull request Oct 13, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@peppescg
peppescg force-pushed the feat/studio-learning-1855 branch from cfeb4d5 to 4f2724c Compare October 14, 2026 08:44
peppescg added a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kantord
kantord force-pushed the feat/studio-learning-1855 branch from 4f2724c to c12441a Compare October 14, 2026 08:59
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Base automatically changed from feat/studio-memory-proposal-2223 to main October 14, 2026 08:59
peppescg and others added 6 commits October 14, 2026 11:59
Pin Settings > Learning through the rendered page and the BFF requests it
makes, before the prototype port: confirmed decisions and undo that carry
the loaded version, conflict refresh without a retry, the filter's status
tokens, and reflection over completed chats with its unsupported and
failed states. Copy and the session picker sit in helpers so the port can
change them without touching an assertion.

Refs #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Move only, so the history stays readable: the prototype keeps Settings >
Learning in its own feature folder, and the port edits the files there in
the next commits. The component and its behaviour are unchanged.

Refs #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The review queue needs to advance past its first page and show where a
proposal came from. On the published SDK 0.4.0:

- GET /api/v1/learning-proposals takes the daemon's `cursor` and an
  optional `limit` (1 to 200) and returns `nextCursor`. Without a limit
  the page stays 100, as before.
- GET /api/v1/learning-proposals/{proposalId} re-reads one proposal with
  its `evidence`: each source chat, whether it still resolves to the
  recorded digest, and the daemon's bounded, redacted preview. Only this
  read carries evidence, because the daemon checks availability only when
  it re-reads a single proposal; list items keep `evidenceCount`.
- A missing proposal answers 404 not_found. The daemon reports it with its
  generic `session_not_found` code, so the BFF names it.

Decisions, undo, and reflection keep their routes, capability gates, and
version checks.

Refs #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
sonner keeps its toasts in a module-level store and replays the active ones
to every Toaster that mounts. Under `isolate: false`, a toast raised in one
test showed up in the next test's Toaster. The shared reset now dismisses
them, and two ordered tests pin it.

Refs #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Port the prototype's learning settings page, split as it is there:

- learning-mode-section.tsx: the read-only Learning card. Neither the BFF
  nor SDK 0.4.0 reports the effective mode or sensitivity, so it names
  who manages them instead of showing values.
- learning-settings-page.tsx: the Suggestions card with the prototype's
  Pending, Deferred, Approved, and Rejected pills, Refresh, and Load more
  over the daemon's cursor; the "Learn from a chat" card on the Select
  primitive; "Learning is off" when the agent offers neither capability.
- proposal-row.tsx: the prototype's row, and a Details disclosure that
  re-reads the proposal to show each source chat, whether it is still
  available, and the daemon's excerpt as plain text. A newer version
  found there replaces the row before the next decision.

Studio keeps its semantics: every decision and undo is confirmed and
sends the loaded version; a conflict refreshes the queue and is never
retried; reflection refreshes the queue and explains unsupported and
failed runs. Approve stays gated on the daemon's promotion capability,
not on evidence, and is offered for a deferred procedure but not a
deferred fact, as the daemon accepts. Filters, the session picker, and
Refresh keep 44px targets. On phones the four pills share one row in
equal columns, and a row's title wraps instead of truncating; wider
screens truncate it with an onlyWhenTruncated tooltip.

The pinned tests change only their copy constants and the session-picker
helpers. The settings tests seed the infinite query and match the row's
Approve and Reject exactly, because the pills now read Approved and
Rejected.

Closes #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Opening Details used fetchQuery with the app's 30-second staleTime, so a
row that remounted (after a filter round trip) reused the cached read.
Details showed the old sources, said the suggestion had changed, and
handed the list the older version, so the next decision sent a stale
expectedVersion and drew a guaranteed proposal_conflict. A slow read that
landed after the list moved on could also overwrite the newer row.

Details now reads with staleTime 0. When the read lands, the row compares
it with the version the list shows then: if the list moved while the read
was in flight and the read is not newer by the daemon's update time
(versions are opaque tokens), the row reads once more instead of showing
or applying it, and asks to reopen Details if the list moved again. A row
that unmounted ignores its late read.

The queue tests can now render with a finite staleTime and hold a detail
read until the list has moved. Five new tests fail without the fix; a
sixth pins that a newer slow read still replaces the row.

Refs #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ight

fetchQuery with staleTime 0 skips the cache, but it still hands back a
read that is already running for the same proposal. A row remounted
while its earlier read was in flight (a filter round trip, or Refresh
with real latency) adopted that older read on reopen. When it landed,
the list had not moved since the reopen, so the guard took it as fresh:
Details showed the older sources and the "changed" notice, the row was
downgraded, and Approve sent an older version, a certain
proposal_conflict.

Details now cancels any read in flight for the proposal before it reads.
The unmounted row's read rejects, and its catch already ignores it.

Refs #1855

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kantord
kantord force-pushed the feat/studio-learning-1855 branch from c12441a to a08a4a5 Compare October 14, 2026 08:59
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kantord
kantord merged commit 7cd9bb0 into main Oct 14, 2026
1 check passed
@kantord
kantord deleted the feat/studio-learning-1855 branch October 14, 2026 09:00
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kantord kantord mentioned this pull request Oct 14, 2026
41 tasks done
kantord pushed a commit that referenced this pull request Oct 14, 2026
…ests

#2232's review fix added two learning-queue tests that click the status
filter by role "button". This PR turns that filter into a shadcn toggle
group whose items are radios, as it already did for the other learning
tests. Selector-only change; the assertions are unchanged.

Refs #2208

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kantord

kantord commented Oct 14, 2026

Copy link
Copy Markdown
Member

Post-merge review follow-ups for this PR. No blockers or regressions found. Items worth tracking were filed here:

Other candidate findings were checked and dropped as not worth tracking.

Fully or partially written by an AI agent.

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.

Studio learning: proposal queue, evidence, and chat reflection

2 participants