← Back to Pull requests

feat(cli): add session-based run interaction #6133

Closed
unknown closed this pull request without merging on Oct 19, 2026 08:41 UTC
View on GitHub
unknown unknown commented on Oct 16, 2026 09:21 UTC
Author

Summary

A supervising agent cannot currently answer a headless Maka AskUser and continue the same Turn: the blocking CLI stops it instead. This change returns the questions as needs_input with exit code 0, leaves the Host Turn waiting, and lets a later CLI invocation answer it and receive the original Turn result.

  • Add Session wait/status/result, AskUser answers, sandbox approve/deny, queue/steer, safe resume, explicit stop, structured output, and nonblocking submission. Reuse existing Host operations, subscriptions, and durable results; no Host, Runtime, or protocol changes.

  • New --session controls inherit saved permissions without requiring another --yolo. Only explicit --yolo elevates access, after action preflight checks. Status shows the actual executionBoundary, so inheriting bypass cannot be mistaken for an enforced read-only task. Preserve the legacy blocking --resume <id> confirmation, limits, Graph completion, and cancellation behavior.

  • Nonblocking receipts distinguish submission: started/queued/steering from the currently observed Session status. A queued receipt can carry the predecessor's AskUser or sandbox request. Omit queue counts until the projection reaches the admitted epoch/revision rather than publishing a stale count. Status also exposes Host-published provider retry information.

  • Detached admission leaves early questions/approvals pending for Session controls. Completed status/control queries retain structured receipts; ordinary provider failures honor --json with the Session ID and diagnostic. Session result replay recognizes a successful same-tool/same-argument retry in a later step while preserving unrelated unresolved sandbox failures and the blocking denial policy.

  • Handle assistant Inbox admission as submission: "inbox" without a worker result, queue count, or worker-Turn wait; retain existing worker queue/steer semantics.

  • Bundle skills/maka-cli and English/Chinese usage guidance. For coordination, submit with --queue --no-wait and service Session wait/answer interactions. --queue --wait retains exact-message result tracking; it does not hand off a predecessor's question. Result reads remain final-result queries, not progress streams.
  • Changes are limited to packages/cli and skills/maka-cli. Sandbox approval requires exactly one pending request, continues its original Turn/Run, and expands the saved managed boundary without switching to bypass. A response with an uncertain outcome is not automatically retried. Unsupported permission/form interactions can be handled in an interactive client or stopped explicitly.

    Client-owned MCP continuation across CLI exits and Graph question handoff remain unsupported. Blocking MCP behavior is preserved; nonblocking submission refuses to detach invocation-owned MCP servers. Local temporary npx execution retains the blocking path because it can own the Host lifetime. Ordinary blocking runs still wait by default, except built-in AskUser returns a structured handoff: scripts must inspect status rather than interpret exit 0 alone as final completion.

    Verification

  • Full repository build/typecheck and 198 affected tests pass against the integrated main branch: argument/process contracts, adapter, Session selection/driver, MCP, bootstrap, policy, and real Host with separate CLI processes.

  • Real-Host regressions cover original Turn/Run preservation across AskUser and sandbox decisions, distinct queued Turns and their exact results, steering, stop/recovery, status exit codes, provider error preservation, and Ctrl+C during an in-flight admission read.

  • Permission regressions verify rejected answer/count/resume/step-cap actions do not elevate access, and new Session controls continue an existing bypass Session without another flag or boundary revision change. Admission receipts distinguish queued work and current questions without a stale pre-admission count.

  • Inbox admission regression checks both wait and no-wait, forbids waiting for a worker identity, and prevents returning a prior Turn result.

  • Review regressions cover early interaction delivery before admission returns, completed status/control output without --json, and ordinary terminal failure JSON. The real-Host sandbox scenario now includes an initial failed Fetch and its successful retry after approval; wait and subsequent result agree. Negative cases retain same-step, different-tool/argument, missing-evidence and additional unresolved failures. Replacing the classifier with its previous implementation fails both the real-Host recovery and focused positive regression.

  • Simulated decision-response loss after Host acceptance dispatches once and leaves the next request unanswered. Counterfactual pre-feature CLI modules fail the new sandbox handoff regression as expected.

  • Linked CLI was also exercised with a real subscription-backed provider: AskUser, read-only review instructions, queue admission, answer, and final result. Before the permission change the same Session rejected queue/answer without --yolo; afterward new task/queue/answer all succeeded without repeating it, with boundary revision unchanged and separate results preserved.

  • Changed TypeScript passes Biome; ASF headers and git diff --check pass. Skill validation/discovery and all 13 command examples pass. Full repository tests and native Windows/macOS runs were not performed; hosted CI status is reported by GitHub checks.
  • AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: Codex assisted with design, source review, implementation, documentation, and tests. Commits include a Generated-by: Codex trailer. This PR description was prepared with Codex.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: chinawch007 Review duration: 4279m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6133"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository