← Back to Pull requests

feat(cli): send, wait, logs, screen, events, api, completion (4/5) #341

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

Summary

Fourth implementation PR of add-agent-shell-control (stacked on #340). Scope: tasks.md §2 (except 2.7, done in 2/5), §1.4 and §7.4. CLI only.

  • send SESSION [TEXT|-] [--enter] [--key NAME]... (US-S09): one acknowledged submission (exit 0 only on written), then named keys (enter esc tab ctrl-c ctrl-d up down left right backspace). It takes control like browser typing, labelled script (plus the source session inside one). --wait STATE subscribes before sending, so a stale idle cannot end the wait. Chat-side hybrid sessions are refused with a pointer to chat send.

  • wait SESSION... --until STATES with --changed, --stable, --any, --timeout (124), --json.

  • logs (US-S10): raw buffer, --strip, --tail N, or --follow as an observer. screen renders the replay with the xterm-go/vt emulator the server's preview already uses — client side, no server emulation, no new dependency — and prints plain text or --json {cols, rows, cursor, altScreen, lines}.

  • events (US-S11): /ws/sessions as NDJSON, --session filter, reconnects with a new snapshot. api: raw /api/ and /local/v1/ requests (JSON body, WebSocket paths refused). kill, rm, rename.

  • completion bash|zsh|fish + hidden __complete (US-S12): commands, options, enum values and live session IDs/launch configs/repositories/worktrees/topics, 1 s timeout, silent without a server.

  • Guide topics sessions and recipes cover the new commands; command reference regenerated.
  • Spec adjustments in this PR


    screen drops --ansi (plain text only) and reuses xterm-go/vt instead of a new library (design D15); logs --tail and --follow are mutually exclusive.

    Verification


  • cmd/webmux/control_cli_test.go against a real server: api (raw, /ws/ refused, invalid JSON, 404), send + logs round trip, --tail, unknown key, send --wait exited --json reading the exit code, wait (current state, timeout 124, --changed not satisfied by an old state), screen text and JSON of a full-screen paint, first events line is the snapshot, rename/kill/rm, completion candidates incl. live session IDs.

  • The generated bash completion is sourced in a real bash and COMPREPLY checked (fish/zsh are not installed here; the fish case runs when available).

  • 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-S09–US-S12 added; coverage index and verification log updated.

    ---
    _Generated by Claude Code_

    Diff: 338 lines (+253 / -85) across 4 files Reviewer: mzdluo123 Review duration: 439m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 338 lines diff across 4 files
    0.42
    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.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #341"
    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: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    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: 16.7% · Safe to merge
    16.7%