← Back to Pull requests

feat(cli): run aligned with the new session dialog, chat new (3/5) #340

Closed
unknown closed this pull request without merging on Nov 06, 2026 02:05 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 18:42 UTC
Author

Summary

Third implementation PR of add-agent-shell-control (stacked on #339). Scope: tasks.md §2A. CLI only — no server, contract or UI change.

webmux run (US-S07)


  • Location like the Web UI dialog: the current directory's registered worktree is associated automatically; --worktree REPO:WORKTREE|PATH (with --cwd checked to stay inside); --new-worktree BRANCH with --base, --existing-branch, --worktree-path, --repo, --refresh-base. New worktrees are pinned to the home page like the web does (--no-pin); a failed session keeps the worktree and names it.

  • Hybrid start: --start-side terminal|chat, --prompt TEXT|-, --init.

  • Scripting: --json ({session, link}), --wait STATE --timeout DUR (124 on timeout), --label, --dry-run (env values shown as <inherited>/<explicit>).

  • No terminal → detach with a note on stderr; --attach insists (exit 2). This changes the old behaviour of exiting 2.

  • --follow: observer stream to stdout (--strip removes control sequences), exits with the program's status (128+N for signals); SIGINT/SIGTERM only stop following (130/143) unless --kill-on-interrupt.
  • webmux chat new / launch-config options (US-S08)


  • Quick Start from the shell: repository from the current directory, --agent (or the only hybrid config), generated wt/<date>-<time> branch redrawn on conflict, default base, --set, --permission, --init/--no-init, --attach (uploaded first), --terminal, --label. Failures report the step and what was created, nothing is rolled back.

  • --wait tracks the first turn and prints the agent's final reply; end_turn → 0, other stops or an open permission/form request → 1 (--auto-wait-requests keeps waiting).

  • launch-config options NAME lists the agent's options for --set.
  • Shared helpers (reused by 4/5 and 5/5)


    Session-list waits (--changed/--stable/--any ready for wait), observer follow, a streaming control-sequence stripper, chat turn tracking, repository/worktree resolution and home-pin writes with revision-checked retries.

    Deviations from the spec (spec updated in this PR)


  • No --no-workspace: the server associates sessions by launch directory anyway, so it could not be honoured.

  • --follow does not resume after a dropped connection; it exits 1 and points to webmux attach.
  • Verification


  • New end-to-end tests in cmd/webmux/launch_test.go against a real server process: --follow --strip output and exit status, WEBMUX_SOCKET/WEBMUX_BIN inside the session, --wait exited and timeout 124, auto-detach, --dry-run, parent recorded for a session created from inside a session, worktree association/creation/pinning, chat new --wait and launch-config options against the fake ACP agent.

  • go test -race for internal/sessioncmd, cmd/webmux, internal/archtest, internal/localclient, internal/agentguide; go vet ./...; golangci-lint v2.15.0; Windows cross-compile; darwin vet.
  • User stories


    US-S07, US-S08 added; US-M01 points to them; coverage index and verification log updated. Guide topics launch and recipes updated; command reference regenerated.

    ---
    _Generated by Claude Code_

    Diff: 408 lines (+306 / -102) across 5 files Reviewer: mzdluo123 Review duration: 442m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 408 lines diff across 5 files
    0.45
    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.360
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #340"
    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: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    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: 17.7% · Safe to merge
    17.7%