← Back to Pull requests

fix(cli): correct signed-out context guidance #3183

Closed
unknown closed this pull request without merging on Oct 23, 2026 05:42 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 03:25 UTC
Author

Summary

ployz ctx now suggests ployz login only when signed out with no selected context, PLOYZ_CONTEXT, --connect, or visible local socket. A Directory Link that selects a Project keeps main's hint when a Server route exists. A missing, inaccessible, or uncheckable local socket leaves no usable local route.

signed out + no Server route -> next: ployz login
other states                 -> main's existing hint decision

organization = no one becomes organization = (none: not signed in). The existing JSON organization remains null in that state. The earlier credential field is still device, token, local, or null. servers.local_socket_exists remains true only when the socket is visible and false otherwise. The new additive servers.local_socket_status is visible, missing, permission_denied, or unknown; servers.via keeps its existing route value. A permission error now says can't read the local daemon socket; run with sudo or join the ployz group instead of claiming the socket is absent. The installer names the group ployz and creates /run/ployz with mode 0750.

Relative to main, next changes only when signed out and no Server route is available, with or without a selected Project. With a selected context, PLOYZ_CONTEXT, --connect, a visible local socket, a token, or a stored sign-in, the hint remains exactly as main chose it. No exit codes, refusals, or warnings change.

Design bets touched in core/DESIGN.md are 8. Evidence over claims, which replaces an unconditional local route claim with socket evidence and preserves permission errors, and 10. Client-first, daemon when forced, which keeps this display decision in the CLI. The Stable promise stays intact with additive CLI JSON fields and no wire, RPC, or persisted schema changes.

Closes #2876.

Evidence

Before the fix, focused ctx_show tests showed the wrong hints and organization text.

test signed_out_with_direct_connection_keeps_the_link_hint ... FAILED
  left: "next: ployz login\n"
 right: "next: ployz link --project PROJECT\n"
test signed_out_with_a_project_and_standalone_context_has_no_hint ... FAILED
  left: "next: ployz login\n"
 right: ""
test signed_out_ctx_names_no_one_and_login ... FAILED
  organization = no one
test result: FAILED. 3 passed; 3 failed

After the fix, cargo test -p ployz --test ctx_show passes 6/6, including PLOYZ_CONTEXT, stored device sign-in, token JSON, and a linked Project. cargo test -p ployz --lib local_socket_check_distinguishes_visibility_and_permission passes 1/1 with deterministic visible, missing, permission-denied, and unknown socket results. cargo clippy -p ployz --all-targets and cargo fmt --check pass.

The built CLI with no sign-in, token, context, connection, or local socket exits 0. Before:

organization = no one
project = (none)
environment = (none)
servers = (none: no local daemon socket)
next: ployz login

After:

organization = (none: not signed in)
project = (none)
environment = (none)
servers = (none: no local daemon socket)
next: ployz login

The built CLI with a Directory Link to Project shop and selected standalone context lab exits 0. Before:

organization = no one
project = shop (link)
environment = production (link)
servers = via context lab
next: ployz login

After:

organization = (none: not signed in)
project = shop (link)
environment = production (link)
servers = via context lab

The signed-out no-route JSON still has organization: null, credential: null, and servers.via: "local". It has servers.local_socket_exists: false, servers.local_socket_status: "missing", and next: "ployz login".

Merge danger

Door: Two-way.

Blast radius: CLI ctx output only. Socket presence is not a daemon liveness check. The pre-existing case where a config file has no current context and ctx reports via local is out of scope for this PR.

Diff: 498 lines (+373 / -125) across 6 files Reviewer: nick-potts Review duration: 137m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.47) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 498 lines diff across 6 files
0.47
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%
56%
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.372
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3183"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% 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: 47.5% (MEDIUM) · Higher = larger blast radius
47.5%
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: 56.8% · Lower = rushed or shallow review
56.8%
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