Skip to content

fix: omit non-terminal runtime promotion writes#421

Merged
haasonsaas merged 2 commits into
mainfrom
codex/local-agent-runtime-ledger
May 16, 2026
Merged

fix: omit non-terminal runtime promotion writes#421
haasonsaas merged 2 commits into
mainfrom
codex/local-agent-runtime-ledger

Conversation

@haasonsaas
Copy link
Copy Markdown
Contributor

@haasonsaas haasonsaas commented May 16, 2026

Summary

  • omit dry-run terminal promotion writes when the final local ledger state is still running, waiting, or blocked
  • keep governance decisions from being projected as active wait operations
  • add focused ledger tests for non-terminal and governance promotion behavior

Verification

  • node ./scripts/run-vitest.js --run test/cli/run-command.test.ts test/server/agent-trajectory-replay.test.ts test/server/agent-trajectory-validation.test.ts
  • bunx tsc -p tsconfig.build.json --noEmit

Follow-up to #419 and mirror for evalops/maestro-internal#1974.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 16, 2026

PR Summary

Medium Risk
Changes how dry-run promotion decides whether to emit complete_run/fail_run and how blocked/governance events map into Platform-shaped operations, which can affect run finalization semantics. Coverage is improved with new focused tests, but edge cases in terminal-entry selection could still alter promotion outputs.

Overview
Tightens dry-run AgentRuntime promotion planning to avoid emitting terminal complete_run/fail_run operations unless a substantive terminal ledger entry exists (skipping passive kinds like run/wait/governance and adding explicit warnings when omitted).

Adjusts promotion shaping by not projecting governance events as active waits (waitType now only for wait) and by mapping blocked ledger states to a valid step state for record_run_step (coerced to failed). Adds targeted run-command ledger tests covering non-terminal finals, passive terminal entries, governance behavior, and blocked-state mapping.

Reviewed by Cursor Bugbot for commit 913d84c. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

This PR changes mirrored Maestro source files in the public repo, but it does not link the matching private source-of-truth PR.

Add one of these to the PR body, then re-run the check:

  • https://github.com/evalops/maestro-internal/pull/<number>
  • evalops/maestro-internal#<number>
  • maestro-internal#<number>

Mirrored files touched:

  • src/server/agent-runtime-ledger.ts
  • test/cli/run-command.test.ts

@haasonsaas haasonsaas enabled auto-merge (squash) May 16, 2026 05:38
@haasonsaas haasonsaas force-pushed the codex/local-agent-runtime-ledger branch from 2ca0ce7 to 95f4fd6 Compare May 16, 2026 05:41
Copy link
Copy Markdown

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

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: 95f4fd6d4b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/server/agent-runtime-ledger.ts Outdated
@haasonsaas haasonsaas force-pushed the codex/local-agent-runtime-ledger branch from 95f4fd6 to 3d7a148 Compare May 16, 2026 05:48
Copy link
Copy Markdown

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

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: 913d84c2e9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +291 to 293
if (kind === "wait") {
return "AGENT_RUN_WAIT_TYPE_APPROVAL";
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve wait_run emission for pending governance entries

This change removes waitType for all governance entries, so a policy.decision that maps to status: "pending" (which becomes ledger state waiting) will no longer generate a wait_run operation. That drops the only operation carrying approval-wait semantics (waitType) for those trajectories, so downstream runtime promotion can no longer represent the run as actively waiting for approval even though the ledger step/work item is waiting.

Useful? React with 👍 / 👎.

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