fix(feedback): Phase 2 follow-up — Codex review MAJORs + NIT
Independent review surfaced three majors and one nit. All actioned. MAJOR 1 — profile scoping: `decompose_and_store` and `extract_tasks_from_transcript_cmd` now accept an optional `profile_id` (wired from `profilesStore.activeProfileId` in MicroSteps.svelte and DictationPage.svelte), and thread it into the feedback-retrieval query so per-profile decomposition styles do not leak into each other. `record_feedback` gets the same treatment. MAJOR 2 — prompt-budget regression on long inputs: New `trim_to_budget` helper + `FEW_SHOT_CHAR_BUDGET = 2000` char cap in `src-tauri/src/commands/tasks.rs`. Retrieval still pulls up to 5 rows but they are char-counted and truncated against the budget before being sent to the LLM. Char cost matches the `Input: ...\n Good output: ...` render path so the budget maps cleanly to ~570 Qwen3 tokens, well inside the 8192-context reserve after the 512- or 768-token response allocation. Oldest-first drop order (iteration stops at cost exceeded) preserves the most recent correction which is the one carrying the user's live preference. MAJOR 3 — inline edit stale-rollback race: `saveEdit` in MicroSteps.svelte now stamps a monotonic per-step `saveToken`. Each edit bumps the token; on failure the rollback only fires if `saveToken[step.id] === myToken`, so a slow-failing first save can no longer overwrite a faster successful second save. NIT — retrieval ordering stability: `list_feedback_examples` ORDER BY now `created_at DESC, id DESC`. SQLite timestamp precision is one second; without the secondary key, bursty feedback within the same second would select non-deterministically. Also: malformed `context_json` now warns via eprintln! rather than disappearing silently — Codex minor. All green: cargo build + 249 tests + clippy -D warnings + fmt + svelte-check (0/0) + npm run build.
This commit is contained in:
@@ -1007,7 +1007,7 @@ pub async fn list_feedback_examples(
|
||||
WHERE target_type = ?
|
||||
AND profile_id = ?
|
||||
AND rating >= ?
|
||||
ORDER BY created_at DESC
|
||||
ORDER BY created_at DESC, id DESC
|
||||
LIMIT ?",
|
||||
)
|
||||
.bind(target_type.as_str())
|
||||
|
||||
Reference in New Issue
Block a user