Skip to content

feat(agents): task system parity — cancelled status, merge mode, activeForm, plan hydration [Phase 3.A]#67514

Closed
100yenadmin wants to merge 8 commits into
openclaw:mainfrom
electricsheephq:final-sprint/gpt5-task-system-parity
Closed

feat(agents): task system parity — cancelled status, merge mode, activeForm, plan hydration [Phase 3.A]#67514
100yenadmin wants to merge 8 commits into
openclaw:mainfrom
electricsheephq:final-sprint/gpt5-task-system-parity

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Ports three Hermes todo-tool features to OpenClaw's `update_plan` tool — `cancelled` status for failed steps, `merge` mode for token-efficient partial updates, and `activeForm` for live progress text — plus a post-compaction plan hydration helper.

Tracking

What this PR does

1. `cancelled` status

Fourth plan step status: `pending → in_progress → completed | cancelled`. Marks steps abandoned due to failure. Without this, GPT-5 either silently drops failed steps or marks them `completed`, distorting the plan history.

2. `merge` mode

`merge: true` updates existing steps by text matching, appends new ones. `merge: false` (default) replaces the entire plan. Token-efficient on long plans — prevents accidental step drops during partial updates.

3. `activeForm` field

Present-continuous text for in-progress steps: `step: "Run tests"`, `activeForm: "Running tests"`. Foundation for plan rendering in CLI/Control UI/messaging.

4. Plan hydration helper

`formatPlanForHydration()` reinjects active plan steps after context compaction. Phrased as factual statement to avoid triggering `PLANNING_ONLY_PROMISE_RE`.

Files changed

File Change
`src/agents/tools/update-plan-tool.ts` Extended schema: cancelled, merge, activeForm
`src/agents/plan-hydration.ts` New — `formatPlanForHydration()`
`src/agents/plan-hydration.test.ts` New — hydration tests
`src/agents/tools/update-plan-tool.parity.test.ts` New — parity tests

Dependencies

What follows

…e, activeForm, hydration

Ports three Hermes todo-tool features that OpenClaw's update_plan
was missing, plus adds plan hydration for post-compaction recovery.

## cancelled status (Hermes parity)
Add "cancelled" as a fourth plan step status. Hermes uses this to
mark steps that were started but abandoned due to failure, keeping
them visible in history instead of silently dropping them.
Ref: Hermes tools/todo_tool.py Status enum.

## merge mode (Hermes parity)
Add optional merge: boolean parameter (default false). When true,
incoming steps update existing ones by matching step text and new
steps are appended. When false, the entire plan is replaced.
Ref: Hermes tools/todo_tool.py write(todos, merge=False).

## activeForm field (Claude Code TodoWrite parity)
Add optional activeForm: string field on plan steps. Shows the
present-continuous form while in_progress (e.g. "Running tests"
instead of "Run tests"). Small schema addition with disproportionate
UX impact for plan rendering.

## Post-compaction plan hydration (Hermes parity)
New src/agents/plan-hydration.ts helper that formats active
(pending/in_progress) plan items for injection after context
compression. The injected text uses factual phrasing ("Your active
plan was preserved...") to avoid triggering the planning-only retry
guard's promise-language detection.
Ref: Hermes run_agent.py:6754-6756 + tools/todo_tool.py:format_for_injection().

Note: the compaction hook point in compact.ts is not wired in this
PR — that requires a follow-up to integrate with the compaction
checkpoint system (#62146). This PR provides the formatter; the
hook wiring is the next step.

Part of GPT 5.4 Enhancement v3 sprint. Tracking: #66345.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15d836e9fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/tools/update-plan-tool.ts Outdated
@greptile-apps

greptile-apps Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Ports three Hermes todo-tool features to update_plan: a cancelled step status, a merge mode that patches existing plan steps by text-match, and an activeForm field for live progress text, plus a formatPlanForHydration() helper for post-compaction re-injection. The previously reported P1 issues (wrong context binding in execute and the JSDoc "task list" vs "plan" mismatch) are fixed. Test coverage is thorough, including merge semantics, run-level isolation, event emission, and both invariant-violation paths.

Confidence Score: 5/5

Safe to merge — all prior P1 findings are addressed and no new blocking issues found.

The implementation is correct: merge mode is properly gated on a registered runId/context, the single-in_progress invariant is re-checked after merge, duplicate step text is caught at input time, and plan state persists correctly to AgentRunContext. The only remaining finding is a P2 style nit on the activeForm description string. No P0 or P1 issues remain.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/tools/update-plan-tool.ts
Line: 44-47

Comment:
**Redundant / contradictory `activeForm` description**

The two sentences say almost the same thing and partially contradict each other: the first implies the field is only for in_progress, while the second walks that back and says it's accepted on any status. Consider collapsing to a single clear sentence:

```suggestion
            description:
              'Present-continuous text shown while in_progress (e.g. "Running tests"). ' +
              "Accepted on any status but only rendered for in_progress steps.",
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "fix(agents): #67514 P1+P2 — re-validate ..." | Re-trigger Greptile

Comment thread src/agents/tools/update-plan-tool.ts Outdated
Comment thread src/agents/plan-hydration.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports Hermes task-system parity features into OpenClaw’s update_plan tool and introduces a helper for post-compaction plan hydration formatting, to preserve active plan context across turns.

Changes:

  • Extend update_plan step status set to include cancelled, and add optional per-step activeForm.
  • Add a merge mode intended to update steps by matching step text and appending new steps.
  • Add formatPlanForHydration() to format active (pending/in_progress) steps for injection after context compaction.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/agents/tools/update-plan-tool.ts Adds cancelled, merge, and activeForm support to the update_plan schema and execution logic.
src/agents/plan-hydration.ts Adds a formatter to produce a stable “active plan preserved” injection string after compaction.

Comment thread src/agents/tools/update-plan-tool.ts Outdated
Comment thread src/agents/tools/update-plan-tool.ts
Comment thread src/agents/tools/update-plan-tool.ts
Comment thread src/agents/plan-hydration.ts
Comment thread src/agents/plan-hydration.ts
Comment thread src/agents/tools/update-plan-tool.ts Outdated
Eva added 2 commits April 16, 2026 13:38
…rge mode

The execute() third param is an AbortSignal/context, not a plan context,
so context?.previousPlan was always undefined and merge mode was a no-op.
Fall back to replace until PlanStore (#67542) provides previous-plan lookup.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8aee1aa6f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/tools/update-plan-tool.ts Outdated
- Add plan-hydration.test.ts: tests formatPlanForHydration returns null
  for empty/all-completed/all-cancelled steps, filters out completed and
  cancelled steps, includes pending and in_progress with correct markers,
  and validates preserved plan header format
- Add update-plan-tool.parity.test.ts: tests cancelled status is accepted
  in schema, activeForm field is preserved in output, and merge=true with
  no previousPlan falls back to replace

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread src/agents/tools/update-plan-tool.ts
Comment thread src/agents/tools/update-plan-tool.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread src/agents/tools/update-plan-tool.ts
Comment thread src/agents/tools/update-plan-tool.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/agents/tools/update-plan-tool.ts
@100yenadmin

Copy link
Copy Markdown
Contributor Author

Plan-mode rollout series — status update

This PR is part of a 10-PR plan-mode rollout. The cumulative state ships locally as OpenClaw 2026.4.15 (3a6ec73) from branch feat/plan-channel-parity (= PR #68441 head).

Series overview + landing order: see #68441 (latest comment).

This PR's role in the series: see the original PR description above.

Live test status: covered by the cumulative install — all behaviors from this PR are verified in production-like usage on Telegram + webchat. No regressions detected since the live install (2026-04-18).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread src/agents/tools/update-plan-tool.ts
Comment thread src/agents/tools/update-plan-tool.ts
Comment thread src/agents/tools/update-plan-tool.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@100yenadmin

Copy link
Copy Markdown
Contributor Author

📋 Architecture & Status — single source of truth (commit 39e63febad)

The plan-mode rollout now has a durable architecture document at docs/plans/PLAN-MODE-ARCHITECTURE.md that survives session compactions and tracks the full series.

Quick reference:

  • This is one of 10 open PRs in the cumulative plan-mode rollout (PR-A through PR-11 internal sprint numbering).
  • Recommended landing order: 5 waves (see ARCHITECTURE.md "Recommended landing waves").
  • The cumulative branch feat/plan-channel-parity is the LIVE install (OpenClaw 2026.4.15 (39e63fe)).
  • All 10 PRs target upstream main; each carries forward the cumulative diff which inflates the file count beyond Greptile's 100-file review cap.

Resolution path for the file-count inflation: land PRs in dependency order so the cumulative diff naturally shrinks as upstream main absorbs them. No PR closure/reopen needed — that would lose review history without solving the structural cumulative-rollout pattern.

Hardening status (review pass 1):

Newly-resolved escalation (commit 39e63febad): the previously-deferred #3104743333 (Codex P2 — update_plan merge-mode sidebar refresh) is now fixed via option C (re-emit merged steps via existing agent_plan_event channel). New AgentPlanEventData.mergedSteps field carries the full structured plan; UI subscribes via new maybeForwardMergedPlanEvent handler.

Current status of THIS PR specifically: see the existing comments + bot reviews above. Triage + reply pass coming in the next sprint.

cc @copilot @greptile-apps @chatgpt-codex-connector

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

To use Codex here, create an environment for this repo.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/agents/tools/update-plan-tool.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment on lines 49 to 51
},
{ additionalProperties: true },
{ additionalProperties: false },
),

Copilot AI Apr 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdatePlanToolSchema now sets additionalProperties: false on each plan step object. That makes the published tool contract stricter than the implementation/tests (e.g. update-plan-tool.test.ts expects extra per-step keys like owner/notes to be tolerated and ignored). If the intent is to keep accepting unknown per-step fields for robustness/backwards-compat, keep additionalProperties enabled/omitted here; otherwise, update the tests/docs to reflect that extra keys are rejected at the schema level.

Copilot uses AI. Check for mistakes.
@100yenadmin

Copy link
Copy Markdown
Contributor Author

Closing in favor of consolidated PR #68939.

Rationale: this branch was 734 commits behind upstream/main and the
PR's review feedback was firing against a stale base. Rebased the
full 135-commit feature work onto upstream/main @ v2026.4.19-beta.2
(only 5 conflicts to resolve) and consolidated the 10-PR series into
a single umbrella PR for cleaner bot review + faster maintainer
context-loading.

The full iteration history + decision log lives in
docs/plans/PLAN-MODE-ARCHITECTURE.md on the new branch. All
reviewed-and-resolved threads from this PR are honored — see the
architecture doc for what landed where.

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

Labels

agents Agent runtime and tooling size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants