[codex] Branch 9N OpenCode result report model#103
Conversation
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f050dd38ec
ℹ️ 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".
| } | ||
|
|
||
| private async findDuplicate(reportHash: string, sessionId: string, launchId?: string): Promise<OpenCodeResultReportRecord | undefined> { | ||
| return (await this.list({ session_id: sessionId, launch_id: launchId, limit: MAX_LIST })).find((record) => record.report_hash === reportHash) |
There was a problem hiding this comment.
Scan all prior reports when deduplicating
When a session/launch has more than 100 result reports, this duplicate check only searches the capped public list, so an identical older report outside the latest 100 records is no longer found and can be appended again. Since result reports are durable executor evidence for later Commander review, duplicate prevention should scan the uncapped event projection for the matching session/launch hash rather than reusing the display limit.
Useful? React with 👍 / 👎.
| wake_execution_id: optional(input.wakeExecutionId ?? input.wake_execution_id ?? input.wake_execution), | ||
| wake_action_execution_id: optional(input.wakeActionExecutionId ?? input.wake_action_execution_id ?? input.wake_action), |
There was a problem hiding this comment.
Honor advertised wake aliases in report input
The runtime client overload advertises wakeExecution and wakeAction as accepted payload aliases, but these reader lines only consume the *Id, snake_case, and lower snake aliases. API callers that supply only wakeExecution or wakeAction therefore get their linked evidence dropped and a preview/record can be blocked as missing session/launch even though the referenced wake record exists.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09210bd7d2
ℹ️ 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 resultKind = readResultKind(input.result_kind, evidence.progress?.kind) | ||
| const disposition = dispositionForKind(resultKind) | ||
| const reviewState = readReviewState(input.review_state, defaultReviewState(resultKind), blockers) |
There was a problem hiding this comment.
Require Commander review for terminal reports
When an operator supplies reviewState=review_not_required with kind=completion_report (or partial/failure/inconclusive/blocked), this call accepts the override and can_record can still remain true. Those non-status result reports are supposed to be executor evidence awaiting Commander review, so persisting them as review_not_required lets later review consumers miss exactly the terminal reports they need to adjudicate.
Useful? React with 👍 / 👎.
| } else throw new Error("OpenCode result report arg is unsupported") | ||
| } | ||
| if (!effect.sessionId && !effect.launchId && !effect.progressId && !effect.watchdogId && !effect.questionId && !effect.guidanceId && !effect.deliveryId && !effect.wakeExecutionId && !effect.wakeActionExecutionId) throw new Error("OpenCode result report requires session=<id>, launch=<id>, or linked evidence") | ||
| if (requireSummary && !effect.summary) throw new Error("OpenCode result report requires summary=<text>") |
There was a problem hiding this comment.
Allow progress-linked reports to use progress summaries
For /opencode-result-report and dry-run commands with only linked progress evidence, this parser throws before the runtime can apply its bounded defaults from the progress record. A user with a completion/failure progress record cannot run /opencode-result-report progress=<id> even though the runtime model supports linked progress supplying omitted report fields, so the TUI/headless surface does not actually mirror the runtime API for that advertised flow.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8163d5825
ℹ️ 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 reviewState = readReviewState(input.review_state, defaultReviewState(resultKind), blockers) | ||
| if (resultKind !== "status_report" && reviewState === "review_not_required") blockers.push("terminal OpenCode result reports require Commander or human review") |
There was a problem hiding this comment.
Keep terminal reports in review queues
When a caller supplies reviewState=unknown or reviewState=not_ready_for_review for a non-status report, readReviewState accepts it and this guard only rejects review_not_required, so a completion/failure/partial report can be recorded without needs_commander_review or needs_human_review. That breaks the terminal-report disposition model and causes opencode_result_report_summary to omit the report from review counts.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review the Branch 9N OpenCode result report model |
1 similar comment
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19ec98627c
ℹ️ 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".
| if (!launch && sessionId) { | ||
| const launches = await this.options.launchGateService.list({ session_id: sessionId, limit: MAX_LIST }) | ||
| launch = launches.find((item) => LAUNCHED_STATUSES.has(item.status)) ?? launches[0] ?? null |
There was a problem hiding this comment.
Resolve the latest launch status before accepting reports
When callers provide only session_id, this selects a launch_started record directly from launchGateService.list(). A failed launch writes both a start event and a later failure event, and the public list can still contain the stale launch_started record for that same launch; in that case the preview/record path treats the session as active and allows a result report even though launchGateService.get(launch_id) would return launch_failed. This should re-resolve the chosen launch id through get() (as the other OpenCode metadata services do) before applying LAUNCHED_STATUSES.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d71e5ba03
ℹ️ 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".
| } | ||
|
|
||
| function fakeResultReviewState(input: string | undefined, kind: string): string { | ||
| if (input === "needs_commander_review" || input === "needs_human_review" || input === "not_ready_for_review" || input === "review_not_required" || input === "unknown") return input |
There was a problem hiding this comment.
Block non-review terminal states in fake reports
When the default fake TUI runtime is used, a terminal command such as /opencode-result-report kind=completion_report review_state=review_not_required ... is accepted because the fake model returns any recognized review state here and only blocks accepted/rejected later. The real result-report service blocks terminal reports unless they are queued for Commander or human review, so the default TUI can record a completion/failure report as review_not_required, bypassing the review-needed safety contract and diverging from real runtime behavior.
Useful? React with 👍 / 👎.
| if (resultKind === "inconclusive_report" && !outcome && followups.length === 0 && knownFailures.length === 0) blockers.push("inconclusive_report requires outcome, followups, or known_failures") | ||
| if (resultKind === "blocked_report" && followups.length === 0 && knownFailures.length === 0) blockers.push("blocked_report requires followups or known_failures") | ||
| if (String(payload.reviewState ?? payload.review_state ?? "").match(/accepted|rejected/i)) blockers.push("accepted/rejected review states belong to a future Commander result review gate") | ||
| const rawValues = [summary, outcome, ...changedFiles, ...testsRun, ...testResults, ...artifacts, ...metrics, ...claims, ...knownFailures, ...followups].filter(Boolean).join("\n") |
There was a problem hiding this comment.
Check fake raw payloads before truncating them
In the fake runtime path, summary and the CSV fields have already gone through preview()/readCsvPayload() before this raw-payload check, so a long log or full diff with markers past the first 160 characters is truncated and can be recorded instead of blocked. Since the real runtime rejects raw result payloads, the default TUI fake client accepts out-of-scope report data and can let user-simulation coverage miss the production validation.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
1 similar comment
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6e7c27338
ℹ️ 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".
| if (sessionId) { | ||
| const session = await this.options.opencodeSessionService.get(sessionId) | ||
| if (!session) blockers.push("session_id does not resolve to a planned OpenCode session") |
There was a problem hiding this comment.
Validate launch-derived sessions before recording
When callers provide only launch_id/launch=<id>, sessionId is still empty here, so the planned-session lookup is skipped; the code then copies launch.session_id later and can record a result report for any orphan/restored/corrupt launch event whose session plan is missing. Since this feature's contract requires a resolvable planned OpenCode session as well as a launch, derive the session from the launch before this check or re-run the session validation after line 166.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
1 similar comment
|
@codex review the Branch 9N OpenCode result report model |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 310ea5e912
ℹ️ 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 LAUNCHED_STATUSES = new Set(["launch_started", "launched"]) | ||
| const RAW_PATTERNS = [ | ||
| /\n.{100,}\n.{100,}/s, | ||
| /(stdout|stderr|traceback|stack trace|bun test v|npm error|diff --git|@@ |\+\+\+ |--- ).{0,120}\n/i, |
There was a problem hiding this comment.
Block all advertised raw payload markers
When a result summary/outcome contains a short provider output, file contents, events.jsonl, or research.db snippet, this regex does not mark it as raw, so /opencode-result-report can persist exactly the payloads the blocker text says are out of scope. The human-control service already blocks these keyword classes; without the same coverage here, bounded-looking raw provider/file/event data can be recorded into opencode_result_report_recorded events instead of being rejected.
Useful? React with 👍 / 👎.
|
@codex review the Branch 9N OpenCode result report model |
1 similar comment
|
@codex review the Branch 9N OpenCode result report model |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Result report model
completion_report,partial_report,failure_report,inconclusive_report,blocked_report,status_report, andunknown.reported_done,reported_partial, andreported_failed.Result disposition/review-state behavior
status_reportdefaults toreview_not_required, unless an explicit review queue is requested.Launch/progress/evidence anchoring behavior
launch_startedorlaunchedstate.Preview/dry-run/record/list/latest/summary behavior
opencode_result_report_recordedevent through the metadata write path.Duplicate behavior
Event persistence/redaction behavior
.nxl/events.jsonlwith bounded/redacted payloads.Fake-vs-real runtime behavior
Runtime commands/API surface
runtime.preview_opencode_result_reportruntime.record_opencode_result_reportruntime.list_opencode_result_reportsruntime.get_opencode_result_reportruntime.latest_opencode_result_reportruntime.opencode_result_report_summaryTUI result-report surface
/opencode-result-report-preview,/opencode-result-report-dry-run,/opencode-result-report,/opencode-result-reports,/opencode-result-report-latest,/opencode-result-report-show, and/opencode-result-report-summary./result-report-preview,/result-report-dry-run,/result-report,/result-reports,/result-report-latest, and/result-report-summary.No-mission-completion guarantee
mission_mutated=falseis persisted and rendered.No-researchdb-ingestion guarantee
research_db_written=falseandcheckpoint_created=falseare persisted and rendered.No-provider/no-OpenCode-prompt/no-process-control guarantees
Authority registry update
/opencode-result-reportand/result-report.Targeted validation output
Full regression status
Secret/redaction behavior
Explicit out-of-scope list
Notes about Branch 9O Commander result review gate