fix(claw): state why a turn failed
android / debug (push) Successful in 2m39s
ci / docker (push) Canceled after 0s
android / release (push) Canceled after 1m54s
ci / checks (push) Canceled after 0s
ci / test (push) Canceled after 0s
ci / chart (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Canceled after 0s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Canceled after 0s
ci / publish-edge-chart (push) Canceled after 0s
android / debug (push) Successful in 2m39s
ci / docker (push) Canceled after 0s
android / release (push) Canceled after 1m54s
ci / checks (push) Canceled after 0s
ci / test (push) Canceled after 0s
ci / chart (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Canceled after 0s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Canceled after 0s
ci / publish-edge-chart (push) Canceled after 0s
A failed turn reached the client as the bare word "failed": turn_done
carried only the outcome, so the provider's own error — the status line
and the body that name what went wrong — was dropped on the floor. The
session inventory did keep it, as {"Failed": reason}, but the web client
printed that object, and a read-only snapshot (a coding job's key, a
forge thread) hardcoded the label and lost the text entirely.
TurnDone gains a reason, set only on failure and omitted when absent, so
handled and steered frames stay byte-identical and rows recorded before
the field still replay. The stashed transcript carries it too, which is
the path job keys take. The web client renders it under the outcome word
in mono and full-wrap, and the session-info modal reads the inventory's
{"Failed": reason} into a last-failure row instead of showing JSON.
cargo test -p rhema-claw and nuxt typecheck pass; a failed turn renders
its complete reason in the transcript.
This commit is contained in:
1 parent
ec52ae90b2
commit
597c2a98d2
10 files changed
+158
-40
No files matched your search
@@ -430,13 +430,29 @@ const userInitial = computed(() => (userLabel.value === 'you' ? 'Y' : 'D'))
|
||||
// The dispatch internals live behind the info modal, not in the header.
|
||||
const infoOpen = ref(false)
|
||||
|
||||
const infoRows = computed(() => [
|
||||
{ label: 'state', value: props.session?.state ?? 'unknown' },
|
||||
{ label: 'revision', value: props.session ? String(props.session.revision) : 'unknown' },
|
||||
{ label: 'inbox depth', value: props.session ? String(props.session.inbox_depth) : 'unknown' },
|
||||
{ label: 'last outcome', value: props.session?.last_outcome ?? 'unknown' },
|
||||
{ label: 'key', value: props.activeKey },
|
||||
])
|
||||
/** The inventory's `last_outcome`, read out of the dispatcher's own
|
||||
* serialization: a bare variant name, or `{"Failed": "reason"}`. The
|
||||
* failure's reason gets its own row so the modal does not show JSON. */
|
||||
const lastOutcome = computed(() => {
|
||||
const value = props.session?.last_outcome
|
||||
if (value === null || value === undefined) return { outcome: 'unknown', reason: null }
|
||||
if (typeof value === 'string') return { outcome: value.toLowerCase(), reason: null }
|
||||
return { outcome: 'failed', reason: value.Failed }
|
||||
})
|
||||
|
||||
const infoRows = computed(() => {
|
||||
const rows = [
|
||||
{ label: 'state', value: props.session?.state ?? 'unknown' },
|
||||
{ label: 'revision', value: props.session ? String(props.session.revision) : 'unknown' },
|
||||
{ label: 'inbox depth', value: props.session ? String(props.session.inbox_depth) : 'unknown' },
|
||||
{ label: 'last outcome', value: lastOutcome.value.outcome },
|
||||
]
|
||||
if (lastOutcome.value.reason !== null) {
|
||||
rows.push({ label: 'last failure', value: lastOutcome.value.reason })
|
||||
}
|
||||
rows.push({ label: 'key', value: props.activeKey })
|
||||
return rows
|
||||
})
|
||||
|
||||
const streamLabel = computed(() =>
|
||||
props.streamStatus === 'open' ? 'live' : props.streamStatus,
|
||||
@@ -544,7 +560,8 @@ function streamTone(status: StreamStatus): 'ok' | 'warn' | 'error' {
|
||||
aborted: item.turn.outcome === 'aborted',
|
||||
}"
|
||||
>
|
||||
{{ item.turn.outcome }}
|
||||
<span class="outcome-word">{{ item.turn.outcome }}</span>
|
||||
<p v-if="item.turn.reason" class="outcome-reason">{{ item.turn.reason }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -863,23 +880,46 @@ function streamTone(status: StreamStatus): 'ok' | 'warn' | 'error' {
|
||||
}
|
||||
|
||||
.outcome {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-1);
|
||||
margin-top: var(--sp-1);
|
||||
color: var(--muted);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
|
||||
.outcome.failed {
|
||||
.outcome-word {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.outcome.failed .outcome-word {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.outcome.steered {
|
||||
.outcome.steered .outcome-word {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.outcome.aborted {
|
||||
.outcome.aborted .outcome-word {
|
||||
color: var(--warn);
|
||||
}
|
||||
|
||||
/* The failure's own words, kept whole: a provider error names the
|
||||
* endpoint, the status, and the body, and wrapping is what makes all of
|
||||
* it readable. */
|
||||
.outcome-reason {
|
||||
margin: 0;
|
||||
padding: var(--sp-2) var(--sp-3);
|
||||
border-left: 2px solid var(--border-strong);
|
||||
border-radius: 0 var(--r-control) var(--r-control) 0;
|
||||
background: var(--surface-2);
|
||||
color: var(--text);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
line-height: var(--lh-body);
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.working {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in new issue
Block a user