refactor(cli): consume the assembled product runtime - #1553
Merged
Conversation
limityan
force-pushed
the
yanzhn/cli-runtime-cutover-pr2
branch
from
July 15, 2026 01:26
e81754f to
1501392
Compare
Route local CLI execution, management, session, and usage paths through one invocation-scoped runtime context while preserving Core ownership. Harden approval, scheduling, event, persistence, and usage invariants required by the cutover, with focused compatibility documentation and tests.
limityan
force-pushed
the
yanzhn/cli-runtime-cutover-pr2
branch
from
July 15, 2026 04:33
1501392 to
17d9be1
Compare
limityan
marked this pull request as ready for review
July 15, 2026 04:34
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
exec, management, session, and usage paths through one invocation-scoped CLI product runtime assembled fromDeliveryProfile::Cli, typed runtime services, and the Agent Runtime SDK.--auto, one-resultjson, and existing-envelopestream-json.User-visible contract
Allow once, runtime-scopedAllow always, orReject; no global configuration is rewritten.execpermissions--autoapproves for this invocation only; hidden legacy--confirmmaps to the safe default.execdoes not exposeAskUserQuestion. The existinguser_input_availablefact follows Task, SessionMessage, and automated reply turns so child agents cannot wait for a missing input handler.jsonstream-jsonAgenticEventEnvelopeas JSONL; no CLI-specific event schema, schema version, or second taxonomy is introduced.Ctrl+C, unsuccessful terminal events, event lag/closure, and session-correlated system errors settle as explicit non-success outcomes.Scope boundary
peer-device-mode.mdare byte-equivalent tomainin the effective diff. They remain the second PR.DialogSubmissionPolicyretains its existing three-field wire shape; CLI confirmation is derived and norequireToolConfirmationfield is serialized.Adversarial review
Independent architecture and product reviews were repeated against the final effective diff. Final result: P0 = 0, P1 = 0, necessary P2 = 0.
Review-driven fixes include:
AskUserQuestionimmediately for non-interactive execution and preserve that fact across child and reply turns.(session_id, turn_id)lineage, including explicit child links, and report unverifiable legacy coverage as partial.Regression evidence
Functionality and compatibility
cargo +nightly test -p bitfun-cli— 94 passedcargo +nightly test -p bitfun-agent-runtime— 209 unit tests plus all contract/doc tests passedcargo +nightly test -p bitfun-core— full suite passedcargo +nightly test -p bitfun-core-types -p bitfun-runtime-ports -p bitfun-services-core— full suites passedpnpm --dir src/web-ui run test:run— 248 files / 1,525 tests passedpnpm run type-check:web— passedpnpm run lint:web— 0 errors; 11 existing non-blocking warningscargo +nightly check --workspace— passed on Windowsnode scripts/check-core-boundaries.mjs— passedcargo +nightly fmt --check,git diff --check— passedAn earlier workspace-wide test run encountered one unchanged HTTP integration flake. The exact test passed 20/20 reruns and its package passed 286/286 serially; no production or test code was changed for it.
Startup regression check
Debug binaries were measured with isolated storage and 200 interleaved warm samples per binary. This is a relative regression check, not a production benchmark.
mainmedian / p95--helpdoctorDebug binary size changed from 124,908,544 to 125,838,336 bytes (+0.74%). The measured deltas are within process-start noise; no material startup regression was observed.
Agent-effect boundary
The effective diff contains no agent definition, prompt, AI adapter, provider, or tool-manifest changes. The CLI SDK path delegates to the same Core coordinator, scheduler, registry, and tool pipeline, and non-interactive child turns now preserve the same input-availability fact.
These static and contract checks do not prove statistical equivalence of real-model answers, tool-choice probability, round count, token use, or provider latency. Repeated credentialed model evaluation and PTY flows remain follow-up validation, not claims made by this PR.
Follow-up PR
The second PR owns the coordinated Peer/Relay/Desktop/Web cutover and its protocol, controller-generation, reconnect, and mixed-version release risks. None of those changes are part of this PR.