Skip to content

Surface Codex final answer candidates in activity#90610

Merged
steipete merged 1 commit into
openclaw:mainfrom
ooiuuii:agent/xiaozhua/codex-final-answer-candidates
Jul 17, 2026
Merged

Surface Codex final answer candidates in activity#90610
steipete merged 1 commit into
openclaw:mainfrom
ooiuuii:agent/xiaozhua/codex-final-answer-candidates

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Emit Codex final_answer candidates as ephemeral Activity events with candidate, superseded, and selected lifecycle states.
  • Select only the authoritative candidate at successful turn completion; late tool work invalidates an earlier candidate until a replacement arrives.
  • Render candidate lifecycle in the current Control UI Activity page without transcript persistence or channel progress.
  • Rewrite the old branch on current main around the current projector and standalone Activity owners.

Why

Codex may emit a final-answer candidate, reopen the same turn for injected work or a tool, then emit a second authoritative candidate. Activity should expose that lifecycle for operators without leaking provisional text into chat or messaging channels.

The implementation follows the upstream Codex contract: MessagePhase::FinalAnswer is the terminal answer for the current turn, while explicit same-turn work can reopen the turn. The regression fixture covers candidate one, late tool work, candidate two, and authoritative turn/completed selection. A second regression covers candidate one, late tool work, and no replacement.

Behavior proof

Tests

  • node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.test.ts — 166 passed
  • node scripts/run-vitest.mjs ui/src/pages/activity/tool-activity.test.ts ui/src/pages/activity/view.test.ts — 9 passed
  • node --import tsx scripts/control-ui-i18n-verify.ts baseline and verify — passed
  • node scripts/check-changed.mjs -- <changed files> — passed on Testbox
  • source-blind Control UI E2E — passed on Testbox
  • fresh autoreview after the late-tool regression fix — clean
  • git diff --check origin/main...HEAD — passed

Notes

  • Candidate events set hideFromChannelProgress: true.
  • Candidate text never enters messagesSnapshot or a persistent store.
  • No config, protocol, dependency, or channel capability change.
  • Contributor credit is preserved in the commit trailer.

@openclaw-barnacle openclaw-barnacle Bot added extensions: codex size: M proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 5, 2026
@clawsweeper

clawsweeper Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 2:54 AM ET / 06:54 UTC.

Summary
The PR emits ephemeral Codex final-answer candidate lifecycle events and renders candidate, superseded, and selected states in the Control UI Activity page without transcript persistence or channel progress.

PR surface: Source +168, Tests +392. Total +560 across 11 files.

Reproducibility: not applicable. as a bug reproduction: this PR adds operator visibility for an upstream lifecycle that is established by source, while its real browser behavior still needs exact-head live proof.

Review metrics: 1 noteworthy metric.

  • Activity i18n surface: 5 keys added, 4 strings changed, 0 baseline metadata files. The scoped UI policy requires generated localization metadata to remain aligned with English source changes before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Regenerate and commit the Control UI i18n metadata, then rerun baseline and verify checks.
  • Post exact-head live Codex-to-Gateway-to-Control-UI proof; updating the PR body should trigger review, or a maintainer can request @clawsweeper re-review.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The exact-head screenshots and source-blind Playwright fixture directly show the UI, but the fixture installs a mock Gateway; add a live exact-head Codex run or diagnostic recording/log proving the projector-to-Gateway-to-Control-UI path, with private identifiers, endpoints, credentials, and message content redacted. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A live web UI chat proof would materially establish that candidate lifecycle events reach Activity while provisional answer text remains absent from chat. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: reproduce a Codex turn with an initial final-answer candidate, late tool work, and a replacement candidate; capture redacted evidence that Activity shows superseded then selected states, provisional text never appears in chat, and a new document starts with empty Activity.

Risk before merge

  • [P1] The branch is behind current main and needs a refresh before final merge review; stale-base drift alone does not establish a patch defect.
  • [P1] The repository-required inspection of the sibling ../codex checkout could not be executed because the read-only command sandbox failed before every command; official upstream source supports the design, but the local dependency gate remains incomplete.

Maintainer options:

  1. Decide the mitigation before merge
    Land one ephemeral Activity-only candidate lifecycle after regenerating the locale metadata and producing exact-head live proof that late work supersedes earlier candidates, successful completion selects only the authoritative candidate, provisional text never reaches chat or channels, and Activity does not persist across documents.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The contributor should regenerate the missing i18n metadata and provide exact-head live behavior proof; automation cannot supply proof from their real setup.

Security
Cleared: The patch adds no dependency, permission, secret, package-resolution, persistence, workflow-execution, or downloaded-code surface.

Review findings

  • [P2] Regenerate the Activity localization metadata — ui/src/i18n/locales/en.ts:2283-2289
Review details

Best possible solution:

Land one ephemeral Activity-only candidate lifecycle after regenerating the locale metadata and producing exact-head live proof that late work supersedes earlier candidates, successful completion selects only the authoritative candidate, provisional text never reaches chat or channels, and Activity does not persist across documents.

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

Not applicable as a bug reproduction: this PR adds operator visibility for an upstream lifecycle that is established by source, while its real browser behavior still needs exact-head live proof.

Is this the best way to solve the issue?

No, not yet; the standalone ephemeral Activity surface is the correct ownership boundary, but the submitted head is incomplete until localization metadata and real-setup proof match the implementation.

Full review comments:

  • [P2] Regenerate the Activity localization metadata — ui/src/i18n/locales/en.ts:2283-2289
    This exact head still changes the English Activity catalog without committing the generated .i18n/*.meta.json baseline updates required by ui/AGENTS.md. The prior review raised the same blocker against this unchanged SHA; regenerate the baseline so the locale source hashes and key counts match before merge.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The exact-head screenshots and source-blind Playwright fixture directly show the UI, but the fixture installs a mock Gateway; add a live exact-head Codex run or diagnostic recording/log proving the projector-to-Gateway-to-Control-UI path, with private identifiers, endpoints, credentials, and message content redacted.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The exact-head screenshots and source-blind Playwright fixture directly show the UI, but the fixture installs a mock Gateway; add a live exact-head Codex run or diagnostic recording/log proving the projector-to-Gateway-to-Control-UI path, with private identifiers, endpoints, credentials, and message content redacted. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: This is a bounded operator-facing Codex and Control UI feature with limited blast radius and a concrete merge blocker.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The exact-head screenshots and source-blind Playwright fixture directly show the UI, but the fixture installs a mock Gateway; add a live exact-head Codex run or diagnostic recording/log proving the projector-to-Gateway-to-Control-UI path, with private identifiers, endpoints, credentials, and message content redacted. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The exact-head screenshots and source-blind Playwright fixture directly show the UI, but the fixture installs a mock Gateway; add a live exact-head Codex run or diagnostic recording/log proving the projector-to-Gateway-to-Control-UI path, with private identifiers, endpoints, credentials, and message content redacted.
Evidence reviewed

PR surface:

Source +168, Tests +392. Total +560 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 182 14 +168
Tests 5 394 2 +392
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 576 16 +560

Acceptance criteria:

  • [P1] node --import tsx scripts/control-ui-i18n-verify.ts baseline.
  • [P1] node --import tsx scripts/control-ui-i18n-verify.ts verify.
  • [P1] node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.test.ts.
  • [P1] node scripts/run-vitest.mjs ui/src/pages/activity/tool-activity.test.ts ui/src/pages/activity/view.test.ts.
  • [P1] git diff --check origin/main...HEAD.

What I checked:

  • Unresolved localization metadata: The exact head adds five answer-candidate translation keys and changes four existing Activity strings, but its changed-file list contains no generated .i18n/*.meta.json baseline updates. (ui/src/i18n/locales/en.ts:2283, 7e6cf8dce838)
  • Prior finding remains on the same head: The previous completed ClawSweeper cycle raised “Regenerate the Activity localization metadata” against SHA 7e6cf8d; the current head is still that SHA, with only a later proof comment and no code commit. (ui/src/i18n/locales/en.ts:2283, 7e6cf8dce838)
  • Scoped UI policy: The UI guide requires English locale changes to include the generated i18n baseline files and verification with the repository i18n commands. (ui/AGENTS.md:34, 0097363c69af)
  • Upstream final-answer phase contract: Codex defines MessagePhase::FinalAnswer as terminal answer text for the current sampling result, supporting classification of these messages as answer candidates. (../codex/codex-rs/protocol/src/models.rs:3552)
  • Upstream same-turn continuation contract: Codex computes whether follow-up is needed from model state and pending input, and can continue the same turn instead of finalizing the last agent message. (../codex/codex-rs/core/src/session/turn.rs:2763)
  • Current-head proof uses a mock Gateway: The added browser scenario installs installMockGateway; its screenshots and assertions are valuable supplemental UI evidence but do not establish the external-PR real-setup gate by themselves. (ui/src/e2e/activity-answer-candidates.e2e.test.ts:8, 7e6cf8dce838)

Likely related people:

  • steipete: They rewrote the current branch head, authored its consolidated commit, and supplied the latest visual evidence for the exact Codex and Control UI surfaces. (role: recent area contributor and adopter; confidence: high; commits: 7e6cf8dce838; files: extensions/codex/src/app-server/event-projector-assistant.ts, extensions/codex/src/app-server/event-projector.ts, ui/src/pages/activity/tool-activity.ts)
  • BunsDev: They authored the earlier broader native-Codex Control UI activity proposal, making them relevant to the intended UX and privacy boundary even though that PR was not merged. (role: prior adjacent implementation author; confidence: medium; commits: bf3d17b641da; files: extensions/codex/src/app-server/event-projector.test.ts, ui/src/ui/app-tool-stream.ts, ui/src/ui/chat/status-indicators.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-06-26T17:12:47.436Z sha 30ead74 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-17T06:42:39.648Z sha 7e6cf8d :: needs real behavior proof before merge. :: [P2] Regenerate the Activity localization metadata

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L and removed size: M labels Jun 5, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 5, 2026
@ooiuuii

ooiuuii commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 5, 2026
@ooiuuii

ooiuuii commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 5, 2026
@clawsweeper

clawsweeper Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 5, 2026
@ooiuuii
ooiuuii force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from d0fe9a3 to cb32edd Compare June 6, 2026 05:48
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 14, 2026
@ooiuuii
ooiuuii force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from 2bf4798 to 3318998 Compare June 15, 2026 12:34
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 15, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 15, 2026
@ooiuuii

ooiuuii commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto current main and resolved the stale i18n metadata conflicts. Current head 3318998e89a1 is merge-clean and GitHub checks are pass/skipped only, including the previously red OpenGrep PR Diff check.

@clawsweeper

clawsweeper Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@ooiuuii
ooiuuii force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from 3318998 to 5ea85bc Compare June 21, 2026 09:20
@clawsweeper clawsweeper Bot added 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 rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 21, 2026
@ooiuuii

ooiuuii commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Refreshed the generated Control UI i18n metadata at head 64c084dcaf795aefcf94866d22338cf061002e5c: the 18 .i18n/*.meta.json files now carry the current answer-candidate source hash/key counts. Current-head proof was added to the PR body; targeted regression tests and git diff --check passed.

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 Jun 21, 2026
@ooiuuii
ooiuuii force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from 64c084d to 30ead74 Compare June 26, 2026 17:06
@steipete
steipete force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from 30ead74 to b84c05c Compare July 17, 2026 06:22
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Surface Codex final answer candidates in activity This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from b84c05c to 3b9da62 Compare July 17, 2026 06:29
@steipete
steipete force-pushed the agent/xiaozhua/codex-final-answer-candidates branch from 3b9da62 to 7e6cf8d Compare July 17, 2026 06:30
@steipete

Copy link
Copy Markdown
Contributor

Visual proof

Sanitized deterministic Control UI fixture.

Before — empty Activity

01-before-empty-activity

After — superseded and selected candidates

02-after-selected-answer

Source-blind Testbox E2E: https://github.com/openclaw/openclaw/actions/runs/29559290067

@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@ooiuuii

ooiuuii commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Really cool to see this land. Surfacing superseded and selected Codex answer candidates in Activity makes long, tool-using runs much easier to understand without leaking provisional text into chat. Thanks for the review and merge!

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 extensions: codex P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants