Skip to content

fix(ui): show frozen elapsed time for stopped goals - #130501

Merged
steipete merged 1 commit into
mainfrom
codex/qa-goal-elapsed-20260826
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-goal-elapsed-20260826

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

Maintainer-editable branch in the upstream repository. AI-assisted with Codex.

What Problem This Solves

Fixes an issue where users opening a paused, blocked, limited, or completed goal would see no elapsed time in the collapsed card above the chat composer. Stopping an already-visible active goal could instead leave its previous live duration in place.

Closes #130500.

Why This Change Was Made

Initialize the elapsed label for every goal status in the existing rendering owner, then start the interval only for active goals. This keeps one owner for the DOM text and preserves timer retirement on status changes, goal removal, and host disconnection. Goal state, timestamps, storage, commands, and timing semantics are unchanged.

The existing formatter already freezes stopped goals at their corresponding status timestamp. Reintroducing a separate template text value would mix Lit child-part ownership with direct timer text updates, so this repair stays in the existing ref lifecycle.

User Impact

Stopped goals immediately show their correct frozen duration, including after reload or an active-to-stopped transition. Active goals continue ticking, and expanding or collapsing details preserves the same duration.

Evidence

  • Before repair: six rendered failures across all five stopped states and an active-to-paused transition; three active/cleanup controls passed. The actual Chromium flow also failed with an empty paused-goal label.
  • After repair: 85 focused tests across four files and one real Chromium E2E passed. Independent verification repeated those checks and observed 22 additional fixture-driven transitions, including timestamp fallbacks, resume, goal replacement/removal, and navigation.
  • Full changed-file checks passed, including formatting, type checking, typed lint, UI styles, and all three unused-export scans. Authenticated Codex review reported no actionable findings.
  • A fresh source-blind Chromium validator passed all five written behavior clauses with no findings: stopped-state timestamps and fallbacks, active ticking and pause, resume and replacement, details/reload, and removal/reintroduction/navigation. Fixture IDs, objectives, and durations were varied to rule out static labels. The validator used only normal UI interactions and the declared synthetic fixture API.
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs ui/src/pages/chat/chat-composer-goal.test.ts ui/src/lib/session-goal.test.ts ui/src/pages/chat/chat-composer-actions.test.ts ui/src/pages/chat/chat-composer.test.ts
OPENCLAW_CAPTURE_UI_PROOF=1 OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-goal-elapsed.e2e.test.ts
node scripts/check-changed.mjs -- ui/src/pages/chat/components/chat-composer-goal.ts ui/src/pages/chat/chat-composer-goal.test.ts ui/src/e2e/chat-goal-elapsed.e2e.test.ts

Before: the paused card has no elapsed duration.

Paused goal before the fix: duration missing

After: the same paused card immediately shows its recorded one-minute duration.

Paused goal after the fix: one-minute duration visible

Production LOC: +5/-2 (net +3), separating initialization for all statuses from active-only interval ownership. Tests: +183/-0. No new production helper, timer owner, configuration, or persisted state.

Provenance: source regression introduced by #124301 (64853b1), authored by @vyctorbrzezowski and merged by @steipete on August 25, 2026. Stable-release reachability was not established.

Proof boundary: the browser runs the real Control UI with synthetic session data and a declared mock Gateway. No operator Gateway, actual agent goal, or external model was modified or invoked.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 23:56
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:54 PM ET / 23:54 UTC.

ClawSweeper review

What this changes

The PR initializes the Control UI goal-card elapsed label for every status, while retaining the one-second interval only for active goals.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. Current main still returns before initializing a stopped goal’s elapsed span; this PR repairs that renderer boundary with focused unit and browser coverage. The draft and maintainer label require normal maintainer handling rather than automated cleanup.

Priority: P2
Reviewed head: 03b4f29bf8d4266da2b2845c1e5565b1678d9e0e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with complementary rendering and browser regression coverage; no blocking defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to the maintainer-authored PR gate; the checked-in browser E2E nevertheless directly exercises the paused card, detail toggle, and reload path described in the PR.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to the maintainer-authored PR gate; the checked-in browser E2E nevertheless directly exercises the paused card, detail toggle, and reload path described in the PR.
Evidence reviewed 7 items Current-main defect: Current main returns from the ref callback for every non-active status before assigning text content, leaving the collapsed stopped-goal elapsed span empty.
Canonical duration contract: The existing formatter already freezes each stopped status at its authoritative status timestamp, including the updated-at fallback.
Owner-boundary repair: The branch writes the canonical formatted value after element binding and before the active-only interval decision, so stopped cards initialize without acquiring a timer.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-goal-elapsed.e2e.test.ts

Result: PASS (completed)

RUN  v4.1.11 /tmp/clawsweeper-live-proof-130501-Yolrw7/target

 ✓  ui-e2e  ui/src/e2e/chat-goal-elapsed.e2e.test.ts (1 test) 5580ms
     ✓ shows a paused goal's frozen duration before and after opening details and reloading  4905ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  23:55:35
   Duration  17.51s (transform 138ms, setup 190ms, import 362ms, tests 5.58s, environment 0ms)
RUN  v4.1.11 /tmp/clawsweeper-live-proof-130501-Yolrw7/target

 ✓  ui-e2e  ui/src/e2e/chat-goal-elapsed.e2e.test.ts (1 test) 3024ms
     ✓ shows a paused goal's frozen duration before and after opening details and reloading  2785ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  23:55:54
   Duration  14.49s (transform 39ms, setup 64ms, import 356ms, tests 3.02s, environment 0ms)

Assertions:

  • PASS expect_output: shows a paused goal's frozen duration before and after opening details and reloading

How this fits together

The Control UI receives session goal state from the Gateway and renders a compact goal card above the chat composer. That card uses stored goal timestamps for stopped durations and a local interval only while a goal is active.

flowchart LR
  A[Gateway session goal] --> B[Control UI session model]
  B --> C[Composer goal card]
  C --> D{Goal status}
  D -->|Stopped| E[Frozen elapsed label]
  D -->|Active| F[Live interval]
  E --> G[Visible chat composer]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Production code grows by three net lines for a bug fix; the extra split is justified because stopped-state text must initialize before the active-only timer ownership check.
Agent review details

Security

None.

PR surface

Source +3, Tests +183. Total +186 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 2 +3
Tests 2 183 0 +183
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 188 2 +186

Review metrics

Metric Value Why it matters
Production versus test LOC production +5/-2 (net +3); tests +183/-0 The small production increase separates mandatory stopped-label initialization from active-only timer lifecycle coverage.

Stored data model

Persistent data-model change detected: database schema: ui/src/e2e/chat-goal-elapsed.e2e.test.ts, database schema: ui/src/pages/chat/chat-composer-goal.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #130500
Summary: This PR explicitly targets the same stopped-goal elapsed-time behavior described by the linked issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the elapsed text and interval in this renderer, initialize all statuses through the canonical duration formatter, and retain active-only timer ownership.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the elapsed text and interval in this renderer, initialize all statuses through the canonical duration formatter, and retain active-only timer ownership.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main’s non-active early return leaves the elapsed span unset, and the new focused tests exercise that exact rendered boundary. This review did not execute the browser harness.

Is this the best way to solve the issue?

Yes. The existing duration helper already defines stopped-time semantics, and initializing the same DOM owner before the active-only interval avoids introducing a competing template path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a4c01c1a77ac.

Labels

Label changes:

  • add P2: This is a bounded Control UI display regression; goal state, execution, commands, and persistence are unaffected.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: This is a bounded Control UI display regression; goal state, execution, commands, and persistence are unaffected.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

Likely related people:

  • vyctorbrzezowski: Authored the merged composer refactor associated with the active-only elapsed initialization path. (role: feature author; confidence: medium; commits: 64853b1a9d50; files: ui/src/pages/chat/components/chat-composer-goal.ts)
  • steipete: Merged the related composer refactor and is connected to the current Control UI repair path. (role: recent area contributor and merger; confidence: medium; commits: 64853b1a9d50; files: ui/src/pages/chat/components/chat-composer-goal.ts, ui/src/pages/chat/components/chat-composer-view.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer review complete: the extra three production lines separate all-status label initialization from active-only timer ownership in the existing renderer; no second text owner or timer path is added.

The automated stored-data warning is a false positive. Both flagged schemaVersion: 1 values are synthetic fixtures using the existing SessionGoal shape. This PR changes no database schema, migration, persisted data, or protocol, so no migration proof is applicable.

The reviewed commit is unchanged, and exact-head CI is green, including the required merge gate. The PR body retains the independent rendered/browser proof and all five source-blind checks.

@steipete
steipete merged commit 07eb320 into main Aug 27, 2026
160 checks passed
@steipete
steipete deleted the codex/qa-goal-elapsed-20260826 branch August 27, 2026 00:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Stopped goals show blank or stale elapsed time

1 participant