|
| 1 | +# Contextual Diagnostics Assistant Design |
| 2 | + |
| 3 | +> Status: Draft |
| 4 | +> Date: 2026-05-15 |
| 5 | +> Scope: `packages/web/src/features/welcome/index.tsx`, `packages/web/src/features/workspace/views/shared/workspace-launch-modal.tsx`, `packages/web/src/features/workspace/actions/use-workspace-launch-actions.ts`, `packages/web/src/features/agent-panes/actions/use-provider-launcher.ts`, `packages/web/src/features/settings/*`, `packages/web/src/hooks/use-bootstrap.ts`, new `packages/web/src/features/diagnostics/*`, new diagnostics server command surface |
| 6 | +
|
| 7 | +## Goal |
| 8 | + |
| 9 | +Replace the proposed setup-first activation funnel with a quieter diagnostics assistant that only appears when the user is blocked or highly likely to become blocked. |
| 10 | + |
| 11 | +The product should preserve direct paths for users who already know what they want to do. Diagnostics should help recover from failure, repair the environment, and return the user to the original task without turning setup into a mandatory ritual. |
| 12 | + |
| 13 | +## Problem |
| 14 | + |
| 15 | +The current conversion-first activation proposal assumes that all users should enter a dedicated setup flow before the product can deliver value. |
| 16 | + |
| 17 | +That approach conflicts with the desired interaction model: |
| 18 | + |
| 19 | +- setup should not become the default front door |
| 20 | +- users should not be interrupted when their current path is already working |
| 21 | +- diagnostics should feel like a capable assistant, not a funnel |
| 22 | +- the product should help most when the user is stuck, not when they are still exploring |
| 23 | + |
| 24 | +If the product replaces the welcome-page primary action with a setup-first route, it creates new friction for users who simply want to open a workspace or start coding immediately. |
| 25 | + |
| 26 | +## Decision |
| 27 | + |
| 28 | +Reposition setup as a contextual diagnostics assistant instead of a mandatory activation flow. |
| 29 | + |
| 30 | +The new model is: |
| 31 | + |
| 32 | +`User intent -> normal product flow -> blocking/high-risk failure detected -> Diagnostics assistant -> repair -> continue original task` |
| 33 | + |
| 34 | +This changes the role of the feature in four ways: |
| 35 | + |
| 36 | +- it becomes reactive by default, not proactive by default |
| 37 | +- it is triggered by context and user intent, not by first-run status alone |
| 38 | +- it preserves the original user goal instead of replacing it with a new funnel |
| 39 | +- it stays mostly invisible when the environment is already healthy |
| 40 | + |
| 41 | +## Product Principles |
| 42 | + |
| 43 | +### Do Not Interrupt Healthy Flows |
| 44 | + |
| 45 | +If the user can open a workspace, start a session, or continue work normally, diagnostics should stay out of the way. |
| 46 | + |
| 47 | +### Intervene at the Moment of Friction |
| 48 | + |
| 49 | +Diagnostics should appear when the product knows the user is blocked or very likely to fail on the next step. |
| 50 | + |
| 51 | +### Preserve User Intent |
| 52 | + |
| 53 | +The assistant should always remember what the user was trying to do: |
| 54 | + |
| 55 | +- open a workspace |
| 56 | +- start a session |
| 57 | +- continue on phone |
| 58 | + |
| 59 | +The recovery surface exists to complete that task, not to start a separate journey. |
| 60 | + |
| 61 | +### Keep the Surface Small |
| 62 | + |
| 63 | +Diagnostics should not become a generic dashboard or onboarding center. It should be a focused recovery surface with a short list of relevant issues and concrete next actions. |
| 64 | + |
| 65 | +## Entry Strategy |
| 66 | + |
| 67 | +### Welcome Page |
| 68 | + |
| 69 | +The welcome page should keep `Open Workspace` as its primary action. |
| 70 | + |
| 71 | +It should not present setup or diagnostics as a primary call to action. Users visiting the product for the first time should still be able to try the product directly without first being asked to enter a wizard. |
| 72 | + |
| 73 | +Diagnostics may be accessible later from settings or error recovery paths, but it should not compete with the welcome-page primary action. |
| 74 | + |
| 75 | +### Settings |
| 76 | + |
| 77 | +Settings should expose a low-emphasis manual entry point such as `Diagnostics` or `Help & Diagnostics`. |
| 78 | + |
| 79 | +This supports proactive users who want to inspect or repair their environment without making diagnostics part of the default first-run experience. |
| 80 | + |
| 81 | +### Recovery Redirects |
| 82 | + |
| 83 | +The product may route a user into diagnostics when: |
| 84 | + |
| 85 | +- an action has already failed |
| 86 | +- the next action is very likely to fail based on known readiness state |
| 87 | + |
| 88 | +This redirect should be contextual and intentional. It is not a generic “you should probably run setup” reminder. |
| 89 | + |
| 90 | +## Trigger Matrix |
| 91 | + |
| 92 | +Diagnostics should initially support these contexts. |
| 93 | + |
| 94 | +### 1. Workspace Recovery |
| 95 | + |
| 96 | +Trigger when the user is trying to open a workspace and: |
| 97 | + |
| 98 | +- the open action fails |
| 99 | +- the selected path is invalid or inaccessible |
| 100 | +- the product determines that the current workspace selection cannot continue |
| 101 | + |
| 102 | +Do not trigger if the workspace opens successfully. |
| 103 | + |
| 104 | +### 2. Session Recovery |
| 105 | + |
| 106 | +Trigger when the user is trying to start a session and: |
| 107 | + |
| 108 | +- the required provider is not installed |
| 109 | +- the provider CLI is missing |
| 110 | +- authentication is required but incomplete |
| 111 | +- runtime readiness is missing and session creation is highly likely to fail |
| 112 | + |
| 113 | +This is the highest-value preemptive trigger because the product can often detect the problem before a failed session launch. |
| 114 | + |
| 115 | +### 3. Mobile Continuation Recovery |
| 116 | + |
| 117 | +Trigger only when the user explicitly asks to continue on phone and: |
| 118 | + |
| 119 | +- the server is not reachable on LAN |
| 120 | +- host exposure is incompatible with phone continuation |
| 121 | +- authentication or password requirements are not satisfied |
| 122 | + |
| 123 | +Do not show mobile diagnostics before the user expresses mobile intent. |
| 124 | + |
| 125 | +### 4. Manual Diagnostics |
| 126 | + |
| 127 | +Allow a user to open diagnostics from settings even if they are not currently blocked. |
| 128 | + |
| 129 | +This entry point is secondary and should not drive the overall product architecture. |
| 130 | + |
| 131 | +For v1, settings is the only always-available manual entry point. |
| 132 | + |
| 133 | +## URL and Naming |
| 134 | + |
| 135 | +Keep a dedicated route, but weaken the setup wording. |
| 136 | + |
| 137 | +Chosen route and labels for v1: |
| 138 | + |
| 139 | +- route: `/diagnostics` |
| 140 | +- page title: `Diagnostics` |
| 141 | +- settings entry label: `Diagnostics` |
| 142 | + |
| 143 | +Avoid presenting the route as `Setup` in product language. The assistant should read like a support and repair tool, not an onboarding step. |
| 144 | + |
| 145 | +Deep-linking remains useful for redirects from failure states and for manual access from settings. |
| 146 | + |
| 147 | +## Interaction Model |
| 148 | + |
| 149 | +Diagnostics should use a dedicated page rather than an inline banner or side panel for the first version. |
| 150 | + |
| 151 | +Reasoning: |
| 152 | + |
| 153 | +- the blocked state is important enough to justify focused recovery |
| 154 | +- a dedicated page can carry clearer context and stronger next actions |
| 155 | +- it avoids overloading existing workspace, provider, and welcome surfaces with too much failure logic |
| 156 | + |
| 157 | +However, entry into this page should be conditional and infrequent. |
| 158 | + |
| 159 | +The user flow should be: |
| 160 | + |
| 161 | +1. user attempts an action |
| 162 | +2. product detects a blocking or high-risk issue |
| 163 | +3. product routes to diagnostics with task context |
| 164 | +4. diagnostics explains the issue, offers repair actions, and refreshes status |
| 165 | +5. once recovery conditions are satisfied, the page promotes continuing the original task |
| 166 | + |
| 167 | +## Page Information Architecture |
| 168 | + |
| 169 | +The page should stay intentionally small. |
| 170 | + |
| 171 | +### Section 1: Context Header |
| 172 | + |
| 173 | +The header should say what the user was trying to do and what went wrong. |
| 174 | + |
| 175 | +Examples: |
| 176 | + |
| 177 | +- `We couldn't open your workspace` |
| 178 | +- `Your Codex session is not ready to start` |
| 179 | +- `Phone continuation needs a few fixes` |
| 180 | + |
| 181 | +Avoid abstract titles like `Setup` or `Environment Doctor` as the primary heading. |
| 182 | + |
| 183 | +### Section 2: Short Explanation |
| 184 | + |
| 185 | +Add one sentence explaining why the user is here. |
| 186 | + |
| 187 | +Examples: |
| 188 | + |
| 189 | +- `A few issues need attention before we can continue.` |
| 190 | +- `We found a problem that would block session startup.` |
| 191 | + |
| 192 | +### Section 3: Relevant Issues List |
| 193 | + |
| 194 | +Only show issues relevant to the current intent. |
| 195 | + |
| 196 | +Each issue item should include: |
| 197 | + |
| 198 | +- a simple status |
| 199 | +- a short problem statement |
| 200 | +- one clear next action |
| 201 | + |
| 202 | +The initial user-facing state vocabulary should be limited to: |
| 203 | + |
| 204 | +- `checking` |
| 205 | +- `ready` |
| 206 | +- `needs_attention` |
| 207 | + |
| 208 | +The UI should avoid exposing a large internal state machine unless there is a concrete user benefit. |
| 209 | + |
| 210 | +### Section 4: Primary Continuation Action |
| 211 | + |
| 212 | +The bottom of the page should always preserve the original goal with a strong primary action. |
| 213 | + |
| 214 | +Examples: |
| 215 | + |
| 216 | +- `Retry Opening Workspace` |
| 217 | +- `Continue Starting Session` |
| 218 | +- `Continue on Phone` |
| 219 | + |
| 220 | +If requirements are not yet met, the button may be disabled with a brief reason. |
| 221 | + |
| 222 | +### Section 5: Secondary Actions |
| 223 | + |
| 224 | +Secondary actions for v1 may include: |
| 225 | + |
| 226 | +- `Back` |
| 227 | +- `Open Settings` |
| 228 | +- `Copy error details` |
| 229 | + |
| 230 | +These actions should not compete with the primary continuation action. |
| 231 | + |
| 232 | +The v1 page should not include a separate expandable advanced-details section. If technical detail is needed, `Copy error details` is the escape hatch. |
| 233 | + |
| 234 | +## Diagnostics Context Model |
| 235 | + |
| 236 | +The assistant should operate on a small set of explicit contexts instead of a single monolithic setup flow. |
| 237 | + |
| 238 | +Initial contexts: |
| 239 | + |
| 240 | +- `workspace_open` |
| 241 | +- `session_start` |
| 242 | +- `mobile_continue` |
| 243 | +- `manual_check` |
| 244 | + |
| 245 | +This context should be passed into the diagnostics page and the diagnostics data fetch. |
| 246 | + |
| 247 | +The main reason for this model is relevance: the user should only see the checks and recovery actions needed for the task they are actually trying to complete. |
| 248 | + |
| 249 | +## Server Contract |
| 250 | + |
| 251 | +The server should not expose a broad onboarding-oriented `setup.status` as the main future-facing abstraction. |
| 252 | + |
| 253 | +Instead, the diagnostics surface should move toward a contextual command model such as: |
| 254 | + |
| 255 | +- `diagnostics.get` |
| 256 | +- `diagnostics.recheck` |
| 257 | + |
| 258 | +Input: |
| 259 | + |
| 260 | +- `context` |
| 261 | +- optional task metadata, such as target provider or selected workspace path |
| 262 | + |
| 263 | +Output: |
| 264 | + |
| 265 | +- page context metadata |
| 266 | +- relevant checks |
| 267 | +- recommended actions |
| 268 | +- a boolean or derived state indicating whether continuation is allowed |
| 269 | + |
| 270 | +For migration purposes, existing setup-oriented command work may be adapted behind a new diagnostics facade if that reduces churn, but product-facing naming and usage should move to diagnostics language. |
| 271 | + |
| 272 | +## Check Categories |
| 273 | + |
| 274 | +The actual checks should be filtered by context. |
| 275 | + |
| 276 | +### Workspace Context |
| 277 | + |
| 278 | +Relevant checks: |
| 279 | + |
| 280 | +- workspace path selected |
| 281 | +- path exists |
| 282 | +- path is readable |
| 283 | +- path is openable by the workspace manager |
| 284 | + |
| 285 | +### Session Context |
| 286 | + |
| 287 | +Relevant checks: |
| 288 | + |
| 289 | +- provider installed |
| 290 | +- provider CLI available |
| 291 | +- provider authenticated if required |
| 292 | +- runtime ready enough to launch |
| 293 | +- workspace selected if session launch depends on it |
| 294 | + |
| 295 | +### Mobile Continuation Context |
| 296 | + |
| 297 | +Relevant checks: |
| 298 | + |
| 299 | +- host exposure mode |
| 300 | +- reachable LAN candidates |
| 301 | +- auth enabled when required |
| 302 | +- password configured if the mobile flow depends on it |
| 303 | + |
| 304 | +### Manual Check Context |
| 305 | + |
| 306 | +This context may show a broader system summary, but it should still be grouped and readable rather than presented as a raw technical dump. |
| 307 | + |
| 308 | +## Repair Actions |
| 309 | + |
| 310 | +Each issue should map to a concrete action owned by the product where possible. |
| 311 | + |
| 312 | +Examples: |
| 313 | + |
| 314 | +- `Choose Workspace` |
| 315 | +- `Retry Open` |
| 316 | +- `Install Provider` |
| 317 | +- `Open Provider Settings` |
| 318 | +- `Refresh Status` |
| 319 | +- `Enable Password Protection` |
| 320 | + |
| 321 | +Prefer direct actions over doc links. |
| 322 | + |
| 323 | +When the product cannot repair automatically, it should still describe the next step in product language and then offer the nearest helpful destination. |
| 324 | + |
| 325 | +## Resume and Continuation |
| 326 | + |
| 327 | +Diagnostics must preserve the pending task across repair attempts. |
| 328 | + |
| 329 | +Examples: |
| 330 | + |
| 331 | +- after selecting a valid workspace, continue the original workspace-open path |
| 332 | +- after provider installation or authentication, continue the original session-start path |
| 333 | +- after network or auth fixes, continue the original phone-handoff path |
| 334 | + |
| 335 | +This is a core requirement. Diagnostics should not repair the environment and then abandon the user in a generic state. |
| 336 | + |
| 337 | +## Error Handling |
| 338 | + |
| 339 | +The diagnostics page should distinguish between: |
| 340 | + |
| 341 | +- a known recoverable problem |
| 342 | +- an unknown error while attempting recovery |
| 343 | +- stale readiness data |
| 344 | + |
| 345 | +Guidelines: |
| 346 | + |
| 347 | +- known recoverable problems should surface one recommended next action |
| 348 | +- unknown recovery errors should show a short failure message and allow retry |
| 349 | +- stale readiness data should bias toward recheck rather than inventing new warnings |
| 350 | + |
| 351 | +The page should never collapse into a blank state after a failed fix attempt. |
| 352 | + |
| 353 | +## Testing Strategy |
| 354 | + |
| 355 | +Add coverage in three layers. |
| 356 | + |
| 357 | +### Route and Access |
| 358 | + |
| 359 | +- diagnostics route renders correctly |
| 360 | +- manual entry from settings works |
| 361 | +- redirects into diagnostics preserve context metadata |
| 362 | + |
| 363 | +### Contextual Recovery |
| 364 | + |
| 365 | +- workspace failure routes into workspace diagnostics |
| 366 | +- provider/session failure routes into session diagnostics |
| 367 | +- mobile continuation failure routes into mobile diagnostics |
| 368 | + |
| 369 | +### Continuation |
| 370 | + |
| 371 | +- successful repair re-enables the correct primary continuation action |
| 372 | +- retry resumes the original intent rather than sending the user to a generic landing state |
| 373 | + |
| 374 | +## Migration Impact |
| 375 | + |
| 376 | +This design deliberately rejects the earlier setup-first interaction model. |
| 377 | + |
| 378 | +That means the following planned changes should be revised before implementation: |
| 379 | + |
| 380 | +- do not replace the welcome-page primary CTA with `Start Setup` |
| 381 | +- do not make `/setup` the default front door for first-run users |
| 382 | +- do not frame diagnostics as a mandatory wizard |
| 383 | +- do not expose all checks for all contexts by default |
| 384 | + |
| 385 | +Existing useful work from the prior proposal can still be reused: |
| 386 | + |
| 387 | +- readiness DTOs |
| 388 | +- provider/runtime checks |
| 389 | +- mobile access status logic |
| 390 | +- reusable directory picker work |
| 391 | + |
| 392 | +The implementation should reuse these capabilities while changing the user-facing orchestration model. |
| 393 | + |
| 394 | +## Recommendation |
| 395 | + |
| 396 | +Proceed with a diagnostics-first design rather than a setup-first funnel. |
| 397 | + |
| 398 | +This approach preserves fast paths for confident users, keeps failure recovery coherent, and matches the intended product personality: helpful when needed, invisible when not. |
0 commit comments