Align runtime policy and standard turn harness across execution paths#1408
Open
chumyin wants to merge 1 commit into
Open
Align runtime policy and standard turn harness across execution paths#1408chumyin wants to merge 1 commit into
chumyin wants to merge 1 commit into
Conversation
Session-scoped tool policy and standard turn execution had drifted into separate per-surface helpers. This consolidates the session policy overlay behind a typed SessionToolRuntimePolicy, reuses shared result-shaping for the standard runtime path, and adds daemon coverage for turn-checkpoint summary rendering so operator-facing runtime truth stays audited. Constraint: The change had to stay inside the runtime/policy seam and remain isolated from unrelated dirty work in the primary tree Rejected: Broader turn loop / turn coordinator refactor | too wide for this maturity pass and not required to remove the observed drift Confidence: high Scope-risk: moderate Directive: Extend session-scoped runtime policy through SessionToolRuntimePolicy and shared turn helpers before adding new per-surface overlay or result-shaping code Tested: rustfmt --check crates/app/src/tools/runtime_config.rs crates/app/src/conversation/runtime.rs crates/app/src/tools/session.rs crates/app/src/agent_runtime.rs crates/daemon/src/session_runtime_truth_cli.rs Tested: ./scripts/cargo-local-toolchain.sh test -p loong-app session_tool_runtime_policy -- --nocapture Tested: ./scripts/cargo-local-toolchain.sh test -p loong render_turn_checkpoint_summary --lib Tested: ./scripts/cargo-local-toolchain.sh check -p loong-app --lib Tested: ./scripts/cargo-local-toolchain.sh clippy -p loong-app --lib -- -D warnings Not-tested: Full workspace / all-features verification on this machine due disk pressure in /private/tmp during isolated builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Runtime-scoped tool policy and standard turn execution had drifted across multiple surfaces, which made autonomy behavior harder to reason about and increased the risk of per-surface divergence.
The runtime should stay governed and flexible through one coherent policy path, and operator/runtime-truth surfaces need direct coverage when they summarize checkpoint state.
Introduced a typed
SessionToolRuntimePolicy, reused it across conversation bootstrap and session status/runtime surfaces, refactored standard non-ACPagent_runtimeresult shaping through shared helpers, and added explicit turn-checkpoint renderer tests insession_runtime_truth_cli.rs.No broad turn-loop / turn-coordinator redesign, no new config knobs, and no unrelated channel/provider/browser work.
Linked Issues
Change Type
Touched Areas
Risk Track
Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --locked,cargo test --workspace --all-features --locked,task verify,task verify:changed, or equivalent exact commands documented below)Commands and evidence:
Results:
session_tool_runtime_policytests passed in the clean isolated worktree.render_turn_checkpoint_summarydaemon tests passed in the clean isolated worktree.loong-applibrarycheckpassed.loong-applibraryclippy -D warningspassed./private/tmp; this PR intentionally stays on the touched runtime seam.User-visible / Operator-visible Changes
Failure Recovery
Revert this commit if session-policy overlay or runtime-truth summary behavior regresses.
Session tool policy status diverging from conversation bootstrap behavior, or checkpoint runtime-truth summaries changing unexpectedly.
Reviewer Focus
crates/app/src/tools/runtime_config.rs:SessionToolRuntimePolicyshape and semantics.crates/app/src/conversation/runtime.rsandcrates/app/src/tools/session.rs: shared session-policy overlay application.crates/app/src/agent_runtime.rs: standard non-ACP turn helper/result-shaping consolidation.crates/daemon/src/session_runtime_truth_cli.rs: turn-checkpoint renderer coverage and behavior.