Skip to content

fix(dashboard): report refused Memory tab saves and clamp settings - #26508

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
crew/conductor/memtab-save-errors
Nov 1, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
crew/conductor/memtab-save-errors

Conversation

@RohanK6

@RohanK6 RohanK6 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The Memory tab says "Saved" or adds a lesson only when the server took the write, and its settings boxes show the value the server stores.

On Settings > Overview > Memory, a save the server refuses (403 owner gate, 400, 409) still shows "Saved", because the client returns the raw Response and nobody reads its status. An emptied idle-hours box sends 0, the server stores 0.5, and the box keeps showing 0. The boxes stop at 24 hours and 365 days, but the PUT has no upper bound, so "inf" writes Infinity into config.json. Adding a lesson that the server refuses ends in an unhandled rejection with no message. The rule text is not trimmed, and the rule box has no accessible name.

Why it matters

A user who is told "Saved" walks away thinking the setting or the document is stored. It is not, and nothing says so. A document card even clears the draft on a refused save, so the typed text is lost. A screen reader user hears an unnamed text box.

Not a goal

What changed (motivation → approach → change)

Symptom → cause → change:

Symptom Cause Change
Refused save shows "Saved" put() resolves on any status Settings and the three document saves in website/src/api/client/memory.ts parse with j, so a refusal rejects. The settings card shows an ErrorNotice
Box shows 0, server stores 0.5 Only the server clamps Both sides clamp to 0.5–24 hours and 7–365 days. The box shows the clamped value
Infinity in config, 500 on 10**400 No upper bound; OverflowError uncaught handlers/memory.py clamps to the same ceilings, a too-large integer included
Lesson add fails silently No catch A refused add shows an ErrorNotice and keeps the draft
Failed settings read looks loaded No catch on the read The card shows a load ErrorNotice, apart from the save one
" " passes, box unnamed No trim, no label The rule is trimmed, and the box is labelled "Rule"

Save sends only the boxes edited since load. A retention value set above 365 in config.json then survives a Save that changed only the idle hours. Save is disabled while its request runs, so "Saved" answers the request that carried the edit. An edit made meanwhile stays marked for the next Save, and a slow first load never overwrites a box already edited.

Three new i18n keys (settings_load_failed, settings_save_failed, lesson_request_failed) are in every catalog under website/src/i18n, and en-XA is regenerated. The memory-skills-hooks spec states the bounds.

Backwards compatibility

Compatible: nothing that works today is refused. An out-of-range PUT still answers 200, now with the value clamped to the bounds the UI already showed.

The diff narrows the range a PUT can store, so here are its readers:

Reader: src/kiro_crew/heartbeat.py:prune_history(keep_days=history_max_days) -- entry: release -- receives at most 365 from this route; a value already in config.json is untouched, because the tab sends only edited fields (clamps an emptied or out-of-range box test)
Reader: src/kiro_crew/history_consolidation.py:HistoryConsolidator.reconfigure -- entry: release -- reads a finite 0.5–24 hour window; inf no longer reaches it (test_put_clamps_to_the_tab_ceilings)
Reader: src/kiro_crew/cli_server.py:history_idle_secs -- entry: release -- the same finite value, read at boot

Writer sweep on origin/main @ 0fcfd43: the only writer of PUT /api/memory/settings is the Memory tab (website/src/pages/overview/MemoryTab.tsx).

Tests

  • test/test_handlers_memory_coverage.py::test_put_clamps_to_the_tab_ceilings: 99/9000, "inf" and 10**400 are stored as 24/365, and -(10**400) as 0.5/7.
  • website/src/test/OverviewMemoryTabCov80.test.tsx: a failed settings read and a refused save each show their own error, and a refused save does not show "Saved". An emptied box saves 0.5, an untouched hand-set 730 is not sent, and out-of-range values clamp. Save is disabled during a save, and edits made meanwhile or before a slow load are kept. The rule is trimmed and labelled. A refused lesson add keeps the draft.
  • website/src/test/ApiClient.coverage.methods.test.tsx: all four memory saves reject on a 403 and resolve on a 2xx.

Proof: not provable -- other: prove.py cannot revert the committed screenshot PNGs (binary patch without full index line)

On an earlier head (7f7dc2c0a32d) prove.py printed PROVEN for the above and inf cases. The huge-int cases go red by hand with the OverflowError clause removed. The frontend tests fail on main, which has no catch, no trim and no label.

Manual verification

I ran the built SPA in Chromium with PUT /api/memory/settings and POST /api/lessons stubbed to 403. I emptied the idle box and pressed Save: it showed 0.5 and the error, not "Saved". I added a lesson: the error showed and the draft stayed.

Screenshots / video

Refused settings save (dark), refused lesson add (light):

Refused settings save, dark

Refused lesson add, light

Other theme

Refused settings save, light

Refused lesson add, dark

Related Issues

Fixes #26504

Sibling sweep

Swept: git grep -nE "=> put(" -- website/src/api/client/memory.ts
Sibling: website/src/api/client/memory.ts:102 -- changed here
Sibling: website/src/api/client/memory.ts:104 -- changed here
Sibling: website/src/api/client/memory.ts:106 -- changed here
Sibling: website/src/api/client/memory.ts:181 -- not affected -- vectorSemanticWrite already parses with j

Pattern harvest

Rule candidate: semgrep
Pattern: an api client method returns a bare put(...)/post(...) Response with no .then(j), and a caller awaits it as success

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners October 31, 2026 01:26
@RohanK6
RohanK6 requested a review from cruisercohen October 31, 2026 01:26
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of afae643fc07def86ae67a4b1ad7048b6597d92e7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns: the backend and the UI now clamp to the same bounds, and every caller of the four saves handles the new rejection.

Notes

  • The three document saves are also used by CrewEditorNextDialog.tsx and MemberMemoryPanel.tsx, which ## Backwards compatibility doesn't list. Both pass them to MemoryDocCard, whose useMutation already shows save.error through MemoryScopeNotice. So a rejection is reported there too, and neither breaks.

[DESIGN-REVIEWED] afae643

Description read

[DESCRIPTION-READ] 670c04e2c37308ff9613e4763a4011641b09a3d445444609ced6043b97e829cc

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of afae643fc07def86ae67a4b1ad7048b6597d92e7 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. Every item comes from #26504's reproductions: a refused save shown as "Saved", Infinity written to config.json, and a box that keeps showing 0 after an empty save. The trim and the label ride along with no premise risk.

What this change ships

Inventory (10 items) — 7 justified

Intent: make the Memory tab say "Saved", or add a lesson, only when the server actually stored the write. FIX.

  1. A refused settings save shows an error instead of "Saved" — justified
  2. A refused preferences / projects / history save now rejects, so the draft is kept — justified
  3. The server caps idle hours at 24 and retention at 365; "inf" and huge integers are clamped instead of failing with a 500 — justified
  4. An emptied or out-of-range box shows and saves the clamped value — justified
  5. Save sends only the boxes edited since load, so a hand-set 730 survives — justified
  6. Save is disabled while its request runs — rides along
  7. A failed settings read shows its own load error — justified
  8. A refused lesson add shows an error and keeps the draft — justified
  9. The rule text is trimmed before it is sent — rides along
  10. The rule box gets the accessible name "Rule" — rides along

[FIRST-PRINCIPLES-REVIEWED] afae643

Description read

[DESCRIPTION-READ] 02117126d9435ff18daf1362d173e9ff6e6fb94923246769feb32fe83264bfd3

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of afae643fc07def86ae67a4b1ad7048b6597d92e7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing the new "Could not load the memory settings" notice. No screenshot shows it, yet in that state the boxes show defaults (3 / 90) that the user could take for their stored values.

Evidence gaps

  • Settings load-failure notice (settings_load_failed, the first new ErrorNotice in the Memory Settings card): no screenshot shows it. All four images show only the refused save and the refused lesson add. To close the gap, attach a shot with GET /api/memory/settings stubbed to fail, showing the notice beside the default-filled boxes. A second shot with that notice and the save notice both showing would cover the case where they stack.

Notes

  • The error text has no next step. The bold title runs straight into the server's text, so it renders as "Could not save the memory settings owner only" (shot-03), and the blind reader said it "reads like two pieces stuck together… doesn't say who the owner is or what I should do." Map a 403 to a full sentence that ends with what to do, e.g. "Only the crew owner can change memory settings. Ask them to change it." Do the same for lesson_request_failed.
  • When Save clamps a value, the box changes with no explanation (for example, an emptied box becomes 0.5). Add a short hint under the box, such as "0.5–24 hours", so the allowed range is visible before Save.

[UX-REVIEWED] afae643

Description read

[DESCRIPTION-READ] 988595d9a49225017c77decd409d4f57e0f6773be49ead3b4929e66e200c3594

That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed afae643fc07def86ae67a4b1ad7048b6597d92e7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] afae643

Verdict parsed from the review's SHA-scoped output markers for commit afae643fc07def86ae67a4b1ad7048b6597d92e7.

False positive or not applicable? A repository writer can comment:
/ai-review override fable afae643fc07def86ae67a4b1ad7048b6597d92e7 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of afae643fc07def86ae67a4b1ad7048b6597d92e7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] afae643

False positive or not applicable? A repository writer can comment:
/ai-review override gpt afae643fc07def86ae67a4b1ad7048b6597d92e7 false-positive: <reason, 20 to 500 characters>

@RohanK6

RohanK6 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: one settings save at a time; a separate never-cleared edited flag guards the first load

  • Clearing touched flags before completion permits false save acknowledgements span=d5cd51f321e3

fixed in a230362: Save is disabled while its request runs, so Saved only ever answers the request that carried the edit, and Saved is cleared when a new save starts.
The first-load guard now reads its own edited-since-mount flag that a Save never clears, so a load that lands after a save cannot overwrite the saved box.
Tests: Save is disabled during a save; a first load landing after a save leaves the box alone.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 31, 2026
@RohanK6
RohanK6 force-pushed the crew/conductor/memtab-save-errors branch from a230362 to afae643 Compare October 31, 2026 02:35
@RohanK6

RohanK6 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: a separate load-error state shown through its own ErrorNotice

  • Settings-load failures silently leave default values displayed span=d5cd51f321e3

fixed in afae643: a rejected settings read now sets its own load-error state, shown through an ErrorNotice titled Could not load the memory settings, apart from the save notice.
Test: a failed read shows the load notice with the server reply and no save notice.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 31, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Holding for a human reviewer under the sensitive-change rule; I found no defect.

The save fixes are sound. All four memory saves now reject on a refused write (memory.ts#L99-L108), and saveSettings shows "Saved" only after the request resolves and sends only edited fields (MemoryTab.tsx#L492-L525).

Why it needs a person: the PUT now clamps history_max_days to 365 (handlers/memory.py#L611-L621). That value is the keep_days the heartbeat passes to prune_history (heartbeat.py#L328-L333), which deletes history files older than it. A save of 730 that main stored now stores 365, so history between one and two years old would be pruned. Existing config values survive because the tab sends only edited fields, and the box already advertised max 365, so this looks intentional; a maintainer should confirm the retention ceiling. A human approval clears this hold.

AI findings judged non-blocking

  • UX (evidence gap): no screenshot of the load-failure notice. It is the shared ErrorNotice and the new test covers it. MemoryTab.tsx#L589-L595
  • UX (note): the error text has no next step. Copy polish; the refusal is now shown instead of "Saved".
  • UX (note): no range hint before a value is clamped. Copy polish; the box shows the stored value after Save.
  • Design (note): two other callers use the document saves. The lane itself confirms MemoryDocCard reports the rejection there.

Checks: all completed green on the reviewed head; PR Readiness passed.

Reviewed SHA: afae643

— crew-pr-reviewer (r138)

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved on behalf of the watch holder (bolichen). Lanes pass on afae643, checks green, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 68d32f2 into main Nov 1, 2026
95 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/conductor/memtab-save-errors branch November 1, 2026 06:41
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 1, 2026
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.

Memory tab: refused saves show "Saved", settings bounds disagree with the server, lesson add has no error path

3 participants