程序员阿江(Relakkes) 9d29d8e32c Keep desktop replies stable across turns and fix OAuth callback routing
The desktop chat store was dropping the previous assistant draft when a new user turn began because streaming text was cleared before it was flushed into message history. At the same time, the desktop OAuth flow was using an unregistered /api/haha-oauth/callback redirect URI, which caused provider authorization failures. This change flushes visible assistant drafts before starting a new turn, restores the OAuth redirect to the registered localhost callback, and adds a root callback handler while keeping the legacy API callback path compatible.

Constraint: The OAuth provider only accepts the registered localhost /callback redirect URI
Rejected: Keep the desktop-specific /api/haha-oauth/callback path | provider rejects unsupported redirect URIs
Rejected: Rely on message_complete to persist visible assistant text | next user turn can begin before that event arrives
Confidence: high
Scope-risk: moderate
Directive: Any UI-visible assistant draft must be flushed into messages before a new user turn resets streaming state
Tested: bun test src/server/__tests__/haha-oauth-service.test.ts src/server/__tests__/haha-oauth-api.test.ts src/server/__tests__/conversation-service.test.ts
Tested: cd desktop && bun run test src/stores/chatStore.test.ts
Tested: cd desktop && bun run lint
Not-tested: Manual end-to-end desktop OAuth login after reinstall
2026-04-18 17:01:53 +08:00
..
2026-04-03 00:30:56 +08:00
2026-03-31 01:55:58 -07:00
2026-04-03 00:30:56 +08:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-04-03 00:30:56 +08:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00
2026-03-31 01:55:58 -07:00