Skip to content

feat: update change and choice cards, support choice turns and local edit decisions - #199

Merged
SummonShenron merged 1 commit into
mainfrom
sonic/working-changes-2026-11-29
Nov 29, 2026
Merged

SummonShenron merged 1 commit into
mainfrom
sonic/working-changes-2026-11-29

Conversation

@SummonShenron

Copy link
Copy Markdown
Owner

Covers 24 modified files across the backend, tests and Chat page, plus one new test file for support card turns. Message is written from the file names and git status, not a line-by-line read.

Opened with Sonic Assistant.

…edit decisions

Covers 24 modified files across the backend, tests and Chat page, plus one new test file for support card turns. Message is written from the file names and git status, not a line-by-line read.

Co-authored-by: Sonic Assistant <sonic-assistant@users.noreply.github.com>
@vercel

vercel Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
saapp Ready Ready Preview Nov 29, 2026 6:54pm UTC

@SummonShenron

Copy link
Copy Markdown
Owner Author

Sonic Assistant PR Overview

Summary

This PR updates the support card flow to display the card before the AI reply is written, allowing the turn to wait for a user's selection. This ensures the AI's response aligns with the user's chosen mode (listen, advice, or fix) rather than guessing based on the message content.

What changed

  • Support Card Logic:
    • backend/utils/support_choice.py: Updated to show the card before writing the reply, introducing a WAIT_SECONDS timeout (default 90s) and new states (PICKED, NO_TAP, MOVED_ON, STOPPED).
    • app.py: Modified the secure_chat flow to yield the support card and wait for a selection before proceeding with the AI reply.
  • Steering and Turn Management:
    • backend/services/steering.py: Added typed_mark and typed_since to track messages sent during a wait, and updated wait_event to handle "typed" outcomes when a user sends a message instead of tapping.
    • backend/services/choice_cards.py: Updated register and wait_for to support non-blocking waits and handle "typed" message interruptions.
  • Frontend Components:
    • local/src/components/ChoiceCard.tsx and local/src/components/choiceCardLogic.ts: Added fallback support to allow cards to send selections as messages when no turn is waiting.
    • local/src/pages/Chat.tsx: Updated sendFromCard to handle message resending and steer logic when a card is interacted with during an active turn.

Where to look

  • backend/utils/support_choice.py: The module docstring and should_offer function explain the new "card first" logic.
  • app.py: The support_offer block shows how the turn yields the card and waits for the user's input.
  • backend/services/steering.py: The wait_event function is critical for understanding how the system distinguishes between a tap, a stop, and a new message.

Risks and gaps

  • Environment Variable: A new SUPPORT_CARD_WAIT_SECONDS environment variable is introduced; if unset, it defaults to 90 seconds.
  • Contract Change: The wait_event signature in steering.py has changed, requiring a mark parameter to track message arrival, which must be correctly passed from the calling turn.

Not fully covered by this overview (diff cut short: backend/utils/support_choice.py, backend/services/steering.py, app.py, local/src/pages/Chat.tsx, backend/services/change_cards.py; not read: backend/services/local_edit_decisions.py, backend/utils/runner_jobs.py, backend/services/agent_workflow.py, backend/utils/self_counters.py, backend/components/sonic_changelog.py, backend/tests/test_support_card_turn.py, backend/tests/test_waits_end_on_stop.py, backend/tests/test_support_choice.py, ...).

Updated for commit 8c3b392

@SummonShenron
SummonShenron merged commit e016c39 into main Nov 29, 2026
2 of 4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 8c3b3921 Deployed Nov 29, 2026 by vercel[bot]
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.

2 participants