fix(coding): restore sending after queued messages settle
This commit is contained in:
@@ -199,7 +199,6 @@ export function CodingChatPanel({
|
||||
await abortCodingConversation(conversationId);
|
||||
await loadConversationSnapshot(conversationId, 'silent');
|
||||
}, [loadConversationSnapshot]);
|
||||
const promptMode = draftKey ? modesByDraftKey[draftKey] ?? 'prompt' : 'prompt';
|
||||
const provisionalDraft = provisionalDraftKey ? provisionalDrafts[provisionalDraftKey] ?? '' : '';
|
||||
const submissionError = draftKey ? submissionErrors[draftKey] ?? null : null;
|
||||
const localAttachments = useMemo(() => (
|
||||
@@ -225,6 +224,9 @@ export function CodingChatPanel({
|
||||
: null
|
||||
), [targetConversationId]);
|
||||
const snapshot = useCodingConversationStore(selectSnapshot);
|
||||
const runStatus = snapshot?.run.status ?? 'idle';
|
||||
const running = ['queued', 'running', 'retrying', 'compacting', 'aborting'].includes(runStatus);
|
||||
const promptMode = running && draftKey ? modesByDraftKey[draftKey] ?? 'prompt' : 'prompt';
|
||||
const entryLoadState = useCodingConversationStore((state) => (
|
||||
targetConversationId
|
||||
? state.entriesByConversationId[targetConversationId]?.loadState ?? 'empty'
|
||||
@@ -576,7 +578,6 @@ export function CodingChatPanel({
|
||||
submitPrompt,
|
||||
]);
|
||||
|
||||
const runStatus = snapshot?.run.status ?? 'idle';
|
||||
const workerStatus = snapshot?.worker.status ?? 'stopped';
|
||||
const runtimeError = snapshot?.run.error ?? snapshot?.worker.error ?? null;
|
||||
const preparationError = entryError ?? runtimeError?.message ?? null;
|
||||
@@ -596,7 +597,6 @@ export function CodingChatPanel({
|
||||
|| workerStatus === 'recovering'
|
||||
|| runStatus === 'preparing';
|
||||
const recovering = entryLoadState === 'recovering';
|
||||
const running = ['queued', 'running', 'retrying', 'compacting', 'aborting'].includes(runStatus);
|
||||
const modeMatchesRunState = running ? promptMode !== 'prompt' : promptMode === 'prompt';
|
||||
const pendingInteractionCount = snapshot?.pendingInteractions.filter((interaction) => (
|
||||
interaction.status === 'pending'
|
||||
|
||||
@@ -832,13 +832,18 @@ export function createCodingConversationStore(
|
||||
const requests = state.requestsByConversationId[input.conversationId] ?? {};
|
||||
const current = requests[clientRequestId];
|
||||
if (!current) return state;
|
||||
const nextRequests = { ...requests };
|
||||
// Queued messages are projected by the authoritative queue; only a
|
||||
// prompt has an optimistic node awaiting clientRequestId reconciliation.
|
||||
if (current.mode === 'prompt') {
|
||||
nextRequests[clientRequestId] = { ...current, status: 'accepted' };
|
||||
} else {
|
||||
delete nextRequests[clientRequestId];
|
||||
}
|
||||
return {
|
||||
requestsByConversationId: {
|
||||
...state.requestsByConversationId,
|
||||
[input.conversationId]: {
|
||||
...requests,
|
||||
[clientRequestId]: { ...current, status: 'accepted' },
|
||||
},
|
||||
[input.conversationId]: nextRequests,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user