fix(android): state why a turn failed
android / debug (push) Successful in 2m22s
android / release (push) Canceled after 1m4s
ci / test (push) Canceled after 0s
ci / chart (push) Canceled after 0s
ci / docker (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
ci / checks (push) Canceled after 5s
android / debug (push) Successful in 2m22s
android / release (push) Canceled after 1m4s
ci / test (push) Canceled after 0s
ci / chart (push) Canceled after 0s
ci / docker (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
ci / checks (push) Canceled after 5s
The phone's outcome tag printed the word and nothing else: a failed turn read as "failed" with the provider's error nowhere on screen, though the claw has carried the reason on turn_done since the web client started showing it. TurnDone decodes the field and the transcript item keeps it; the tag renders it under the word in mono, wrapped whole, on the quiet surface with the solid left rule the web block draws. assembleDebug passes; the app was exercised on an API 36 emulator against a claw serving a failed turn.
This commit is contained in:
1 parent
6f68ec6a22
commit
4710f783c7
3 files changed
+51
-13
No files matched your search
@@ -107,9 +107,14 @@ class ChatController(
|
||||
val granted: Boolean? = null,
|
||||
) : Item
|
||||
|
||||
// The turn's end tag ("Handled", "Failed", …) from turn_done; the
|
||||
// reply carries the text, this carries the outcome.
|
||||
data class Outcome(override val id: Long, val outcome: String) : Item
|
||||
// The turn's end tag ("handled", "failed", …) from turn_done; the
|
||||
// reply carries the text, this carries the outcome, and a failed
|
||||
// turn carries the reason it broke.
|
||||
data class Outcome(
|
||||
override val id: Long,
|
||||
val outcome: String,
|
||||
val reason: String? = null,
|
||||
) : Item
|
||||
|
||||
// One applied event with the seq the claw gave it: the cache window
|
||||
// needs the seqs to resume from, and a lagged drop leaves a gap the
|
||||
@@ -443,7 +448,9 @@ class ChatController(
|
||||
item.copy(streaming = false)
|
||||
}
|
||||
}
|
||||
event.outcome?.let { outcome -> list = list + Outcome(newId(), outcome) }
|
||||
event.outcome?.let { outcome ->
|
||||
list = list + Outcome(newId(), outcome, event.reason)
|
||||
}
|
||||
}
|
||||
is ClawEvent.Attachment ->
|
||||
list = list + Attachment(newId(), event.id, event.name, event.media, event.size, event.caption)
|
||||
|
||||
@@ -180,10 +180,15 @@ sealed interface ClawEvent {
|
||||
|
||||
// The reply is null when the turn ended without producing text —
|
||||
// a failed turn, mostly. Nullable on purpose: a dropped frame would
|
||||
// hide exactly the turns a viewer needs the outcome tag for.
|
||||
// hide exactly the turns a viewer needs the outcome tag for. A
|
||||
// failed turn also carries the handler's own words on what broke.
|
||||
@Serializable
|
||||
@SerialName("turn_done")
|
||||
data class TurnDone(val reply: String? = null, val outcome: String? = null) : ClawEvent
|
||||
data class TurnDone(
|
||||
val reply: String? = null,
|
||||
val outcome: String? = null,
|
||||
val reason: String? = null,
|
||||
) : ClawEvent
|
||||
|
||||
// A file the agent produced. The bytes are not on the stream; they
|
||||
// live at GET /v1/attachments/{id} behind the same bearer token.
|
||||
|
||||
@@ -590,7 +590,7 @@ private fun TurnGroupRow(
|
||||
is ChatController.Attachment -> AttachmentCard(item, container)
|
||||
is ChatController.Consent -> ConsentCard(item, controller)
|
||||
is ChatController.Reply -> ReplyBlock(item)
|
||||
is ChatController.Outcome -> OutcomeTag(item.outcome)
|
||||
is ChatController.Outcome -> OutcomeTag(item.outcome, item.reason)
|
||||
else -> Unit // thinking and tool calls never render
|
||||
}
|
||||
}
|
||||
@@ -641,7 +641,7 @@ private fun ReplyBlock(item: ChatController.Reply) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun OutcomeTag(outcome: String) {
|
||||
private fun OutcomeTag(outcome: String, reason: String?) {
|
||||
// A steered turn was cut short by the next message, not failed: the
|
||||
// reply that replaced it streams right below, so the word reads as
|
||||
// an accent, not an error — the same distinction the web UI draws.
|
||||
@@ -651,11 +651,37 @@ private fun OutcomeTag(outcome: String) {
|
||||
outcome.equals("Aborted", ignoreCase = true) -> TogetherWarn
|
||||
else -> TogetherMuted
|
||||
}
|
||||
Text(
|
||||
outcome,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = color,
|
||||
)
|
||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Text(
|
||||
outcome,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = color,
|
||||
)
|
||||
if (reason != null) FailureReason(reason)
|
||||
}
|
||||
}
|
||||
|
||||
// The failure's own words, kept whole and set in mono: a provider error
|
||||
// names the endpoint, the status, and the body, and wrapping is what
|
||||
// makes all of it readable — the same block the web surface draws.
|
||||
@Composable
|
||||
private fun FailureReason(reason: String) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
color = TogetherSurface2,
|
||||
) {
|
||||
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
|
||||
AccentBar(TogetherBorderStrong, width = 2.dp)
|
||||
Text(
|
||||
reason,
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
fontFamily = TogetherMono,
|
||||
color = TogetherText,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in new issue
Block a user