fix(sessions): preserve cross-session input ownership and history (#6613)
* fix(webui): reconcile cross-session history by message ID * fix(sessions): preserve target authority and input ownership Resolve cross-session follow-ups through the target route, carry stable input IDs through admission and recovery, and associate live and replayed answers with the inputs actually consumed. Keep ordinary input scope isolation and omit historical anomaly repair. Resolves NAN-430. * fix(sessions): complete input identity integration across boundaries Carry input identity explicitly in projected input events, keep runner annotations out of public history, and reuse the canonical WebUI session parser during recovery. Type validated recovery metadata and align existing channel and subagent regressions with explicit response ownership. All nine failed compatibility cases and adjacent recovery coverage pass in a focused 58-test run. * fix(sessions): unify input recording and block remote commands * fix(webui): keep input ownership checks page-bounded Look up referenced inputs through the existing identity index before invoking transcript backfill. Complete pages no longer scan the full prompt history, including answers whose inputs live on earlier pages. Cover cold-cache pagination and cross-turn ownership in existing regressions. Focused pagination, replay and follow-up recovery checks: 88 passed. * fix(webui): preserve response ownership during history replay * fix: resolve strict typing in response replay * fix: preserve continuation ownership during recovery * test: diagnose stuck gateway asyncio shutdown * test: retain gateway thread stack diagnostics * test(webui): stabilize native autoscroll browser setup
This commit is contained in:
1 parent
0ce335bf12
commit
394a78e82d
51 files changed
+1412
-334
No files matched your search
@@ -2,6 +2,7 @@ import type { UIMessage } from "@/lib/types";
|
||||
|
||||
export interface PromptAnchor {
|
||||
answerPreview: string;
|
||||
inputId?: string;
|
||||
id: string;
|
||||
turnId?: string;
|
||||
label: string;
|
||||
@@ -12,11 +13,20 @@ export interface PromptAnchor {
|
||||
}
|
||||
|
||||
export function userPromptAnchors(messages: UIMessage[]): PromptAnchor[] {
|
||||
const answers = new Map<string, string>();
|
||||
for (const message of messages) {
|
||||
if (message.role !== "assistant") continue;
|
||||
const preview = truncatePreview(compactPreview(message.content), 240);
|
||||
if (preview) for (const id of message.responseInputIds ?? []) {
|
||||
if (!answers.has(id)) answers.set(id, preview);
|
||||
}
|
||||
}
|
||||
let index = 0;
|
||||
return messages.flatMap((message, messageIndex) => {
|
||||
if (message.role !== "user") return [];
|
||||
const anchor: PromptAnchor = {
|
||||
answerPreview: nextAssistantPreview(messages, messageIndex),
|
||||
answerPreview: message.inputId ? answers.get(message.inputId) ?? "" : nextAssistantPreview(messages, messageIndex),
|
||||
inputId: message.inputId,
|
||||
id: message.id,
|
||||
...(message.turnId ? { turnId: message.turnId } : {}),
|
||||
label: promptLabel(message.content, index),
|
||||
|
||||
Reference in new issue
Block a user