Skip to content

fix: show stopped goals as paused - #191746

Merged
roboclaw-bot merged 4 commits into
mainfrom
openclaw/loop-lifecycle-status-20261102
Nov 3, 2026
Merged

roboclaw-bot merged 4 commits into
mainfrom
openclaw/loop-lifecycle-status-20261102

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an unfinished Goal remaining marked active after Stop has cancelled its pursuit.

User Impact

Stop now pauses an active Goal with the visible note “Paused after Stop. Resume to continue.” The objective, accounting, and history are preserved; Resume remains explicit. Existing blocked/completed Goals and restart, supersession, and yielded continuation behavior are unchanged.

Why This Change Was Made

The existing authoritative lifecycle writer includes the Goal pause in the accepted cancellation patch. Its session, writer, revision, and newer-Goal guards remain in force. An admitted Goal records its own run claim before execution, so its pre-run Stop is accepted while an unrelated queued sibling cannot pause the executing Goal. There is no new scheduler, state, configuration, permission, or notice owner.

Regression coverage reuses the existing lifecycle persistence fixtures instead of maintaining a duplicate standalone suite. The CI repair changes tests only; the reviewed production pause logic is unchanged.

Evidence

  • Both original Stop regressions failed on base 43bb559f841430368a4ae2bc1a213fc285d29ccc. Their coverage is now consolidated into the existing lifecycle suite, preserving Stop note/accounting, no implicit resume, continuation exclusions, and stale session/writer/revision/newer-Goal guards.
  • 46 consolidated lifecycle cases passed, including paired own-admitted versus unrelated-sibling cancellation before execution. The native first-session/Goal/input admission case also passed and verifies the atomic pre-run lifecycleRunId claim. The selected two-file run passed 47 cases in 48.77 seconds local wall time; the lifecycle file took 35.26 seconds including cold worker preparation.
  • The previously passing 54 real Goal-control cases, including both sessions.abort/Resume flows, are reused because their production and public-flow test source is unchanged. Model execution is mocked; admission, cancellation, persistence, queue settlement, and Resume use production paths.
  • The affected lifecycle-root TypeScript owner, scoped lint, formatting, staged diff checks, and local test-line ratchet pass. The final fixture uses satisfies SessionEntry to preserve its real required Goal property rather than widening it to optional.
  • Prior head 4617869c2c6b97ccaa0a3e49a503c31745e6e17e failed checks-fast-baseline-ratchets (run 41597877854, job 125789945465): 6,421,942 test lines versus a 6,421,820 ceiling, with PR delta +116. That comparison base was already six lines over. The repair removes 117 test lines from that head and makes the overall PR test delta -1 against its original branch base, without changing the scalar, allocation records, or checker policy. Repaired-head CI remains to be verified; the old failure is not relabeled green.
  • Fresh local Codex autoreview (gpt-6.1-sol, P0–P2) reviewed the complete final test-only delta against the published head above, including the fixture typing correction, and completed scoped-clean with no actionable findings or meaningful coverage loss. The original production change also has a completed clean review. Reviewers did not execute checks; results above are lead-owned.
  • Automatic CI timing for the repaired head is pending. No CI rerun or workflow dispatch was requested.

Worked on by

roboclaw-bot and others added 2 commits November 3, 2026 07:38
Publish the Goal pause and Stop reason with the accepted terminal lifecycle patch. Preserve restart, supersession, yielded waiting, queued sibling ownership, and newer Goal fences.

Co-authored-by: vincentkoc <[email protected]>
Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: 7f235a60-ab56-4aa2-951f-42c1a8c08ec4
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Nov 3, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 3, 2026 07:40
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR pauses active Goals when their run is stopped and records a note directing the user to Resume.

Example: Stop the active Goal “Finish the work” after it has used 12 tokens.

  • Before: The run stops, but the Goal remains active.
  • After: The Goal becomes paused with “Paused after Stop. Resume to continue.” while retaining its objective and accounting.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused production repair supported by owner and handler regressions, with a concrete test-budget failure and one ineffective exclusion fixture.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its supplied validation exercises the lifecycle reducer and production Stop/Resume handlers with mocked model execution.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After Stop cancels Goal pursuit, the Goal still appears active.
Reason: The maintainer-authored direction makes displayed Goal state match stopped pursuit while retaining explicit Resume and existing state ownership.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR fixes a current Goal-state inconsistency, but its added tests need a test-line budget repair before merge.

Priority: P2
Reviewed head: 4617869c2c6b97ccaa0a3e49a503c31745e6e17e

Before merge

  • Restore the test-line ratchet for the added regressions (P2) - This new suite and the expanded Gateway assertion add 116 net counted test lines without an allocation. The exact-head checks-fast-baseline-ratchets annotations report test-lines failure, and the checker rejects over-ceiling changes with positive test growth. Add a justified change-specific allocation under config/test-lines-allocations or consolidate the added tests to fit the budget, preserving the real cancellation regressions and shared scalar.

Findings

  • [P2] Restore the test-line ratchet for the added regressions — src/config/sessions/session-run-lifecycle-projection.test.ts:1-5

Tests

  • Low-value test src/config/sessions/session-run-lifecycle-projection.test.ts: Remove or replace the purported yielded-waiting row: livenessState 'waiting' without stopReason 'end_turn' never satisfies the production predicate, which requires livenessState 'paused'; its assertion therefore exercises ordinary completion instead.
  • Missing end-to-end proof: No shipped Gateway/UI Stop-to-paused-to-Resume capture is supplied; the reported handler regressions use mocked model execution.
Agent review details

How this fits together

The session lifecycle reducer converts accepted run events into persisted session patches; Gateway publication then exposes the resulting Goal state to clients.

flowchart LR
  A[Operator Stop] --> B[Session cancellation owner]
  B --> C[Terminal lifecycle event]
  C --> D[Session lifecycle reducer]
  D --> E[Session state writer]
  E --> F[Gateway session publication]
  F --> G[Goal controls]
Loading

Technical review

Best possible solution:

Keep the pause in the existing lifecycle writer and repair the focused regression suite’s budget and yielded-waiting fixture.

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

Current-main source directly shows that a killed run bypasses the Goal-pause transition; the PR also reports the intended base failures, but this read-only review ran no target code.

Is this the best way to solve the issue?

The production patch is the smallest complete fix: an accepted Stop must pause the active Goal in the same authoritative lifecycle write, preserving existing stale-event guards and continuation exclusions.

Full review comments:

  • [P2] Restore the test-line ratchet for the added regressions — src/config/sessions/session-run-lifecycle-projection.test.ts:1-5
    This new suite and the expanded Gateway assertion add 116 net counted test lines without an allocation. The exact-head checks-fast-baseline-ratchets annotations report test-lines failure, and the checker rejects over-ceiling changes with positive test growth. Add a justified change-specific allocation under config/test-lines-allocations or consolidate the added tests to fit the budget, preserving the real cancellation regressions and shared scalar.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 31ad71a8addc.

Provenance checked

  • Atomic terminal Goal pause keeps the original intent (fix(goals): pause terminal failures and clarify goal states #155694: Pause terminally failed Goals with authoritative run state while preserving accounting and newer Goal intent.)
  • Shared lifecycle reducer ownership keeps the original intent (5b1d81e: Fuse lifecycle bookkeeping into the existing worker operation and merge Goal changes from the current stored entry.)
  • Stopped Goal remains active before explicit Resume changes intended behavior with a stated reason (fix: goals fail to resume after stopping a run #185273: Permit Resume after settled cancellation without resetting history; its regression retained an active stopped Goal.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/config/sessions/session-run-lifecycle-projection.test.ts --maxWorkers=1
  • node scripts/run-vitest.mjs src/gateway/server.chat-goal.test.ts src/gateway/session-lifecycle-state.test.ts --maxWorkers=1
  • pnpm check:test-lines-ratchet --base 43bb559
  • git diff --check

What I checked:

PR surface

Source +7, Tests +116, Docs +1. Total +124 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 12 5 +7
Tests 2 117 1 +116
Docs 1 4 3 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 133 9 +124

Labels

Label changes:

  • add P2: Stopped Goals retain misleading active state, but their objective and history remain available and explicit Resume already works.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Stopped Goals retain misleading active state, but their objective and history remain available and explicit Resume already works.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 2:57 AM ET / 07:57 UTC.

roboclaw-bot and others added 2 commits November 3, 2026 08:05
Reuse the existing lifecycle fixtures for Stop, continuation exclusions, stale ownership, and queued inputs. Cover the admitted Goal's own pre-execution cancellation separately from an unrelated queued sibling. Preserve the production pause logic and existing test-budget ceiling.

Co-authored-by: vincentkoc <[email protected]>
Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: 3d75a22b-e3fa-494c-9bf5-00be2a6086c8
@roboclaw-bot
roboclaw-bot merged commit 85f9736 into main Nov 3, 2026
128 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/loop-lifecycle-status-20261102 branch November 3, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant