Skip to content

[codex] Branch 9O Commander result review gate#104

Open
Ian747-tw wants to merge 6 commits into
mainfrom
redesign/branch9o-commander-result-review-gate
Open

[codex] Branch 9O Commander result review gate#104
Ian747-tw wants to merge 6 commits into
mainfrom
redesign/branch9o-commander-result-review-gate

Conversation

@Ian747-tw

@Ian747-tw Ian747-tw commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds the Branch 9O OpenCode result-review gate for bounded Commander/human review metadata over 9N result reports.
  • Adds runtime preview/dry-run/record/list/get/latest/summary commands, TUI/headless slash commands, fake runtime support, authority records, and targeted E2E coverage.
  • Renames the older read-only result-review packet summary slash/runtime surface to result-review-packet-summary / runtime.opencode_result_review_packet_summary so /opencode-result-review* owns the new 9O gate.
  • Adds post-review no-start coverage for the short /result-review-* aliases, fake-runtime list filtering for disposition/projection/next-step filters, /result-review-show alias authority/runtime wiring, 9O gate-specific command-error routing, and fail-closed validation for invalid explicit next_step values.

Result review model

  • Adds OpenCodeResultReviewDecision, OpenCodeResultReviewDisposition, OpenCodeResultReviewNextStep, and OpenCodeResultReviewProjectionState types.
  • Persists one bounded opencode_result_review_recorded event per successful non-dry review.
  • Stores bounded rationale, evidence summary, accepted/rejected claims, revision/follow-up requests, risk flags, artifact/test refs, confidence, author kind, and linked 9N evidence chain metadata.

Decision/disposition/projection behavior

  • accepted maps to accepted_as_evidence, reviewed_accepted, and prepare_research_ingestion as a recommendation only.
  • rejected maps to rejected_as_evidence and reviewed_rejected without failing the mission.
  • needs_revision, needs_followup, inconclusive, needs_human_review, and deferred map to their bounded review dispositions and projection states.
  • Unknown or omitted decisions fail closed; non-deferred decisions require bounded rationale.
  • Invalid explicit next_step values fail closed; defaults are used only when next_step is omitted.

Relationship to 9N result reports

  • Requires a valid 9N report_id; validates the linked planned session and launch.
  • Blocks duplicate active reviews for the same report.
  • Review projection is event-derived in the 9O review surface; the original 9N result-report event is not mutated.

Launch/result/evidence anchoring behavior

  • Review records inherit and validate the report's session_id, launch_id, and linked progress/watchdog/question/guidance/delivery/wake IDs.
  • Launch must still resolve through durable 9D launch metadata.
  • The review event stores pointer IDs and bounded previews only.

Preview/dry-run/record/list/latest/summary behavior

  • runtime.preview_opencode_result_review validates eligibility and returns the bounded would-be record.
  • runtime.record_opencode_result_review dry-run appends no events; non-dry appends one review event through the metadata write path/run lock.
  • list/get/latest/summary rebuild from durable events and are no-start read surfaces.

Duplicate behavior

  • Existing review for the same report blocks preview/create, including dry-run.
  • Duplicate exact review hashes are also blocked.
  • Supersede/cancel is intentionally out of scope for 9O.

Event persistence/redaction behavior

  • Event payloads are bounded and redacted.
  • Raw logs, full diffs, file contents, provider output, raw OpenCode output, full event logs, research.db dumps, prompt transcripts, mission mutation commands, research-ingestion commands, and checkpoint claims are rejected.

Fake-vs-real runtime behavior

  • Fake runtime supports preview, dry-run, record, duplicate blocking, list/get/latest/summary, deterministic review IDs, and matching list filters for decision/disposition/projection/next step.
  • Real runtime uses durable event projection and no-start read/dry-run behavior.
  • Neither fake nor real runtime calls providers, sends OpenCode prompts, writes research.db, mutates mission state, creates checkpoints, or creates follow-up missions.

Runtime commands/API surface

  • runtime.preview_opencode_result_review
  • runtime.record_opencode_result_review
  • runtime.list_opencode_result_reviews
  • runtime.get_opencode_result_review
  • runtime.latest_opencode_result_review
  • runtime.opencode_result_review_summary

TUI result-review surface

  • Adds /opencode-result-review-preview, /opencode-result-review-dry-run, /opencode-result-review, /opencode-result-reviews, /opencode-result-review-latest, /opencode-result-review-show, /opencode-result-review-summary plus aliases.
  • Adds an “OpenCode result reviews” snapshot section with decision, disposition, projection, next step, claims/requests/refs, false side-effect flags, records, selected/latest review, and summary counts.
  • Covers both canonical commands and short aliases in the headless no-start detector.
  • Routes 9O gate command failures, including bad list args, to opencodeResultReviews.commandError instead of the legacy packet state.

No-mission-completion guarantee

  • Result reviews never mark missions or OpenCode sessions complete/failed.
  • mission_mutated=false is persisted and rendered.

No-researchdb-ingestion guarantee

  • Result reviews never write or ingest research.db data.
  • research_db_written=false is persisted and rendered.

No-checkpoint/follow-up-mission guarantee

  • Result reviews never create checkpoints or follow-up missions.
  • checkpoint_created=false and followup_mission_created=false are persisted and rendered.

No-provider/no-OpenCode-prompt/no-process-control guarantees

  • provider_called=false is persisted and rendered.
  • No MiniMax/provider/MCP/online research calls are made.
  • No OpenCode prompt is sent, no extra OpenCode session is launched, and no pause/resume/stop/kill process control occurs.

Authority registry update

  • Adds 9O authority records for review preview/dry-run/read commands as safe_read and non-dry review as metadata write.
  • Notes explicitly state that accepted means accepted as evidence for future ingestion, not project-state mutation.
  • Covers short aliases, including /result-review-show, in the registry/whitelist consistency check.

Targeted validation output

cd agentcore/runtime && bun test && bun run typecheck

 626 pass
 0 fail
 4890 expect() calls
Ran 626 tests across 2 files. [46.20s]
$ tsc --noEmit

cd agentcore/tui && bun test && bun run typecheck

 276 pass
 0 fail
 3679 expect() calls
Ran 276 tests across 7 files. [5.50s]
$ tsc --noEmit

uv run pytest tests/integration/cli/test_tui_launcher.py tests/integration/cli/test_tui_entrypoint.py -q
.......                                                                  [100%]
7 passed in 1.37s

uv run pytest tests/e2e_user/scenarios/test_opencode_result_review_tui.py -q
.                                                                        [100%]
1 passed in 42.09s

uv run pytest tests/e2e_user/scenarios/test_command_authority_inventory_tui.py -q
.                                                                        [100%]
1 passed in 76.28s (0:01:16)

uv run pytest tests/e2e_user/scenarios/test_opencode_result_report_tui.py tests/e2e_user/scenarios/test_opencode_wake_action_execution_tui.py tests/e2e_user/scenarios/test_opencode_progress_heartbeat_tui.py -q
...                                                                      [100%]
3 passed in 203.11s (0:03:23)

Full regression status

  • Full historical E2E was not run; the Branch 9O profile only requires the targeted E2E, authority E2E, and affected 9N/9M/9E scenarios unless broad runtime lifecycle, adapter, shared parser/state/snapshot, event-store, research backend, or scheduler behavior changes occur.
  • OpenCode adapter smoke was not run because adapter startup/shutdown and live process-control code were not touched.

Secret/redaction behavior

  • Review text and refs pass through bounded/redacted preview fields.
  • Secret-looking rationale/evidence text is covered by runtime, TUI, and E2E assertions.

Explicit out-of-scope list

  • Research.db writes or ingestion.
  • Research promotion/finding/trial/failure mutation.
  • Mission/proposal/review/apply mutation.
  • Mission/session completion or failure state.
  • Checkpoint creation.
  • Follow-up mission creation.
  • Provider/MiniMax/Commander cycle execution.
  • MCP/online research.
  • OpenCode prompt send, launch/fork/resume, or process pause/resume/stop/kill.
  • Automatic wake action execution or provider-generated review text.

Notes about Branch 9P research.db ingestion / research promotion gate

  • 9O only records explicit bounded review decisions and recommends future ingestion/follow-up commands.
  • Branch 9P should consume accepted-as-evidence review records through a separate explicit ingestion/promotion gate.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review the Branch 9O Commander result review gate

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

Copy link
Copy Markdown

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: e96ded6a23

ℹ️ 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 on lines +499 to +503
"result-review-preview",
"opencode-result-review-dry-run",
"result-review-dry-run",
"opencode-result-review",
"result-review",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add no-start coverage for short review aliases

These new short aliases are whitelisted, but the headless no-start detector in agentcore/tui/src/launch.ts only recognizes /opencode-result-review*, /result-review-packet, and /result-review-summary. When a local/E2E script uses /result-review-preview, /result-review-dry-run, or /result-review as the documented alias for metadata-only inspection/write flows, buildHeadlessSnapshot takes the normal pre-command refresh path and the real client can auto-start the runtime before running a no-start result-review command, which violates the documented result-review metadata no-start behavior and can fail or launch unexpectedly in status-only contexts.

Useful? React with 👍 / 👎.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review the Branch 9O Commander result review gate

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

Copy link
Copy Markdown

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: d038048ad5

ℹ️ 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 on lines +4387 to +4391
return this.opencodeResultReviews
.filter((item) => !reportId || item.report_id === reportId)
.filter((item) => !sessionId || item.session_id === sessionId)
.filter((item) => !launchId || item.launch_id === launchId)
.filter((item) => !decision || item.decision === decision)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Honor all result-review list filters in fake runtime

When the TUI is backed by FakeRuntimeClient, /opencode-result-reviews disposition=..., projection=..., or next_step=... accepts those filters in the command parser but this projection only applies report, session, launch, and decision. In fake/headless runs, filtered review lists can therefore show records that do not match the requested disposition/projection/next step, unlike the real runtime path.

Useful? React with 👍 / 👎.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review the Branch 9O Commander result review gate

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

Copy link
Copy Markdown

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: 91ce403341

ℹ️ 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".

|| trimmed.startsWith("/result-review-dry-run")
|| trimmed.startsWith("/result-reviews")
|| trimmed.startsWith("/result-review-latest")
|| trimmed.startsWith("/result-review-show")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wire the short review-show alias before marking it no-start

When a headless script uses /result-review-show, this no-start detector classifies it as a read-only inspection command, but the alias is not registered in keyboard.ts's runtimeCommands or dispatched in runtime-effects.ts (only /opencode-result-review-show is). In that scenario the parser falls through to treating /result-review-show ... as a user message instead of calling runtime.get_opencode_result_review, which can start/submit work rather than perform the intended read-only review lookup.

Useful? React with 👍 / 👎.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review the Branch 9O Commander result review gate

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

Copy link
Copy Markdown

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: 9bb2f84e4d

ℹ️ 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 on lines +7673 to +7674
const opencodeResultReviewGateCommands = new Set([
"opencode-result-review-preview",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Route gate command failures to result-review state

These new gate commands are added to a separate set, but the error catch path still only calls isOpenCodeResultReviewEffect, which checks the old packet command/effect set and records failures on the legacy opencodeResultReview/generic runtime error state. When a user mistypes args such as /result-reviews limit=abc or the runtime throws while handling /opencode-result-review, opencodeResultReviews.commandError is never populated, so the new result-review panel does not surface or clear the failure consistently with the command.

Useful? React with 👍 / 👎.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review the Branch 9O Commander result review gate

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

Copy link
Copy Markdown

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: 19892dad78

ℹ️ 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".

const raw = optional(value)
if (!raw) return fallback
if (["none", "prepare_research_ingestion", "request_revision", "request_followup", "ask_commander_question", "escalate_to_human", "inspect_artifacts", "inspect_tests"].includes(raw)) return raw as OpenCodeResultReviewNextStep
return "unknown"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject invalid result-review next steps

When an operator supplies an unsupported next_step on /opencode-result-review (for example a typo like next_step=prepare-research-ingest), this returns unknown and buildPreview does not add any blocker, so a non-dry review can be durably recorded with next_step=unknown. That silently drops the expected recommendation for cases like decision=accepted and makes list/summary filtering by next step inaccurate; invalid explicit next steps should fail closed, with the default used only when the field is omitted.

Useful? React with 👍 / 👎.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review the Branch 9O Commander result review gate

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 2d11e74711

ℹ️ 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".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant