Skip to content

refactor(runtime): remove unused AgentRun execute path - #3043

Merged
Astro-Han merged 2 commits into
mainfrom
refactor/3034-remove-agent-run-execute
Aug 15, 2026
Merged

Astro-Han merged 2 commits into
mainfrom
refactor/3034-remove-agent-run-execute

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Remove AgentRun.execute(), an unused test-only path that reconstructed AiSdkFlow outside RuntimeKernel.
  • Keep RuntimeKernel as the sole production execution authority.
  • Preserve projection-failure and normal tool-mode coverage at their production boundaries while removing duplicate and ineffective test guards.

Fixes #3034

Verification

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/session-manager-terminal-ledger.test.js — 39 passed
  • node --test dist/__tests__/session-manager.test.js — 220 passed
  • npm --workspace @maka/runtime run typecheck
  • npx biome check packages/runtime/src/agent-run.ts packages/runtime/src/__tests__/session-manager-terminal-ledger.test.ts packages/runtime/src/__tests__/session-manager.test.ts

The branch was rebased onto the latest main before running these checks. The full repository test suite was not run locally; repository-wide coverage is left to CI.

Review focus

Confirm that removing the internal parallel execution path leaves RuntimeKernel as the single execution authority and that the remaining tests cover production seams without duplicate fixtures. AgentRun is not exported by the private @maka/runtime package, so this does not change a public contract.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex implemented the code and test changes, performed focused verification, and adjudicated review feedback. Claude Opus High and a Codex reviewer agent performed adversarial reviews of the implementation and test coverage. The human contributor of record reviews the final diff and commits and owns the submission, provenance, licensing, and merge decision.

Checklist

  • Tests cover the change and fail without it — the production change is deletion of an unused path; retained behavior is covered through production execution seams rather than by preserving a test-only caller.
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@Astro-Han
Astro-Han marked this pull request as ready for review August 15, 2026 03:59
@Astro-Han
Astro-Han force-pushed the refactor/3034-remove-agent-run-execute branch from 6583c80 to ff4a453 Compare August 15, 2026 12:57
@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Astro-Han, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d135da1-edb3-4ae6-a453-966ecdda4f66

📥 Commits

Reviewing files that changed from the base of the PR and between ff4a453 and c4df956.

📒 Files selected for processing (1)
  • packages/runtime/src/__tests__/session-manager.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 143061f4-b68b-4bc8-9deb-2293bb24094d

📥 Commits

Reviewing files that changed from the base of the PR and between 5774c89 and ff4a453.

📒 Files selected for processing (3)
  • packages/runtime/src/__tests__/session-manager-terminal-ledger.test.ts
  • packages/runtime/src/__tests__/session-manager.test.ts
  • packages/runtime/src/agent-run.ts
💤 Files with no reviewable changes (1)
  • packages/runtime/src/agent-run.ts

📝 Walkthrough

Summary

This PR removes the unused, test-only AgentRun.execute() path. RuntimeKernel remains the sole production execution authority through SessionManager. This prevents test execution from diverging from production execution.

The change extends the existing RuntimeKernel source of truth. It does not create a parallel execution path. Terminal-ledger and tool-mode tests now use production-boundary execution.

The solution is the smallest coherent change. It deletes AgentRun.execute() and its AiSdkFlow and InvocationContext imports. It also removes duplicate test guards and replaces direct AgentRun execution coverage with focused SessionManager coverage. Configurable turn-state failure injection is necessary to verify failed terminal facts when projection fails.

The diff reduces test code by 204 lines. Further deletion is not recommended because the remaining tests cover failed terminal-ledger persistence, failed-turn projection, normal tool mode, session events, and Runtime invocation behavior.

Validation and risks

The PR reports successful Runtime build, typecheck, formatting, and focused tests. The full repository test suite was not run. Required checks remain unverified from direct execution evidence.

The apparent protected-area effect is the removal of the public AgentRun.execute() method. This changes the AgentRun public contract, even though the method was test-only and the objectives state that no externally observable Runtime behavior is intended. Material public-contract changes require independent human review under repository policy.

No security, licensing, release, or governance effect was identified in the current diff. The person performing the merge must review the final diff, and a maintainer makes the final determination.

Walkthrough

Runtime removes the unused AgentRun.execute() path. Terminal-ledger tests now use SessionManager with injectable turn-state failures. Integration tests verify that toolMode: 'code_mode' reaches the backend.

Changes

Runtime execution and validation

Layer / File(s) Summary
Terminal ledger failure coverage
packages/runtime/src/agent-run.ts, packages/runtime/src/__tests__/session-manager-terminal-ledger.test.ts
Removes the unused AgentRun.execute() path. The test harness injects store failures and verifies failed run headers and terminal facts remain committed.
Tool mode propagation coverage
packages/runtime/src/__tests__/session-manager.test.ts
Captures the test backend and verifies that toolMode: 'code_mode' reaches the backend input. Existing event assertions remain.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ff4a4

This PR removes an unused execution path while retaining the production runtime authority and focused validation; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: jackwener, m4n5ter, likun666661

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai Use Disclosure ⚠️ Warning The PR description names Codex and describes substantive work but selects neither required AI-use declaration; both introduced commits contain valid Generated-by: Codex trailers. Update the PR description to select the substantive-contribution option and state Codex's scope. Review CONTRIBUTING.md's Human ownership and AI attribution section for responsibility, provenance, licensing, and tool-output obligations.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: removing the unused AgentRun.execute path.
Description check ✅ Passed The description covers the summary, linked issue, verification, review focus, AI assistance, checklist, and behavior impact.
Linked Issues check ✅ Passed The changes satisfy issue #3034 by removing AgentRun.execute, preserving RuntimeKernel execution, updating coverage, and passing focused validation.
Out of Scope Changes check ✅ Passed The changes remain focused on removing the unused execution path and updating related tests and helpers without changing runtime behavior or public exports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/3034-remove-agent-run-execute

Comment @coderabbitai help to get the list of available commands.

Delete the test-only AgentRun.execute flow so RuntimeKernel remains the sole execution authority.

Move terminal-ledger and tool-mode coverage through SessionManager's production path, and drop duplicated post-terminal coverage.

Refs #3034

Generated-by: Codex
Remove an ineffective terminal-ordering guard, anchor normal tool-mode forwarding at the SessionManager execution boundary, and make failed turn projection injection cover batched writes.

Refs #3034

Generated-by: Codex
@Astro-Han
Astro-Han force-pushed the refactor/3034-remove-agent-run-execute branch from ff4a453 to c4df956 Compare August 15, 2026 13:02
@Astro-Han

Copy link
Copy Markdown
Contributor Author

Fast-path determination (posted by Codex on behalf of @Astro-Han)

@Astro-Han reviewed the final diff and commit messages and chose the self-merge fast path for revision c4df956.

This revision qualifies because:

  • It is low impact: it removes an unused, internal, non-exported AgentRun.execute() path without changing user-visible behavior or a public contract.
  • It is easy to reverse: the implementation and test cleanup are isolated in two atomic commits.
  • It does not affect security, licensing, releases, governance, or another protected review area.
  • Focused Runtime verification and all required CI checks pass.
  • AI implementation and review assistance are disclosed in the PR body and commit trailers.

The human contributor of record accepts responsibility for the final change, provenance, licensing, and merge decision.

@Astro-Han
Astro-Han merged commit b16f3ad into main Aug 15, 2026
12 checks passed
@Astro-Han
Astro-Han deleted the refactor/3034-remove-agent-run-execute branch August 15, 2026 16:50
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.

refactor(runtime): remove the unused AgentRun.execute execution path

1 participant