Skip to content

feat: execute local runtime through daemon executor - #427

Merged
delete-cloud merged 2 commits into
mainfrom
dogfood/local-daemon-runtime-ownership
Jun 2, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
dogfood/local-daemon-runtime-ownership

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jun 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add LocalDaemonRuntimeExecution and LocalDaemonExecutor.execute_runtime
  • inject LocalDaemonExecutor into SessionManager
  • route local run_agent runtime invocation through LocalDaemonExecutor while preserving existing lifecycle behavior
  • add focused executor and SessionManager coverage plus PR-6 task packet

Tests

  • uv run pytest tests/coding_agent/test_local_daemon_executor.py tests/coding_agent/test_run_coordinator.py tests/coding_agent/test_run_target.py -v
  • uv run pytest tests/ui/test_session_manager_runtime.py -v
  • uv run ruff check src/coding_agent/executors src/coding_agent/runs src/coding_agent/server/session_manager.py tests/coding_agent/test_local_daemon_executor.py tests/coding_agent/test_run_coordinator.py tests/coding_agent/test_run_target.py tests/ui/test_session_manager_runtime.py
  • uv run basedpyright src/coding_agent/executors src/coding_agent/runs tests/coding_agent/test_local_daemon_executor.py tests/coding_agent/test_run_coordinator.py tests/coding_agent/test_run_target.py
  • git diff --check

Notes

  • this intentionally moves only the runtime invocation boundary; full pipeline/context/adapter preparation remains in SessionManager for the next ownership slice.

Summary by CodeRabbit

  • New Features

    • Introduced pluggable local daemon executor support for executing runtime turns.
    • SessionManager now routes runtime execution through the configured local daemon executor when applicable, while preserving existing lifecycle and storage behavior.
  • Tests

    • Added comprehensive tests for runtime execution through the local daemon executor, including target validation and error cases.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@delete-cloud, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 17 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c6da0b0c-2711-487c-85c1-17ba44441f7c

📥 Commits

Reviewing files that changed from the base of the PR and between 5096df9 and 6c97821.

📒 Files selected for processing (1)
  • coding-agent/tests/ui/test_session_manager_runtime.py
📝 Walkthrough

Walkthrough

This PR implements runtime-invocation ownership by routing local runtime turns through a pluggable LocalDaemonExecutor. The changes introduce runtime-execution types, enhance the executor with a new execute_runtime() method, wire the executor into SessionManager, refactor runtime request submission to support conditional routing, and add comprehensive unit and integration tests.

Changes

Local Runtime Invocation Ownership via LocalDaemonExecutor

Layer / File(s) Summary
Runtime execution contract and types
src/coding_agent/executors/local_daemon.py, src/coding_agent/executors/__init__.py
Introduces RuntimeTurnCallable type alias and LocalDaemonRuntimeExecution frozen dataclass to package a RunRequest with an awaitable runtime callable; exports both from the executors module.
LocalDaemonExecutor.execute_runtime() implementation
src/coding_agent/executors/local_daemon.py
Adds execute_runtime() method to validate the request target and await the runtime callable; refactors submit_run() to validate request target before building submission; adjusts validation to raise RunExecutorTargetError for non-local-daemon workspace types.
LocalDaemonExecutor unit tests
tests/coding_agent/test_local_daemon_executor.py
Tests execute_runtime() with positive case (callable runs and returns result) and negative case (raises RunExecutorTargetError for non-local-daemon executor targets).
SessionManager executor injection and conditional routing
src/coding_agent/server/session_manager.py
Adds optional local_daemon_executor constructor parameter; wires it into DefaultRunCoordinator; refactors _submit_runtime_run_request() to return RunRequest instead of submitting; conditionally executes runtime through executor for local-daemon targets or directly through adapter otherwise.
SessionManager integration tests
tests/ui/test_session_manager_runtime.py
Introduces RecordingLocalDaemonExecutor test helper to capture execution instances; verifies run_agent() routes local-bound runtime execution through the configured executor with expected request attributes and runtime store lifecycle transitions.
Task specification document
.opencode/prompts/tasks/local-daemon-pr6-runtime-invocation-ownership.md
Documents the slice scope, goal, in-scope and out-of-scope items, context references, verification commands, and operational constraints.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#422: Introduces the run-target architecture and LocalDaemonExecutorRef that this PR builds upon for conditional routing through local-daemon executor references.

Poem

🐰 A daemon awaits each runtime call,
Request and callable, bundled in thrall,
SessionManager now chooses its way—
Through executor or adapter at play,
Local invocations owned, come what may! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: executing local runtime invocation through the daemon executor, which aligns perfectly with the PR's primary objective of routing SessionManager.run_agent() runtime calls through LocalDaemonExecutor.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dogfood/local-daemon-runtime-ownership

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
coding-agent/tests/ui/test_session_manager_runtime.py (1)

650-716: ⚡ Quick win

Add a non-local regression case while local_daemon_executor is injected.

This only proves the LocalDaemonExecutorRef branch. A bug that routes every runtime through local_daemon_executor whenever one is configured would still pass here, because the existing non-local tests in this file never inject one. Please add a companion case with a cloud or external binding and assert RecordingLocalDaemonExecutor.executions stays empty.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/tests/ui/test_session_manager_runtime.py` around lines 650 -
716, The current test only covers execution with LocalExecutionBinding,
exercising the LocalDaemonExecutorRef branch. Add a new test case that uses a
cloud or external ExecutionBinding instead of LocalExecutionBinding while
injecting RecordingLocalDaemonExecutor to ensure no executions are routed
through it incorrectly. After running the agent, assert that
RecordingLocalDaemonExecutor.executions remains empty to verify the code does
not misroute non-local runtimes through the local daemon executor.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@coding-agent/tests/ui/test_session_manager_runtime.py`:
- Around line 650-716: The current test only covers execution with
LocalExecutionBinding, exercising the LocalDaemonExecutorRef branch. Add a new
test case that uses a cloud or external ExecutionBinding instead of
LocalExecutionBinding while injecting RecordingLocalDaemonExecutor to ensure no
executions are routed through it incorrectly. After running the agent, assert
that RecordingLocalDaemonExecutor.executions remains empty to verify the code
does not misroute non-local runtimes through the local daemon executor.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 38fb0d66-50d2-400f-adc1-463b3f42f302

📥 Commits

Reviewing files that changed from the base of the PR and between cfb99c6 and 5096df9.

📒 Files selected for processing (6)
  • coding-agent/.opencode/prompts/tasks/local-daemon-pr6-runtime-invocation-ownership.md
  • coding-agent/src/coding_agent/executors/__init__.py
  • coding-agent/src/coding_agent/executors/local_daemon.py
  • coding-agent/src/coding_agent/server/session_manager.py
  • coding-agent/tests/coding_agent/test_local_daemon_executor.py
  • coding-agent/tests/ui/test_session_manager_runtime.py

@delete-cloud
delete-cloud merged commit de9d6bf into main Jun 2, 2026
1 check passed
@delete-cloud
delete-cloud deleted the dogfood/local-daemon-runtime-ownership branch June 2, 2026 14:51
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