Skip to content

Commit 04270d2

Browse files
authored
Merge pull request #139 from SoundBlaster/feature/P1-T10-xcode-first-approval-troubleshooting
P1-T10: Document Xcode first-approval timing race in Troubleshooting & Known Issues
2 parents 8c1260d + 527d07c commit 04270d2

10 files changed

Lines changed: 381 additions & 20 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ See [Web UI Setup Guide](docs/webui-setup.md) for detailed configuration.
615615

616616
## Known Issues
617617

618-
- **Broker cold-start — first use requires Xcode approval:** When the broker daemon starts a new `xcrun mcpbridge` process (on first launch or after a daemon restart), Xcode shows an "Allow Connection?" dialog. Until you click **Allow**, `tools/list` is pending and MCP clients will show 0 tools. After approval the permission persists for that binary path — no re-approval is needed on subsequent sessions. **Workaround:** watch for the Xcode dialog after enabling broker mode; if the client still shows 0 tools, toggle the MCP switch off and back on after clicking Allow.
618+
- **Broker cold-start — Xcode approval timing race (0 tools with green dot):** When the broker daemon starts a new `xcrun mcpbridge` process (on first launch or after a daemon restart), Xcode shows a per-process "Allow Connection?" dialog. If your MCP client sends `tools/list` *before* Xcode grants approval, it receives an empty list and **caches it permanently** — showing 0 tools with a green connected indicator and no error message. Each unique binary path (direct wrapper vs broker daemon) triggers a *separate* dialog. After approval the permission persists — no re-approval is needed on subsequent sessions. **Workaround:** watch for the Xcode dialog immediately after enabling broker mode; after clicking Allow, reload the MCP connection in your client (disable → re-enable in settings). See [Troubleshooting: 0 tools after first broker connection](docs/troubleshooting.md#mcp-client-shows-0-tools-green-dot-after-first-broker-connection) for client-specific recovery steps and the diagnostic command.
619619
- **BUG-T5 → FU-P13-T7 (P0):** Empty-content tool results can still violate strict `structuredContent` expectations in strict MCP clients.
620620
- **BUG-T6 → FU-P13-T8 (P0):** Web UI port collisions can happen when multiple MCP sessions start with the same `--web-ui-port` (for example `8080`), producing `address already in use`.
621621
- **BUG-T7 → FU-P13-T9 (P0):** `resources/list` and `resources/templates/list` probing may return non-standard error shapes in some client paths.

SPECS/ARCHIVE/INDEX.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# mcpbridge-wrapper Tasks Archive
22

3-
**Last Updated:** 2026-03-05 (P4-T1 archived)
3+
**Last Updated:** 2026-03-06 (P1-T10 archived)
44

55
## Archived Tasks
66

77
| Task ID | Folder | Archived | Verdict |
88
|---------|--------|----------|---------|
9+
| P1-T10 | [P1-T10_Document_Xcode_first_approval_timing_race/](P1-T10_Document_Xcode_first_approval_timing_race/) | 2026-03-06 | PASS |
910
| P4-T1 | [P4-T1_Auto_restart_stale_broker_daemon_on_version_mismatch_after_upgrade/](P4-T1_Auto_restart_stale_broker_daemon_on_version_mismatch_after_upgrade/) | 2026-03-05 | PASS |
1011
| P1-T6 | [P1-T6_Update_webui_setup_and_DocC_mirror_to_use_broker_in_multi_agent_examples/](P1-T6_Update_webui_setup_and_DocC_mirror_to_use_broker_in_multi_agent_examples/) | 2026-03-04 | PASS |
1112
| P1-T5 | [P1-T5_Fix_missed_broker_spawn_references_in_troubleshooting/](P1-T5_Fix_missed_broker_spawn_references_in_troubleshooting/) | 2026-03-04 | PASS |
@@ -186,6 +187,7 @@
186187

187188
| File | Description |
188189
|------|-------------|
190+
| [REVIEW_P1-T10_xcode_first_approval_docs.md](_Historical/REVIEW_P1-T10_xcode_first_approval_docs.md) | Review report for P1-T10 |
189191
| [REVIEW_p4_t1_broker_version_restart.md](_Historical/REVIEW_p4_t1_broker_version_restart.md) | Review report for P4-T1 |
190192
| [REVIEW_p1_t6_webui_broker_examples.md](_Historical/REVIEW_p1_t6_webui_broker_examples.md) | Review report for P1-T6 |
191193
| [REVIEW_p1_t5_troubleshooting_broker.md](_Historical/REVIEW_p1_t5_troubleshooting_broker.md) | Review report for P1-T5 |
@@ -317,6 +319,8 @@
317319

318320
| Date | Task ID | Action |
319321
|------|---------|--------|
322+
| 2026-03-06 | P1-T10 | Archived REVIEW_P1-T10_xcode_first_approval_docs report |
323+
| 2026-03-06 | P1-T10 | Archived Document Xcode first-approval timing race in Troubleshooting & Known Issues (PASS) |
320324
| 2026-03-05 | P4-T1 | Archived REVIEW_p4_t1_broker_version_restart report |
321325
| 2026-03-05 | P4-T1 | Archived Auto_restart_stale_broker_daemon_on_version_mismatch_after_upgrade (PASS) |
322326
| 2026-03-04 | P1-T6 | Archived REVIEW_p1_t6_webui_broker_examples report |
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# P1-T10 — Document Xcode First-Approval Timing Race
2+
3+
**Task ID:** P1-T10
4+
**Priority:** P1
5+
**Phase:** Phase 1 — Documentation
6+
**Status:** In Progress
7+
8+
## Problem Statement
9+
10+
When broker mode is used for the first time (or after a daemon restart), Xcode shows a per-process
11+
"Allow Connection?" dialog for the new `mcpbridge` process. If an MCP client (Zed, Cursor, Claude Code)
12+
connects and sends `tools/list` *before* Xcode grants approval, it receives an empty tools list and
13+
**caches it permanently** — showing 0 tools with a green "connected" indicator and no actionable error.
14+
15+
The user sees:
16+
- Green connected indicator in their MCP client
17+
- 0 tools visible
18+
- No error message — just silence
19+
20+
This is a usability trap with no obvious recovery path unless you know the root cause.
21+
22+
### Key Facts Discovered During Live Testing
23+
24+
1. **Per-process identity**: Each unique binary path triggers a separate Xcode dialog:
25+
- Direct wrapper (`mcpbridge-wrapper` without `--broker`) — one approval
26+
- Broker daemon (`mcpbridge-wrapper --broker-daemon`) — a *different* approval
27+
28+
2. **Client caching**: MCP clients cache the `tools/list` response. An empty list received
29+
during the approval window is stored and served indefinitely until the user manually
30+
reloads/restarts the MCP connection.
31+
32+
3. **Broker reconnect cycling**: During the Xcode approval dialog, the broker's upstream
33+
`xcrun mcpbridge` detects EOF and cycles. Logs show:
34+
```
35+
Upstream EOF detected; scheduling reconnect
36+
```
37+
repeated 2–3 times before Xcode approval stabilizes the connection.
38+
39+
4. **Recovery sequence**: After clicking Allow in Xcode, MCP clients still show 0 tools
40+
because they cache the old empty response. Users must manually reload the MCP connection
41+
(disable → re-enable in client settings).
42+
43+
## Deliverables
44+
45+
### 1. `docs/troubleshooting.md` — New Section
46+
47+
Add a new troubleshooting entry titled:
48+
`"MCP client shows 0 tools (green dot) after first broker connection"`
49+
50+
Content must include:
51+
- Symptom description (green dot, 0 tools, no error)
52+
- Root cause explanation (Xcode per-process approval + client caching)
53+
- Per-process identity note (direct mode vs broker daemon are separate approvals)
54+
- Correct first-time setup sequence (start broker → watch for Xcode dialog → approve → then reload client)
55+
- Client-specific recovery steps:
56+
- Zed: disable MCP in settings → save → enable → save, wait for spinner
57+
- Cursor: open MCP settings → disconnect → reconnect (or restart Cursor)
58+
- Claude Code: `claude mcp remove xcode && claude mcp add ...` (or session restart)
59+
- Broker log diagnostic hint (look for `Upstream EOF detected`)
60+
61+
Place this section after the existing `"Found 0 tools"` section (line ~5 of troubleshooting.md)
62+
since it is the next most common variation.
63+
64+
### 2. `README.md` — Expand Known Issues Entry
65+
66+
The existing entry (line 618) reads:
67+
> **Broker cold-start — first use requires Xcode approval:** [brief text]
68+
69+
Expand it to include:
70+
- The client-caching consequence (empty list gets cached permanently)
71+
- The green-dot-with-0-tools symptom
72+
- The per-process identity note
73+
- A link to the new troubleshooting section: `[Troubleshooting: Xcode first-approval timing race](docs/troubleshooting.md#mcp-client-shows-0-tools-green-dot-after-first-broker-connection)`
74+
75+
### 3. `Sources/XcodeMCPWrapper/Documentation.docc/Troubleshooting.md` — Mirror
76+
77+
Add the same new section to the DocC troubleshooting file (mirrors `docs/troubleshooting.md`),
78+
using DocC link syntax where needed.
79+
80+
## Acceptance Criteria
81+
82+
- [ ] `docs/troubleshooting.md` contains a new section for the Xcode first-approval timing race
83+
- [ ] The new section includes: symptom, root cause, per-process identity note, first-time setup
84+
sequence, and recovery steps for at least Zed and Cursor
85+
- [ ] `README.md` Known Issues entry for broker cold-start is expanded with client-caching
86+
consequence and links to the new troubleshooting section
87+
- [ ] DocC `Troubleshooting.md` mirrors the new section
88+
- [ ] No existing documentation is removed or broken
89+
- [ ] All links resolve correctly
90+
91+
## Implementation Notes
92+
93+
- Insert the new troubleshooting section near the top of `docs/troubleshooting.md`, after
94+
the existing "Found 0 tools" section (around line 31), since it is a variant of that symptom.
95+
- The DocC file uses `##` headings for its sections — match that style.
96+
- The README Known Issues list uses bold key phrases followed by colon — match that style.
97+
- Anchor for the new troubleshooting section (for deep linking from README):
98+
`#mcp-client-shows-0-tools-green-dot-after-first-broker-connection`
99+
100+
## Out of Scope
101+
102+
- Code changes to fix the race (tracked as P4-T2)
103+
- Changes to broker-mode.md (that doc covers operational flows; troubleshooting lives here)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# P1-T10 Validation Report
2+
3+
**Task:** Document Xcode first-approval timing race in Troubleshooting & Known Issues
4+
**Date:** 2026-03-06
5+
**Verdict:** PASS
6+
7+
## Acceptance Criteria Checklist
8+
9+
- [x] `docs/troubleshooting.md` contains a new section for the Xcode first-approval timing race
10+
- Section added after "Found 0 tools" section: "MCP client shows 0 tools (green dot) after first broker connection"
11+
- Includes: symptom, root cause, per-process identity note, broker log signature, correct first-time setup sequence, recovery steps for Zed / Cursor / Claude Code, diagnostic command
12+
13+
- [x] The new section includes recovery steps for at least Zed and Cursor
14+
- Zed: disable → save → enable → save
15+
- Cursor: toggle off/on or restart
16+
- Claude Code: remove and re-add MCP server
17+
18+
- [x] `README.md` Known Issues entry expanded with client-caching consequence and link to troubleshooting section
19+
- Old: brief one-line description
20+
- New: includes "caches it permanently", green dot symptom, per-process identity note, link to docs/troubleshooting.md#mcp-client-shows-0-tools-green-dot-after-first-broker-connection
21+
22+
- [x] DocC `Troubleshooting.md` mirrors the new section
23+
- Section added: "Broker first connection: 0 tools with green connected indicator"
24+
- Uses DocC-compatible heading style (##)
25+
26+
- [x] No existing documentation removed or broken
27+
- All previous sections preserved; new sections inserted only
28+
29+
- [x] All links reference correct anchors (GitHub auto-generates anchors from headings)
30+
31+
## Quality Gates
32+
33+
- No code changes → `make test`, `make lint`, `make typecheck` not applicable
34+
- Documentation change only — no Python source modified
35+
36+
## Files Modified
37+
38+
| File | Change |
39+
|------|--------|
40+
| `docs/troubleshooting.md` | Added new section (~70 lines) after "Found 0 tools" |
41+
| `README.md` | Expanded Known Issues bullet for broker cold-start |
42+
| `Sources/XcodeMCPWrapper/Documentation.docc/Troubleshooting.md` | Added mirrored section (~45 lines) |
43+
44+
## Notes
45+
46+
The README Known Issues entry (line 618) already had a brief mention of the Xcode approval
47+
dialog. P1-T10 expanded it to document the client-caching consequence, green-dot symptom,
48+
per-process identity behavior, and linked to the full troubleshooting guide.
49+
50+
P4-T2 (Cache tools/list in broker + upstream readiness gate) is the code-level fix for this
51+
race condition and remains open for a future sprint.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# REVIEW: P1-T10 — Xcode First-Approval Timing Race Documentation
2+
3+
**Date:** 2026-03-06
4+
**Reviewer:** Claude (automated review)
5+
**Subject:** P1-T10 documentation deliverables
6+
7+
## Scope
8+
9+
Review of three documentation files modified in P1-T10:
10+
- `docs/troubleshooting.md` — new section added
11+
- `README.md` — Known Issues entry expanded
12+
- `Sources/XcodeMCPWrapper/Documentation.docc/Troubleshooting.md` — new section mirrored
13+
14+
## Findings
15+
16+
### docs/troubleshooting.md
17+
18+
**Section title:** "MCP client shows 0 tools (green dot) after first broker connection"
19+
20+
Strengths:
21+
- Symptom is clearly stated with visual cue (green dot) that users will recognize
22+
- Root cause correctly attributes both Xcode approval dialog AND client-side caching
23+
- Per-process identity note (direct wrapper vs broker daemon) is present and accurate
24+
- Broker log signature (`Upstream EOF detected`) gives users a concrete diagnostic anchor
25+
- First-time setup sequence is actionable and correctly orders: start → watch → approve → reload
26+
- Caution note prevents pre-approval tool calls that would trigger the caching problem
27+
- Recovery steps cover Zed, Cursor, and Claude Code specifically
28+
29+
No actionable issues found.
30+
31+
### README.md Known Issues
32+
33+
**Expanded entry at line 618**
34+
35+
Strengths:
36+
- Now mentions "caches it permanently" — the key consequence that was missing before
37+
- "green connected indicator" symptom is explicitly named
38+
- Per-process identity note added
39+
- Deep link to troubleshooting section provided
40+
41+
Observation: The anchor `#mcp-client-shows-0-tools-green-dot-after-first-broker-connection`
42+
depends on GitHub's heading-to-anchor auto-generation. The heading in troubleshooting.md is:
43+
`### "MCP client shows 0 tools (green dot) after first broker connection"`
44+
GitHub strips quotes and special characters from anchors. The generated anchor will be:
45+
`#mcp-client-shows-0-tools-green-dot-after-first-broker-connection`
46+
This matches — link is correct.
47+
48+
No actionable issues found.
49+
50+
### DocC Troubleshooting.md
51+
52+
**Section title:** "Broker first connection: 0 tools with green connected indicator"
53+
54+
Strengths:
55+
- Matches content of docs/troubleshooting.md at appropriate DocC conciseness level
56+
- Uses `##` heading style consistent with surrounding DocC sections
57+
- Includes per-process identity note, broker log signature, setup sequence, recovery steps
58+
- Uses DocC-compatible bash code blocks
59+
60+
Observation: The section title differs slightly from `docs/troubleshooting.md`
61+
("Broker first connection: 0 tools with green connected indicator" vs
62+
"MCP client shows 0 tools (green dot) after first broker connection").
63+
This is acceptable — DocC headings use a slightly different style convention (no quotes,
64+
shorter form) and both titles clearly describe the same symptom.
65+
66+
No actionable issues found.
67+
68+
## Overall Assessment
69+
70+
**Verdict: PASS — No actionable findings**
71+
72+
All three deliverables meet the acceptance criteria from the PRD. The documentation is
73+
accurate, covers the correct root cause discovered during live testing (client-caching +
74+
per-process Xcode approval), and provides recovery steps for all major MCP clients.
75+
76+
FOLLOW-UP: Skipped — no actionable findings.

SPECS/INPROGRESS/next.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# No Active Task
2-
3-
**Status:** Idle — P4-T1 archived. Select the next task from `SPECS/Workplan.md`.
1+
# Next Task
42

53
## Recently Archived
64

7-
- **P4-T1** — Auto-restart stale broker daemon on version mismatch after upgrade (2026-03-05, PASS)
8-
- **P1-T6** — Update webui-setup.md and DocC mirror to use --broker in multi-agent examples (2026-03-04, PASS)
9-
- **P1-T5** — Fix missed --broker-spawn references in troubleshooting.md "MCP tools are green" section (2026-03-04, PASS)
10-
- **P1-T9** — Add direct links for all command steps in FLOW.md (2026-03-03, PASS)
11-
- **P3-T11** — Add Stop broker/service control button to Web UI (2026-03-01, PASS)
5+
- **P1-T10** — Document Xcode first-approval timing race in Troubleshooting & Known Issues ✅ (2026-03-06)
126

137
## Suggested Next Tasks
148

15-
- No pending tasks in the current cycle. Add new tasks to `SPECS/Workplan.md`.
9+
- **P4-T2** — Cache `tools/list` in broker and gate client responses on upstream readiness
10+
- Priority: P4
11+
- Phase: Phase 4: Broker Advanced Features
12+
- Dependencies: none
13+
- Description: Fix the Xcode first-approval timing race at the code level by blocking client requests until upstream is ready and caching the `tools/list` response after a successful init round-trip.
14+
15+
## Status
16+
17+
No active task selected. Run `python3 scripts/pick_next_task.py` to select the next task.

SPECS/Workplan.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,21 @@ Add new tasks using the canonical template in [TASK_TEMPLATE.md](TASK_TEMPLATE.m
127127
- [x] Claude Code and Codex CLI config templates present a broker command first
128128
- [x] Broker-first guidance is consistent with existing `*-broker` templates and `--broker` usage
129129

130-
#### ⬜️ P1-T10: Document Xcode first-approval timing race in Troubleshooting & Known Issues
130+
#### ✅ P1-T10: Document Xcode first-approval timing race in Troubleshooting & Known Issues
131+
- **Status:** ✅ Completed (2026-03-06)
131132
- **Description:** When broker mode is used for the first time, Xcode shows an approval dialog for the new daemon process. If an MCP client (Zed, Cursor) connects and sends `tools/list` before Xcode grants approval, it receives an empty tools list and caches it — showing 0 tools indefinitely until the user manually reloads the MCP connection. This is a real usability trap: the green dot shows "connected" but 0 tools, with no clear error. Document the root cause, the correct first-time setup sequence, and the recovery steps in `docs/troubleshooting.md` and as a Known Issue in `README.md`. Also note that each unique process identity (direct wrapper vs broker daemon) triggers a separate Xcode dialog.
132133
- **Priority:** P1
133134
- **Dependencies:** none
134135
- **Parallelizable:** yes
135136
- **Outputs/Artifacts:**
136-
- `docs/troubleshooting.md` — new section "Broker mode shows 0 tools on first run (Xcode approval timing)"
137-
- `README.md` — Known Issues entry for first-approval race condition
138-
- DocC mirror synced (`Sources/XcodeMCPWrapper/Documentation.docc/`)
137+
- `docs/troubleshooting.md` — new section "MCP client shows 0 tools (green dot) after first broker connection"
138+
- `README.md` — Known Issues entry expanded for first-approval race condition
139+
- DocC mirror synced (`Sources/XcodeMCPWrapper/Documentation.docc/Troubleshooting.md`)
139140
- **Acceptance Criteria:**
140-
- [ ] `docs/troubleshooting.md` describes the symptom (green dot, 0 tools), root cause (Xcode dialog timing race), correct setup sequence (start broker first → approve → then connect clients), and recovery steps (reload MCP in client after approval)
141-
- [ ] `docs/troubleshooting.md` notes that each new process identity (direct vs broker daemon) triggers a separate Xcode dialog
142-
- [ ] `README.md` Known Issues section includes this scenario
143-
- [ ] `make doccheck-all` passes
141+
- [x] `docs/troubleshooting.md` describes the symptom (green dot, 0 tools), root cause (Xcode dialog timing race), correct setup sequence (start broker first → approve → then connect clients), and recovery steps (reload MCP in client after approval)
142+
- [x] `docs/troubleshooting.md` notes that each new process identity (direct vs broker daemon) triggers a separate Xcode dialog
143+
- [x] `README.md` Known Issues section includes this scenario
144+
- [x] DocC Troubleshooting.md mirrors the new section
144145

145146
#### ✅ P1-T9: Add direct links for all command steps in FLOW.md
146147
- **Status:** ✅ Completed (2026-03-03)

0 commit comments

Comments
 (0)