Repository navigation
Description
What
Re-filed from the startup tracker, where it was created by mistake (was HYP-1672, deleted 2026-10-20).
In ExpenseBotAgent.run() (src/services/ai/agent.ts) the catch block deletes the streamed message for errors classifyAiError does not recognize, then rethrows; ask.ts then sends a generic failure as a new message. Keep the work log message for such errors too and render the failure text under it, which needs a small contract change between agent.ts and ask.ts (ask.ts owns that failure text).
Why (motivation)
Found in review of branch fix/agent-worklog: classified AI failures now keep the work log, unclassified errors still delete it
User impact
If a bug throws after add_expense or set_budget ran, the user does not see that their data was changed and may add the expense again
Cost of inaction
Acceptance criteria
- An unclassified error after a successful write tool leaves one message: the collapsed work log on top, the failure text under it — forced: PR fix(ai): keep the work log when a write tool ran before an unclassified error (Refs #182) #247 test src/services/ai/agent.errors.test.ts ('a write tool, then an unclassified non-AI error: the work log stays, failure under it'): add_expense succeeds → mockAiStreamRound rejects TypeError (unclassified, non-retryable) → asserts deleteMessage NOT called; last editMessageText contains both 'Записываю расход: 5 EUR, Еда' (work log on top) and 'Ошибка при обработке вопроса' (failure under it). bun test → 25 pass / 0 fail; full server suite 253 files / 6071 tests / 0 fail (PR fix(ai): keep the work log when a write tool ran before an unclassified error (Refs #182) #247 CI: test pass).
- No duplicate failure message is sent — forced: Same test asserts thrown instanceof AgentError (userMessage already rendered under the work log); ask.ts catch of AgentError persists the message and returns false WITHOUT sending a duplicate (src/bot/commands/ask.ts, existing behavior pinned by ask.history.test.ts, 13 pass). agent.errors.test.ts additionally asserts sendMessage-style duplicate path is not taken: the only user-visible edit is the single editMessageText containing log + failure.
Screenshots
(none)
Deploy
Deployed: no
Links
- PR: fix(ai): keep the work log when a write tool ran before an unclassified error (Refs #182) #247
- Merge commit: d60d5f1
Skipped gates
- cost-of-inaction: covered by impact
- links: HYP-1665 is a Linear-style id with no URL available here
- screenshots: backend logic, no UI to capture
Activity
fix(ai): keep the work log when a write tool ran before an unclassifi…
fix(ai): keep the work log when a write tool ran before an unclassifi…
fix(ai): keep the work log when a write tool ran before an unclassifi…
alex-mextner commentedon Nov 7, 2026
Shipped: merged via #247.
Merge commit: d60d5f1
This does NOT close the ticket — acceptance still needs proof. Run
task read #182for the outstanding criteria, thentask check/task done.