Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion SPECS/ARCHIVE/INDEX.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# mcpbridge-wrapper Tasks Archive

**Last Updated:** 2026-03-01 (P2-T5 archived)
**Last Updated:** 2026-03-01 (P1-T4 archived)

## Archived Tasks

| Task ID | Folder | Archived | Verdict |
|---------|--------|----------|---------|
| P1-T4 | [P1-T4_Update_docs_broker_robustness/](P1-T4_Update_docs_broker_robustness/) | 2026-03-01 | PASS |
| P2-T5 | [P2-T5_Warn_when_broker_lacks_web_ui/](P2-T5_Warn_when_broker_lacks_web_ui/) | 2026-03-01 | PASS |
| P2-T4 | [P2-T4_Surface_broker_unavailability_as_JSONRPC_error/](P2-T4_Surface_broker_unavailability_as_JSONRPC_error/) | 2026-03-01 | PASS |
| P2-T3 | [P2-T3_Fix_double_spawn_race_condition/](P2-T3_Fix_double_spawn_race_condition/) | 2026-03-01 | PASS |
Expand Down Expand Up @@ -171,6 +172,7 @@
| Folder | Description |
|--------|-------------|
| [_Historical/](_Historical/) | Non-task artifacts |
| [P1-T4_Update_docs_broker_robustness/REVIEW_P1-T4_docs_broker_robustness.md](P1-T4_Update_docs_broker_robustness/REVIEW_P1-T4_docs_broker_robustness.md) | Review report for P1-T4 |

### Historical Files

Expand Down Expand Up @@ -300,6 +302,7 @@

| Date | Task ID | Action |
|------|---------|--------|
| 2026-03-01 | P1-T4 | Archived Update docs to reflect broker robustness improvements (PASS) |
| 2026-03-01 | P2-T3 | Archived Fix double-spawn race condition when MCP client toggles rapidly (PASS) |
| 2026-03-01 | P2-T1 | Archived Replace --broker-spawn/--broker-connect with single --broker flag (PASS) |
| 2026-03-01 | P2-T2 | Archived Self-healing stale socket and PID file recovery (PASS) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# P1-T4 — Update docs to reflect broker robustness improvements (P2-T1 – P2-T5)

**Status:** In Progress
**Priority:** P2
**Dependencies:** P2-T1, P2-T2, P2-T4, P2-T5 (all completed 2026-03-01)
**Branch:** feature/P1-T4-docs-broker-robustness

---

## Background

Phase 2 broker robustness tasks shipped four user-visible behaviour changes that the existing documentation does not reflect:

| Task | Change |
|------|--------|
| P2-T1 | `--broker` flag introduced as the single recommended proxy mode (auto-detects connect vs spawn). `--broker-spawn` and `--broker-connect` become legacy aliases. |
| P2-T2 | `--broker` / `--broker-spawn` now detect and remove stale socket/PID files automatically before spawning. Manual cleanup is only needed for `--broker-connect`. |
| P2-T4 | When the broker is unreachable, the proxy writes a JSON-RPC `-32001` error response to stdout instead of silently hanging. |
| P2-T5 | When `--broker --web-ui` is used but the running daemon was started without `--web-ui`, the proxy prints an actionable warning to stderr. |

The README was already updated to use `--broker` everywhere (completed in P2-T1). The individual `docs/` files and their DocC mirrors were not.

---

## Scope

### Files to update

| File | Changes needed |
|------|---------------|
| `docs/broker-mode.md` | Add `--broker` to mode table; update topology, client examples, migration, and limitations sections |
| `docs/troubleshooting.md` | Update "Could not connect" entry (JSON-RPC error + auto-recovery note); update "Stale recovery" entry; add "Warning: broker without --web-ui" entry; update rollback entry |
| `docs/cursor-setup.md` | Replace broker mode section with `--broker` primary / `--broker-connect` advanced; update migration note |
| `docs/claude-setup.md` | Same as cursor-setup |
| `docs/codex-setup.md` | Same as cursor-setup |
| `Sources/.../CursorSetup.md` | DocC mirror of cursor-setup changes |
| `Sources/.../ClaudeCodeSetup.md` | DocC mirror of claude-setup changes |
| `Sources/.../CodexCLISetup.md` | DocC mirror of codex-setup changes |
| `Sources/.../Troubleshooting.md` | DocC mirror of troubleshooting changes |

### Files NOT in scope

- `README.md` — already updated (P2-T1)
- Source code — documentation-only task
- `docs/webui-setup.md`, `docs/architecture.md` — no relevant changes in P2-T1–T5

---

## Deliverables

1. **9 updated markdown files** — all doc and DocC changes applied
2. **`SPECS/INPROGRESS/P1-T4_Validation_Report.md`** — quality gate results

---

## Acceptance Criteria

- [ ] `docs/broker-mode.md` mode table includes `--broker` as primary recommended flag
- [ ] `--broker-connect` and `--broker-spawn` described as legacy aliases in broker-mode.md
- [ ] Broker mode limitations section no longer says stale files require manual cleanup
- [ ] `docs/troubleshooting.md` "Could not connect" entry shows JSON-RPC -32001 error format
- [ ] `docs/troubleshooting.md` "Stale recovery" entry notes auto-recovery for `--broker`
- [ ] `docs/troubleshooting.md` contains new "Warning: broker running without --web-ui" entry
- [ ] All three client setup docs show `--broker` as the recommended broker option
- [ ] DocC sync check passes: `make doccheck-all` exits 0
- [ ] `ruff check src/` passes (no source changes, should be clean)
- [ ] `pytest` passes (no source changes, should be clean)

---

## Implementation Notes

- All doc changes are documentation-only; no Python source files are modified.
- The DocC files in `Sources/XcodeMCPWrapper/Documentation.docc/` are mirrors of the `docs/` files; the project's `make doccheck-all` gate enforces their sync.
- The `--broker-spawn` and `--broker-connect` flags remain valid (backwards-compatible aliases); docs should note this rather than omit them entirely.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# P1-T4 Validation Report

**Task:** Update docs to reflect broker robustness improvements (P2-T1 – P2-T5)
**Date:** 2026-03-01
**Verdict:** PASS

---

## Quality Gates

| Gate | Result | Detail |
|------|--------|--------|
| `pytest` | ✅ PASS | 737 passed, 5 skipped, 2 warnings |
| `ruff check src/` | ✅ PASS | All checks passed |
| `pytest --cov` | ✅ PASS | 91.3% coverage (≥90% required) |
| `make doccheck-all` | ✅ PASS | DocC sync verified across all scopes |

---

## Files Changed

| File | Change summary |
|------|---------------|
| `docs/broker-mode.md` | Added `--broker` to mode table; updated topology, Web UI note, client examples (Cursor/Zed/Claude/Codex), migration and rollback sections; rewrote Limitations to note auto-recovery |
| `docs/troubleshooting.md` | Updated "Could not connect" (JSON-RPC error + auto-recovery note); updated "Stale recovery" (auto for `--broker`); added "Warning: broker without --web-ui" entry; updated rollback entry |
| `docs/cursor-setup.md` | Merged two broker sections into `--broker` primary + `--broker-connect` advanced; updated migration note and troubleshooting entry |
| `docs/claude-setup.md` | Same pattern as cursor-setup |
| `docs/codex-setup.md` | Same pattern as cursor-setup |
| `Sources/.../CursorSetup.md` | DocC mirror of cursor-setup changes |
| `Sources/.../ClaudeCodeSetup.md` | DocC mirror of claude-setup changes |
| `Sources/.../CodexCLISetup.md` | DocC mirror of codex-setup changes |
| `Sources/.../Troubleshooting.md` | DocC mirror of troubleshooting changes including new web-UI mismatch entry |

---

## Acceptance Criteria

- [x] `docs/broker-mode.md` mode table includes `--broker` as primary recommended flag
- [x] `--broker-connect` and `--broker-spawn` described as legacy aliases in broker-mode.md
- [x] Broker mode limitations section no longer says stale files require manual cleanup
- [x] `docs/troubleshooting.md` "Could not connect" entry shows JSON-RPC -32001 error format
- [x] `docs/troubleshooting.md` "Stale recovery" entry notes auto-recovery for `--broker`
- [x] `docs/troubleshooting.md` contains new "Warning: broker running without --web-ui" entry
- [x] All three client setup docs show `--broker` as the recommended broker option
- [x] DocC sync check passes: `make doccheck-all` exits 0
- [x] `ruff check src/` passes
- [x] `pytest` passes
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
## REVIEW REPORT — P1-T4 docs broker robustness

**Scope:** origin/main..HEAD (5 commits)
**Files:** 9 markdown files (5 docs/, 4 DocC mirrors)
**Date:** 2026-03-01

---

### Summary Verdict
- [ ] Approve
- [x] Approve with comments
- [ ] Request changes
- [ ] Block

All primary acceptance criteria are met. Two minor gaps found — one missed update in `docs/troubleshooting.md` and one out-of-scope file pair that are now inconsistent.

---

### Critical Issues

None.

---

### Secondary Issues

**[Medium] `docs/troubleshooting.md` "MCP tools are green, but dashboard is unreachable" section not updated**

Lines 309 and 334 still reference `--broker-spawn` as the primary flag:

```
- `--broker-connect` never starts a dashboard by itself; `--broker-spawn --web-ui` only starts one when it must spawn a host.
```

```
3. **Unified broker single-config:** use `--broker-spawn --web-ui --web-ui-config <shared-path>` in all clients…
```

The DocC mirror (`Sources/.../Troubleshooting.md`) was correctly updated to `--broker` for both of these lines during EXECUTE, but the `docs/troubleshooting.md` source was not. This creates a sync divergence between the two files that `make doccheck-all` does not catch (the check enforces that docs → DocC updates happen together, but does not detect the reverse).

**Fix:** Update both occurrences in `docs/troubleshooting.md` to match the DocC mirror.

---

**[Low] `docs/webui-setup.md` and its DocC mirror `WebUIDashboard.md` not updated**

Both files still use `--broker-spawn` in their multi-agent setup examples (lines 101 and 107 in each):

```
use `--broker-spawn --web-ui --web-ui-config <shared-path>` across Cursor/Zed/Claude/Codex
```

These files were explicitly excluded from scope in the P1-T4 PRD ("docs/webui-setup.md — no relevant changes in P2-T1–T5"). However, the guidance is now inconsistent with all other broker docs that use `--broker`.

**Fix:** Update `docs/webui-setup.md` and `Sources/.../WebUIDashboard.md` to use `--broker` in multi-agent examples in a follow-up task.

---

### Architectural Notes

- The `--broker-spawn` legacy alias correctly remains visible in the docs in backward-compat contexts (rollback instructions, stale-recovery notes, "Warning: broker without --web-ui" cause explanation). These references are accurate and should not be removed.
- DocC sync enforcement (`make doccheck-all`) catches docs→DocC divergence but not DocC→docs divergence. The medium finding above was only caught by manual grep. The sync script could be enhanced to check both directions, but that is out of scope here.

---

### Tests

- `pytest`: 737 passed, 5 skipped — no regressions (documentation-only change)
- `ruff check src/`: clean — no source changes
- `pytest --cov`: 91.3% — above 90% threshold
- `make doccheck-all`: passed — DocC mirrors in sync for all changed `docs/` files

---

### Next Steps

1. **Follow-up task (Medium):** Fix 2 remaining `--broker-spawn` references in `docs/troubleshooting.md` "MCP tools are green" section.
2. **Follow-up task (Low):** Update `docs/webui-setup.md` and `Sources/.../WebUIDashboard.md` multi-agent examples to use `--broker`.
3 changes: 2 additions & 1 deletion SPECS/INPROGRESS/next.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# No Active Task

**Status:** Idle — P2-T5 archived. Select the next task from `SPECS/Workplan.md`.
**Status:** Idle — P1-T4 archived. Select the next task from `SPECS/Workplan.md`.

## Recently Archived

- **P1-T4** — Update docs to reflect broker robustness improvements (2026-03-01, PASS)
- **P2-T5** — Warn or restart daemon when --web-ui requested but running broker lacks it (2026-03-01, PASS)
- **P2-T4** — Surface broker unavailability as JSON-RPC error instead of silent timeout (2026-03-01, PASS)
- **P2-T3** — Fix double-spawn race condition when MCP client toggles rapidly (2026-03-01, PASS)
Expand Down
46 changes: 46 additions & 0 deletions SPECS/Workplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,52 @@ Add new tasks using the canonical template in [TASK_TEMPLATE.md](TASK_TEMPLATE.m
- [x] `README.md` presents broker setup before alternative/manual setup in MCP settings examples for Cursor, Claude Code, and Codex CLI
- [x] The MCP example sections use consistent wording and ordering so users can follow the broker-first path without ambiguity

#### ✅ P1-T4: Update docs to reflect broker robustness improvements (P2-T1 – P2-T5)
- **Status:** ✅ Completed (2026-03-01)
- **Description:** The docs/broker-mode.md, docs/troubleshooting.md, docs/cursor-setup.md, docs/claude-setup.md, and docs/codex-setup.md (plus their DocC mirrors) still reference the old `--broker-spawn`/`--broker-connect` flags as primary options, describe stale-socket cleanup as manual, and omit the new `--broker` flag (P2-T1), auto-recovery behaviour (P2-T2), JSON-RPC -32001 error response (P2-T4), and the web-UI mismatch warning (P2-T5). Update all five docs + four DocC files to reflect the current behaviour.
- **Priority:** P2
- **Dependencies:** P2-T1, P2-T2, P2-T4, P2-T5
- **Parallelizable:** yes
- **Outputs/Artifacts:**
- `docs/broker-mode.md` — mode table, topology, examples, limitations updated
- `docs/troubleshooting.md` — stale-recovery, connect-timeout, web-UI mismatch entries updated
- `docs/cursor-setup.md`, `docs/claude-setup.md`, `docs/codex-setup.md` — broker examples updated
- `Sources/XcodeMCPWrapper/Documentation.docc/` — four mirror files synced
- **Acceptance Criteria:**
- [ ] `--broker` appears as the recommended flag in all broker sections
- [ ] `--broker-connect`/`--broker-spawn` demoted to legacy/advanced entries
- [ ] Stale-socket recovery described as automatic for `--broker`/`--broker-spawn`
- [ ] Troubleshooting entry for JSON-RPC -32001 error present
- [ ] New troubleshooting entry for "Warning: broker is running without --web-ui" present
- [ ] DocC sync check passes (`make doccheck-all`)

#### ⬜ P1-T5: Fix missed --broker-spawn references in troubleshooting.md "MCP tools are green" section
- **Status:** ⬜ Pending
- **Description:** Two lines in `docs/troubleshooting.md` "MCP tools are green, but dashboard is unreachable" section still say `--broker-spawn` where they should say `--broker`. The DocC mirror (`Sources/.../Troubleshooting.md`) was correctly updated in P1-T4 but the docs source was missed. Found during P1-T4 review (medium severity).
- **Priority:** P2
- **Dependencies:** P1-T4
- **Parallelizable:** yes
- **Outputs/Artifacts:**
- `docs/troubleshooting.md` — 2 occurrences updated in "MCP tools are green" section
- **Acceptance Criteria:**
- [ ] `docs/troubleshooting.md` line "only starts one when it must spawn a host" uses `--broker --web-ui`
- [ ] `docs/troubleshooting.md` "Unified broker single-config" solution option uses `--broker --web-ui`
- [ ] `make doccheck-all` passes (mirrors stay in sync)

#### ⬜ P1-T6: Update webui-setup.md and DocC mirror to use --broker in multi-agent examples
- **Status:** ⬜ Pending
- **Description:** `docs/webui-setup.md` and `Sources/XcodeMCPWrapper/Documentation.docc/WebUIDashboard.md` still use `--broker-spawn` in their multi-agent broker setup examples. These files were out of scope for P1-T4 but are now inconsistent with all other broker docs. Found during P1-T4 review (low severity).
- **Priority:** P3
- **Dependencies:** P1-T4
- **Parallelizable:** yes
- **Outputs/Artifacts:**
- `docs/webui-setup.md` — multi-agent examples updated to `--broker`
- `Sources/XcodeMCPWrapper/Documentation.docc/WebUIDashboard.md` — mirror synced
- **Acceptance Criteria:**
- [ ] `docs/webui-setup.md` multi-agent broker example uses `--broker`
- [ ] DocC mirror updated to match
- [ ] `make doccheck-all` passes

### Phase 2: Broker Robustness

#### ✅ P2-T1: Replace --broker-spawn/--broker-connect with single --broker flag
Expand Down
13 changes: 6 additions & 7 deletions Sources/XcodeMCPWrapper/Documentation.docc/ClaudeCodeSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ claude mcp add --transport stdio xcode -- uvx --from 'mcpbridge-wrapper[webui]'

### Option 1C: Using Broker Mode (Optional)

Connect to an already-running broker:
`--broker` auto-detects: connects if a daemon is running, spawns one otherwise. Stale socket/PID files from a crashed daemon are cleaned up automatically.

```bash
claude mcp add --transport stdio xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker-connect
claude mcp add --transport stdio xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker
```

Best-effort auto-spawn mode:
Advanced — connect-only (no auto-spawn):

```bash
claude mcp add --transport stdio xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker-spawn
claude mcp add --transport stdio xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker-connect
```

### Option 2: Using Manual Installation
Expand Down Expand Up @@ -62,7 +62,7 @@ Replace `/path/to/XcodeMCPWrapper` with the actual path to your cloned repositor

### Migration and Rollback

- Migration: add `--broker-connect` or `--broker-spawn` to your `claude mcp add` command.
- Migration: add `--broker` to your `claude mcp add` command.
- Rollback: remove broker flags and re-run the command.

### Verify Configuration
Expand Down Expand Up @@ -134,5 +134,4 @@ Make sure Xcode Tools MCP is enabled in Xcode:

**"Could not connect to broker socket ... within 10.0s"**

Broker mode could not reach a ready socket. Verify broker status or remove
broker flags to return to direct mode.
Broker mode could not reach a ready socket. If using `--broker`, stale files are cleaned up automatically; verify broker status or remove broker flags to return to direct mode.
13 changes: 6 additions & 7 deletions Sources/XcodeMCPWrapper/Documentation.docc/CodexCLISetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ codex mcp add xcode -- uvx --from 'mcpbridge-wrapper[webui]' mcpbridge-wrapper -

### Option 1C: Using Broker Mode (Optional)

Connect to an already-running broker:
`--broker` auto-detects: connects if a daemon is running, spawns one otherwise. Stale socket/PID files from a crashed daemon are cleaned up automatically.

```bash
codex mcp add xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker-connect
codex mcp add xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker
```

Best-effort auto-spawn mode:
Advanced — connect-only (no auto-spawn):

```bash
codex mcp add xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker-spawn
codex mcp add xcode -- uvx --from mcpbridge-wrapper mcpbridge-wrapper --broker-connect
```

### Option 2: Using Manual Installation
Expand Down Expand Up @@ -62,7 +62,7 @@ Replace `/path/to/XcodeMCPWrapper` with the actual path to your cloned repositor

### Migration and Rollback

- Migration: add `--broker-connect` or `--broker-spawn` to your `codex mcp add` command.
- Migration: add `--broker` to your `codex mcp add` command.
- Rollback: remove broker flags and re-run the command.

### Verify Configuration
Expand Down Expand Up @@ -145,5 +145,4 @@ Make sure Xcode Tools MCP is enabled in Xcode:

**"Could not connect to broker socket ... within 10.0s"**

Broker mode could not reach a ready socket. Verify broker status or remove
broker flags to return to direct mode.
Broker mode could not reach a ready socket. If using `--broker`, stale files are cleaned up automatically; verify broker status or remove broker flags to return to direct mode.
Loading