Skip to content

fix(goals): continue local Codex sessions - #180208

Merged
RomneyDa merged 1 commit into
mainfrom
fix/codex-local-goal-continuation
Oct 28, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/codex-local-goal-continuation

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • continue active OpenClaw Goals after a normal nonterminal local Codex turn
  • bind the queued continuation to exact local/worker placement and live operator authority
  • reject stale local continuations when placement or worker-required policy changes before admission

This is the minimal same-process continuation portion of #177351, with credit to @Baumus for the original investigation and implementation. It intentionally excludes durable restart replay and broader recovery machinery.

Verification

  • pnpm exec vitest run src/auto-reply/reply/goal-continuation.test.ts src/auto-reply/reply/reply-agent-turn-preparation.test.ts --pool=forks --maxWorkers=1 (96 tests passed)
  • focused formatter: 3 files passed
  • focused oxlint: 0 warnings, 0 errors
  • git diff --check

Scope

No native Codex goal engine, restart recovery, merge, or backport.

Exact-head product proof

On fb34582bdd06, a real Gateway process and separate Codex app-server process exercise the production queue:

  • happy path: exactly 2 native turn/start submissions; turn 2 calls the real update_goal; the persisted Goal is complete; no third turn starts
  • placement-policy invalidation while turn 1 is held: exactly 1 native submission; the queued continuation is rejected before Codex receives it
  • operator-role revocation while turn 1 is held: exactly 1 native submission; the queued continuation is rejected before Codex receives it

The same happy-path harness on parent ec3e1030768 stops after one native turn, establishing base-red / head-green behavior.

@clawsweeper

clawsweeper Bot commented Oct 22, 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 extensions: codex size: M labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug 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. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets active local Codex Goals continue through the existing queue while rechecking placement policy and operator authority.

Example: A local Codex Goal remains active after its first normal turn.

  • Before: Only one native turn runs, leaving the objective unfinished.
  • After: A second native turn completes the Goal, and no third turn starts.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful repair with production-entry-point receipts, authority rejection coverage, passing exact-head CI, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Exact-head production receipts exercise chat.send through a real Gateway and separate Codex app-server: two native submissions complete the Goal, while placement-policy invalidation and operator-role revocation each prevent the second submission.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An unfinished local Codex Goal stops advancing after a normal turn and needs another operator prompt.
Reason: The maintainer-authored PR approves this narrow direction and fixes the same-process failure without importing the broader recovery machinery.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused local Codex Goal continuation fix still missing from current main; no actionable introduced defect was found.

Priority: P2
Reviewed head: fb34582bdd06125be1fcf07c78ffe8df849d7d35

Before merge

None.

Findings

None.

Agent review details

How this fits together

Goal continuation consumes settled turn results and current session state, then submits eligible internal nudges through the shared follow-up queue and ordinary Codex execution.

flowchart TD
  A[Settled Codex turn] --> B[Goal eligibility]
  B --> C[Shared follow-up queue]
  C --> D[Session admission]
  D --> E[Placement and authority checks]
  E --> F[Native Codex turn]
  F --> G[Goal completion or continuation]
Loading

Technical review

Best possible solution:

Land the focused continuation change through the existing queue and admission owners while retaining native Goal suppression.

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

Current main's worker-only eligibility explains the failure, supported by the contributor's parent-red/head-green Gateway receipt; no target code was executed during this review.

Is this the best way to solve the issue?

The smallest complete fix broadens existing placement eligibility and revalidates it at admission, preserving the queue, cancellation, accounting, and authority owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5e2f560194b1.

Provenance checked

  • Codex placement eligibility changes intended behavior with a stated reason (eec3594: Support core Goals on remote-exec workers through existing placement and admission owners while leaving native autonomous Goals disabled.)
  • Queued turn admission keeps the original intent (36e277d: Consolidate session turns, queues, and Stop under one controller; the patch retains that admission owner.)
  • Automatic Goal continuation keeps the original intent (c845d6d: Continue unfinished active Goals through hidden queue nudges while preserving user-input priority, budgets, cancellation, and delivery.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +48, Tests +108, Docs 0. Total +156 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 81 33 +48
Tests 1 109 1 +108
Docs 2 4 4 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 194 38 +156

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Local Codex Goals can stop after a normal unfinished turn; the fix has a limited runtime scope.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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 (2 earlier review cycles)
  • reviewed 2026-10-22T03:16:42.137Z sha 9ad0df8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-23T23:49:53.755Z sha fb34582 :: needs maintainer review before merge. :: none

Reviewed October 23, 2026, 7:56 PM ET / 23:56 UTC (Revision 3).

@RomneyDa

Copy link
Copy Markdown
Member Author

Live proof receipt

Validated this change through an isolated real Gateway process plus a separate Codex app-server process, using the production chat.send Goal admission, shared follow-up queue, native turn/start, and real update_goal tool bridge.

Scenario:

  • one Goal-starting chat.send enters the Gateway;
  • native turn 1 returns nonterminal work;
  • automatic continuation must submit native turn 2;
  • turn 2 invokes update_goal(status: complete) through the app-server tool protocol;
  • persisted Goal state is read back as complete;
  • the app-server trace must contain exactly two turn/start submissions (no accidental third turn).

Results:

  • Parent ec3e10307682: RED — only 1 native turn was submitted; polling failed with expected 1 to be 2.
  • PR head fb34582bdd06: GREEN — 1/1 passed; exactly 2 native turns, persisted Goal complete, no third submission.

This is process-level base-red/head-green evidence for the local Codex continuation path, not a mocked runEmbeddedAgent assertion.

@RomneyDa

Copy link
Copy Markdown
Member Author

Exact-head Gateway/Codex continuation proof

The production harness is green at fb34582bdd06 (3/3):

  • normal continuation: exactly two native turn/start calls, turn two invokes the real update_goal, persisted status becomes complete, and no third turn starts
  • placement-policy invalidation while turn one is held: exactly one native submission; no continuation reaches Codex
  • operator-role revocation while turn one is held: exactly one native submission; no continuation reaches Codex

This extends the earlier base-red/head-green receipt: parent ec3e1030768 stops after one native turn, while the PR head advances and completes. The PR body now records the proof.

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 23, 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-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 23, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 23, 2026
@RomneyDa
RomneyDa merged commit 0661e52 into main Oct 28, 2026
152 checks passed
@RomneyDa
RomneyDa deleted the fix/codex-local-goal-continuation branch October 28, 2026 20:17
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
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 extensions: codex P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants