Skip to content

[codex] test: cover codex runtime plan observability - #71201

Closed
100yenadmin wants to merge 3 commits into
openclaw:mainfrom
electricsheephq:contract-first/runtime-plan-observability
Closed

100yenadmin wants to merge 3 commits into
openclaw:mainfrom
electricsheephq:contract-first/runtime-plan-observability

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #71096 and RFC #71004. This PR adds Codex app-server test coverage proving existing llm_output hooks preserve RuntimePlan observability identity: canonical resolvedRef plus separate harnessId.

No production runtime behavior changes.

RuntimePlan Package Context

This is the observability rung in the RuntimePlan package. The original Pi/Codex shift made backend choice hard to see when display names collapsed to model-only strings. This PR locks the existing event payload so future adapter changes cannot drop the resolved backend/model/harness identity.

flowchart TD
  RFC["#71004 RFC"] --> Base["#71096 RuntimePlan merged"]
  Base --> Contract["#71196 leaf-safe contracts"]
  Contract --> Adoption["#71197 RuntimePlan forwarding proof"]
  Adoption --> This["#71201 observability event coverage"]
  This --> ToolPolicy["#71220 shared tool policy"]
  ToolPolicy --> Harness["#71222/#71238 Harness V2 lifecycle"]
  ToolPolicy --> Transcript["#71223 transcript resolver"]
  Transcript --> Alias["#71224 embedded-runner alias"]
  Harness --> Outcome["#71239 shared outcome classifier"]
Loading

Review package links: #71196, #71197, #71201, #71220, #71222, #71223, #71224, #71238, #71239.

Why This PR Exists

RuntimePlan already computes observability identity. Codex app-server emits llm_output from more than one path, so this PR makes both success and failure-path event emission prove they carry the plan-owned identity instead of recomputing or silently dropping it.

Local Architecture

sequenceDiagram
  participant Plan as AgentRuntimePlan
  participant Codex as Codex app-server attempt
  participant Hook as llm_output hook

  Plan->>Codex: observability.resolvedRef + harnessId
  Codex->>Hook: success-path llm_output includes fields
  Codex->>Hook: turn/start failure llm_output includes fields
Loading

What Changed

  • Builds an AgentRuntimePlan in the Codex app-server run-attempt tests.
  • Asserts llm_output receives resolvedRef from RuntimePlan observability.
  • Asserts llm_output receives separate harnessId: "codex".
  • Covers both normal completion and turn/start failure emission paths.

Maintainer Review Guide

  • Highest-signal file: extensions/codex/src/app-server/run-attempt.test.ts.
  • Check that the test proves RuntimePlan observability is forwarded rather than reconstructed from fallback provider/model fields.
  • Check that both llm_output emission sites remain covered.
  • This is test-only and intentionally does not change event wire format.

What Did Not Change

Verification

  • ./node_modules/.bin/vitest run extensions/codex/src/app-server/run-attempt.test.ts --config test/vitest/vitest.extensions.config.ts
  • ./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json extensions/codex/src/app-server/run-attempt.test.ts
  • git diff --check

Local broad pnpm check:changed has previously hit unrelated repository type/dependency drift; this PR is test-only and the focused Codex app-server suite is the merge signal.

@100yenadmin
100yenadmin marked this pull request as ready for review April 24, 2026 18:59
Copilot AI review requested due to automatic review settings April 24, 2026 18:59
@greptile-apps

greptile-apps Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This test-only PR adds observability assertion coverage to the existing Codex app-server llm_output hook test, proving that resolvedRef and harnessId are correctly propagated from a real AgentRuntimePlan through the hook payload. No production code is changed.

Confidence Score: 5/5

Safe to merge — test-only change with correct assertion values validated against the production buildAgentRuntimePlan implementation.

All changes are confined to the test file. The asserted values (resolvedRef: "codex/gpt-5.4-codex", harnessId: "codex") match what buildAgentRuntimePlan's observability block computes via formatResolvedRef and the conditional harnessId spread. No P0 or P1 findings.

No files require special attention.

Reviews (1): Last reviewed commit: "test: cover codex runtime plan observabi..." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds regression coverage in the Codex app-server attempt hook test to ensure llm_output events include RuntimePlan observability identity fields, preventing future adapter changes from silently dropping them.

Changes:

  • Builds an AgentRuntimePlan in the Codex app-server attempt test params.
  • Updates the llm_output hook expectation to include resolvedRef and harnessId.

Comment on lines 418 to +425
expect(llmOutput).toHaveBeenCalledWith(
expect.objectContaining({
runId: "run-1",
sessionId: "session-1",
provider: "codex",
model: "gpt-5.4-codex",
resolvedRef: "codex/gpt-5.4-codex",
harnessId: "codex",

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

The new resolvedRef assertion doesn’t currently prove the runtime-plan value is being forwarded, because the fallback in runCodexAppServerAttempt also uses ${provider}/${modelId} (same value as buildAgentRuntimePlan produces for these params). To ensure this test actually guards against adapters dropping/overriding RuntimePlan observability, consider overriding runtimePlan.observability.resolvedRef to a sentinel value (or otherwise making it differ from the fallback) and assert that sentinel reaches llm_output.

Copilot uses AI. Check for mistakes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@100yenadmin 100yenadmin changed the title test: cover codex runtime plan observability [codex] test: cover codex runtime plan observability Apr 25, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@100yenadmin

Copy link
Copy Markdown
Contributor Author

Superseded by #71722, which consolidates the RuntimePlan/Harness package into one review PR and preserves this PR's commits via cherry-pick -x. Keeping this PR as review/history evidence.

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 channel: whatsapp-web Channel integration: whatsapp-web extensions: codex extensions: memory-core Extension: memory-core size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants