Cowork's status strip: the drawn order, and figures that are there on arrival

The drawing reads it left to right —

  Agent: qwen2.5-coder · Định tuyến: Tắt · ↓292.8K ↑102.7K · $0.31 · 📁 folder

— and the app had it split down the middle: usage and folder on the left, Agent
and routing away on the right. They are one run on the left now, in that order.
Nén and Tự chạy stay on the right, where the control inventory marks them
"giữ nguyên tại chỗ".

The figures were also missing. _usage_total_lbl was written in exactly one
place, at the end of a turn, so a thread opened from History showed an empty
strip however much it had already spent — the numbers only appeared once you
sent another message. refresh_usage() reads the same per-conversation events
_show_usage does and now runs wherever the thread changes: opening one, starting
a new one, or deriving a title from the first turn. Opening a seeded thread now
reads ↓103.5k ↑44.6k ▤201.0k $0.1187 straight away.

check_cowork_screen asserts the strip is non-empty for a thread with recorded
usage and that the four parts run left to right in the drawn order.

23/23 checkers pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nam Pham Dinh Thanh
2026-08-18 16:30:45 +09:00
co-authored by Claude Opus 5
parent 60545654d6
commit 2f73aaa333
2 changed files with 59 additions and 5 deletions
+22
View File
@@ -87,6 +87,28 @@ def main() -> int:
fails.append(f"thieu nut {name} tren thanh cong cu")
print(f"nut tren thanh cong cu: {c.skills_btn.text()!r}, {c._new_btn.text()!r}")
# the status strip, read left to right, is
# Agent: … · Định tuyến: … · ↓in ↑out · $cost · 📁 folder
from PySide6.QtCore import QPoint as _P
bar = c._usage_total_lbl.parentWidget()
def _x(widget):
return widget.mapTo(bar, _P(0, 0)).x()
usage_text = c._usage_total_lbl.text()
print(f"usage tren dai: {usage_text!r}")
if not usage_text.strip():
fails.append("dai duoi khong hien token/chi phi cua thread da mo")
order = [("Agent", _x(c._agent_lbl)), ("Dinh tuyen", _x(c.routing_toggle)),
("usage", _x(c._usage_total_lbl))]
folder = getattr(c, "folder_lbl", None)
if folder is not None:
order.append(("thu muc", _x(folder)))
print("thu tu: " + " < ".join(f"{n}({x})" for n, x in order))
for (n1, x1), (n2, x2) in zip(order, order[1:]):
if x1 >= x2:
fails.append(f"dai duoi sai thu tu: {n1} khong dung truoc {n2}")
# the drawing gives Cowork two columns; History lives in the rail's RECENTS
# and its pane arrives folded to the strip the drawing keeps
w = win.workspace