Skip to content

fix: resume goals in existing local Codex sessions - #186524

Merged
roboclaw-bot merged 4 commits into
openclaw:mainfrom
jjjhenriksen:fix/local-codex-goal-resume-20261027
Oct 30, 2026
Merged

roboclaw-bot merged 4 commits into
openclaw:mainfrom
jjjhenriksen:fix/local-codex-goal-resume-20261027

Conversation

@jjjhenriksen

@jjjhenriksen jjjhenriksen commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Related: #180208, #185273.

What Problem This Solves

Fixes: Goal Start and Resume reject existing local Codex sessions even though ordinary turns in those conversations work.

User Impact

Operators can resume the same local Codex goal with its identity, objective, and history retained, using the existing budget-accounting rules. Resume asks the model to read the current saved goal before working, so an objective edited while paused takes effect.

Why This Change Was Made

Use the existing native input commit and acknowledgement path for both local and cloud-worker Codex sessions, while keeping worker transcript authority specific to workers. Select native admission before built-in admission so an existing session with no recorded harness cannot enter both paths. Existing session identity, operator authority, busy-work, placement, and native thread-ownership checks remain enforced.

Difference from #180208: that PR continues an active local Codex goal after a normal turn ends. This PR handles explicit Start/Resume admission in an existing conversation. It is independent of the continuation patch and adds no automatic pursuit or restart replay.

Maintainer decision

@brokemac79 accepted the focused support extension for explicit Goal Start and Resume in existing idle local Codex sessions and requested landing through the normal maintainer process on October 30, 2026. Maintainer review and landing discussion.

Worked on by: @jjjhenriksen (implementation).
Worked on by: @brokemac79 (maintainer acceptance and landing direction).

Evidence

  • Final maintainer review (October 30, head c2c5269fbc3e): direct owner/caller review and a fresh helper-isolated autoreview of all nine changed files against base acf995b629063dd5ac1db2737fd561b491566d6b, including complete admission/commit-owner context, found no actionable P0-P2 defects. This was a source review, not a new test run. No code or branch refresh was needed.

  • Exact-head CI: run 40797953270, attempt 1 completed. The successful Goal test shard executed all 44 Goal cases, including built-in, recorded-Codex, and unrecorded-Codex Resume variants; build and type jobs also passed. Aggregate CI remains failed, not green.

  • Inherited-CI disposition: check-lint-core-2 fails on the unchanged eslint(curly) error at src/agents/tools/sessions-send-tool.admission.test.ts:722, with two existing max-lines warnings in session-manager-core.ts and session-manager.ts. Independent main run 40796541972 has the same diagnostics. The failing files, lint runner/configuration, manifest, and lockfile are byte-identical between that baseline, the actual tested main parent e25c026e, and tested merge 3c1afb51. The native inherited-failure exception retains this failed CI; it does not waive review or security.

  • Live-proof boundary: the contributor real-Gateway/native-model pause/edit/Resume proof below is prior-head evidence and was not independently rerun for this landing. Current-head CI supplies the production-RPC regression coverage.

  • Conflict update (c2c5269fbc3): merged upstream main at acf995b629063dd5ac1db2737fd561b491566d6b and resolved six conflicts after upstream retired restart-safe admission and moved the Goal commit guard. Local Codex selection still precedes built-in local input admission; worker transcript authority remains worker-only. The merged fix: goals fail to resume after stopping a run #185273 Resume-after-Stop fix and typed invalid-goal errors are retained.

  • Current-candidate validation: 44/44 public Goal admission/continuation regressions passed, including built-in, recorded local Codex, unrecorded local Codex, worker setup/revocation controls, identity/history retention, and idempotent replay (152.83s including cold worker preparation). Core and Gateway-server test typechecks, targeted core/root-test lint, formatting of all nine PR files, Goal MDX validation, and whitespace checks passed. Lint used the repository's source-backed core/root-test configurations after a broader configuration encountered pre-existing borrowed dependency links; no dependency links or lint guards were changed.

  • Independent review: a separate native read-only reviewer assessed the full nine-file candidate against acf995b629063dd5ac1db2737fd561b491566d6b at P0–P2 and found no actionable defects. Static review only; the shared autoreview helper could not launch because its codex executable was unavailable. This is not a helper-validated clean report. Current-head CI has now completed with the inherited lint failure described above; scope acceptance and fresh independent review are recorded above. No fresh hosted re-review was requested. The prior real-model scenario below has not been rerun after this integration; previous-head proof is retained with that boundary.

  • Prior-head review follow-up (0fdc43d4672): fixed ClawSweeper's documentation finding by aligning the Control UI eligibility paragraph with existing local Codex admission and keeping native admission separate from worker setup. Focused docs formatting, MDX validation, and whitespace checks pass. This is documentation only; runtime and real-model proof are unchanged. ClawSweeper accepted the supplied live behavior proof and identified no runtime defect. Hosted CI and the published openclaw/ci-gate passed on prior head 0fdc43d4672835a8d77271939ad62eb25b896c48 (CI run, published gate). That prior-head CI completed with no pending or failed checks; it is not current-head CI proof. ClawSweeper has not re-reviewed this documentation-only follow-up: its dispatch was deduplicated with review_request_required. The earlier hosted Codex review failed without publishing findings and is not claimed as passed. Current scope acceptance and final independent review are recorded above.

  • CI lint repair (9f0f056c391): reproduced the check-lint failure from run 40632910651 using the same root-test lint wrapper. Changed only two accesses to the __openclaw wire field from dot to bracket notation; the wrapper now passes. Runtime code and proof assertions are unchanged, so the real-model evidence below remains applicable. The subsequent hosted check-lint job passed on 9f0f056c391.

  • Base red: the production Goal RPC regression rejected local Codex Resume with requires an idle built-in local session with recoverable history. The built-in variant passed.

  • Real behavior, passed: a built production Gateway and real native Codex model, using disposable staged native auth and isolated Gateway state, started a synthetic goal; an operator paused and edited it; public Resume then caused real get_goal lookup and completion of that same goal. The new final marker existed only in the edited objective. Goal ID, creation time, session ID, objective, and prior stored history were retained. Replaying the same Resume operation returned its receipt with no new run or messages.

  • The first live attempt exposed overlapping built-in/native admission for an unrecorded harness; that producer defect was repaired and added as a third regression variant. Authentication-only fixture failures were resolved by using the supported native home route with the live-test owner's staged HOME; credential portability policy was not relaxed.

  • 44/44 Goal admission/queue/SQLite regressions passed (wall 123.90s, Vitest 119.45s); the final focused built-in/recorded-Codex/unrecorded-Codex variants also passed (61.33s wall). Hosted CI completed successfully; the linked run provides timing.

  • The complete live scenario passed in 54.67s (test 36.40s), including model effects, visible reply, history, and replay checks.

  • Production runtime build, core and Gateway-server test typechecks, focused lint/format, whitespace check, and fresh independent source review passed.

Sanitized live receipt (synthetic identifiers omitted):

{"proof":"local-codex-same-goal-resume","followedEditedObjective":true,"preservedHistory":true,"completed":true,"replayedWithoutNewRun":true}

Reproduce with an available native Codex model and live-test auth:

OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_CODEX_GOAL_RESUME=1 \
OPENCLAW_LIVE_CODEX_HARNESS_MODEL='<configured-native-model>' \
node scripts/run-vitest.mjs run --config test/vitest/vitest.live.config.ts \
  test/gateway-local-codex-goal-resume.live.test.ts --maxWorkers=1

The history assertion excludes only __openclaw.transcriptPosition.source, the projected display-generation cursor defined by session-accessor.sqlite-display-position.ts; every other original message field remains compared. Replay compares the complete raw history after settlement.

Scope: no production Gateway restart/deployment or existing user-goal mutation. A genuinely claimed native thread still refuses work; this does not bypass that guard. No claim of restart recovery or automatic local continuation.

Simplification: reuse the native commit/ACK owner, with a local/worker admission mode instead of a second persistence path. Production delta +56/-47, test delta +424/-103, docs +8/-3 (against integrated base acf995b6290).

@clawsweeper

clawsweeper Bot commented Oct 28, 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 labels Oct 28, 2026
@jjjhenriksen
jjjhenriksen marked this pull request as ready for review October 28, 2026 04:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T04:35:19.026941Z
We couldn’t complete this review. Comment @codex review to try again.
f29de1c Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR enables explicit Goal Start and Resume in existing local Codex conversations through the shared native admission and acknowledgment path.

Example: An operator pauses “Finish the release checklist,” edits its objective, and selects Resume in an existing local Codex conversation.

  • Before: Resume rejects the conversation as unsupported.
  • After: Resume retains the same Goal and conversation, asks Codex to read the edited objective, and acknowledges the committed operation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused implementation with useful live evidence and no verified defect; overall readiness awaits the explicit product decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied prior-head real Gateway/native Codex output proves Start, pause/edit/Resume, current-objective lookup, completion, preserved identity/history, and idempotent replay; the live scenario is unchanged at this head, and the integration reports fresh production-boundary validation without claiming a fresh real-model run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Existing local Codex conversations accept ordinary turns but reject explicit Goal Start and Resume.
Reason: The user value is concrete, but the change intentionally expands a support boundary established by the Goal owners.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR provides distinct, useful local Codex Goal support with no verified introduced defect, but expanding the intentional runtime-support boundary needs an owner decision.

Priority: P2
Reviewed head: c2c5269fbc3e221383f282b5704b6f2f7e777505
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should explicit Goal Start and Resume support existing idle local Codex sessions through the shared native admission owner?
  • Recommendation: Approve local Codex Start and Resume: Accept the focused extension, which preserves existing authorization, native ownership, transaction, and receipt owners.
  • Why: Earlier implementations deliberately limited this admission path to cloud workers, and neither the discussion nor reviews records approval of this specific extension.

Before merge

  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

Gateway Goal requests pass through session authorization, runtime selection, native input admission, and the existing transcript transaction before returning a durable operation receipt.

flowchart LR
  A[Operator Goal request] --> B[Gateway authorization]
  B --> C[Runtime and placement selection]
  C --> D[Native input admission]
  D --> E[Goal and transcript transaction]
  E --> F[Operation acknowledgment]
  D --> G[Codex execution]
Loading

Technical review

Best possible solution:

Approve the focused support extension and retain one native admission owner for local and worker Codex Goals.

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

Current-main source rejects recorded local Codex Goal admission through its intentional worker-only native predicate; the contributor also supplies a matching base-red public-RPC result.

Is this the best way to solve the issue?

The implementation is a small, coherent extension of existing native admission, persistence, and acknowledgment owners rather than a parallel Goal implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 945f6dde06e2.

Provenance checked

  • Native Goal eligibility and acknowledgment changes intended behavior with a stated reason (eec3594: Support Codex cloud-worker Goals while withholding success until native admission commits the Goal, input, and receipt.)
  • Worker-specific transcript authority keeps the original intent (eec3594: Require live worker placement and turn-claim authority at the transcript commit boundary.)
  • Hidden Resume input keeps the original intent (0474704: Start a real continuation without adding a human command message; this PR retains that contract and adds current-objective lookup guidance.)
  • Moved direct-session admission predicate keeps the original intent (9344233: The restart refactor moved the predicate into the current admission owner. A deeper old-path git log search encountered a missing historical blob; current predicate history and the relevant merged PR reasons were independently available.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0474704 adds src/gateway/server-methods/sessions-goal.ts:104 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 047470456ff2; files: src/gateway/server-methods/sessions-goal.ts)
  • Dallin Romney: Raw commit 0661e52 adds docs/tools/goal.md:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0661e52a19d1; files: docs/tools/goal.md)

PR surface

Source +9, Tests +321, Docs +5. Total +335 across 9 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 6 56 47 +9
Tests 2 424 103 +321
Docs 1 8 3 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 488 153 +335

Review metrics

Metric Value Why it matters
Production versus test changes Production +56/-47; tests +424/-103 Production growth reuses existing owners; test growth adds recorded/unrecorded native admission variants and a real-model pause/edit/resume/replay scenario.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.

Label justifications:

  • P2: This is a bounded runtime-support improvement for existing local Codex Goal workflows.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-28T05:02:23.688Z sha 9f0f056 :: blocked before merge. :: [P3] Update the Control UI eligibility paragraph for local Codex

Reviewed October 29, 2026, 12:26 AM ET / 04:26 UTC (Revision 2).

@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Oct 29, 2026
@jjjhenriksen

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. labels Oct 29, 2026
@roboclaw-bot roboclaw-bot added the clawtributors PR from a clawtributor label Oct 29, 2026
@roboclaw-bot
roboclaw-bot merged commit f2e7dcc into openclaw:main Oct 30, 2026
142 of 146 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
Allow explicit Goal Start and Resume in existing idle local Codex sessions through the existing native input transaction and acknowledgment path. Retain worker-only source authority, same-session identity/history, current-objective lookup, and durable idempotent receipts.

Exact-head CI passes all 44 Goal cases. The native inherited-CI exception records the unchanged baseline lint failure; CI is not described as green. Fresh independent P0-P2 source review found no actionable defects. The contributor real-model proof remains prior-head evidence.

Worked on by: @jjjhenriksen (implementation).
Worked on by: @brokemac79 (maintainer acceptance and landing direction).

Co-authored-by: brokemac79 <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
Allow explicit Goal Start and Resume in existing idle local Codex sessions through the existing native input transaction and acknowledgment path. Retain worker-only source authority, same-session identity/history, current-objective lookup, and durable idempotent receipts.

Exact-head CI passes all 44 Goal cases. The native inherited-CI exception records the unchanged baseline lint failure; CI is not described as green. Fresh independent P0-P2 source review found no actionable defects. The contributor real-model proof remains prior-head evidence.

Worked on by: @jjjhenriksen (implementation).
Worked on by: @brokemac79 (maintainer acceptance and landing direction).

Co-authored-by: brokemac79 <[email protected]>

Backport to 2026.11.6: preserve existing local session identity and native-writer admission; keep cloud-worker source checks worker-only. Exact Codex 0.169 contract inspected at d32063f96c2dff1dc96af839b3952abb6acfeda4. No schema or dependency changes.

Source-commit: f2e7dcc
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawtributors PR from a clawtributor docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants