Cowork Handoff Chrome Extension Testing
Documentation for Sessions
Cowork Agent Handoff: Chrome Extension Testing
Session: 75
Handoff ID: handoff-1769778720607-2d8cc30f
From: Claude Code (cursor-claude-code-session75)
To: Cowork Agent (browser)
Priority: High
Created: 2026-01-30
Context
Session 75 implemented a Native WebSocket Protocol Adapter (/ws endpoint) to enable Chrome MV3 extensions and VSCode extensions to connect to the MCP Gateway. The Socket.io /mcp-stream endpoint doesn't work with Chrome MV3 service workers due to platform limitations.
What Was Built
- Native WebSocket Gateway -
apis/backend-ai-api/src/app/mcp-gateway/native-ws.gateway.ts - Chrome Extension Connector -
apps/gograb-ai-extension/background/mcp-connector.js(updated to use/ws) - VSCode Extension Connector -
apps/vscode-gograb-ai/src/agent-status.ts(updated to use/ws)
Current Status
- Backend
/wsendpoint is working (verified via curl) - Chrome extension code is updated but NOT installed
- No agents are currently online in MongoDB
Tasks for Cowork Agent
Task 1: Verify Backend is Running
Steps:
- Open Chrome browser
- Navigate to:
http://localhost:3001/ai-api/health - Verify response shows
"status": "ok"
Expected Result:
{
"status": "ok",
"timestamp": "...",
"service": "backend-ai-api"
}
Task 2: Install Chrome Extension (Unpacked)
Steps:
- Open Chrome browser
- Navigate to:
chrome://extensions/ - Enable "Developer mode" (toggle in top-right corner)
- Click "Load unpacked" button
- Navigate to:
/Users/fguijarro/developer/repos/editor2/apps/gograb-ai-extension - Select the folder and click "Select"
Expected Result:
- Extension appears in the list with name "GoGrab AI Assistant" (or similar)
- Extension icon appears in Chrome toolbar
- No errors shown in the extension card
If Errors Occur:
- Check the extension card for error messages
- Click "Errors" button to see details
- Screenshot any errors for debugging
Task 3: Inspect Service Worker Console
Steps:
- On
chrome://extensions/page, find the GoGrab AI extension - Click "Service Worker" link (or "Inspect views: service worker")
- This opens Chrome DevTools for the background script
- Go to Console tab
- Look for MCP connection logs
Expected Logs (Success):
[MCP] Initializing connector as chrome-ext-xxxxx
[MCP] Connecting to ws://localhost:3001/ws?agentId=chrome-ext-xxxxx&platform=external&...
[MCP] WebSocket opened
[MCP] Message received: connected
[MCP] Connected and authenticated: {...}
Expected Logs (Failure):
[MCP] WebSocket error: ...
[MCP] WebSocket closed: 1006 ...
[MCP] Reconnecting in 1000ms (attempt 1)
Screenshot the console output regardless of success/failure.
Task 4: Check Extension Badge
Steps:
- Look at the extension icon in Chrome toolbar
- Check for badge status:
- No badge = Connected, no pending handoffs
- Number badge (e.g., "1") = Connected, has pending handoffs
- "!" badge (red) = Not connected
Expected Result:
- No badge or empty badge (connected state)
- Extension popup should show "Connected" status when clicked
Task 5: Verify Agent in MongoDB
Steps:
- Open MongoDB Compass
- Connect to:
gograbspace.dgqjj2t.mongodb.net - Navigate to:
ai-mcp-devdatabase →agentscollection - Look for a document with:
agentId: starts withchrome-ext-platform:"external"status:"online"workspace:"editor2"
Expected Document:
{
"agentId": "chrome-ext-xxxxxxxxx",
"platform": "external",
"status": "online",
"workspace": "editor2",
"connectedAt": "2026-01-30T...",
"lastHeartbeat": "2026-01-30T...",
"socketId": "ws-..."
}
Screenshot the agent document if found.
Task 6: Test Extension Popup
Steps:
- Click the GoGrab AI extension icon in toolbar
- Verify popup opens without errors
- Check connection status displayed in popup
- If there are pending handoffs, they should be listed
Screenshot the popup showing the status.
Task 7: Test Handoff Notification
Steps:
- Keep the extension installed and service worker console open
- Create a test handoff via curl (run in terminal):
curl -X POST http://localhost:3001/ai-api/infrastructure/handoffs \
-H "Content-Type: application/json" \
-d '{
"fromAgent": "cowork-test-agent",
"workspace": "editor2",
"sessionNumber": 75,
"toAgentType": "browser",
"type": "verification",
"priority": "normal",
"summary": "Test notification to Chrome extension",
"tasks": [{"description": "Verify notification received"}]
}'
- Check if:
- Chrome notification appears
- Extension badge updates with count
- Console shows
[MCP] Handoff created: {...}
Screenshot any notifications that appear.
Troubleshooting
Extension Won't Load
- Check
manifest.jsonexists inapps/gograb-ai-extension/ - Verify all required files exist:
manifest.jsonbackground/service-worker.jsbackground/mcp-connector.jspopup/popup.htmlicons/icon16.png,icon48.png,icon128.png
WebSocket Won't Connect
- Verify backend is running:
lsof -i :3001 - Test endpoint directly:
curl -v --no-buffer \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" \
-H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
"http://localhost:3001/ws?agentId=test&platform=external&workspace=editor2"
Should return HTTP/1.1 101 Switching Protocols
No Heartbeat/Agent Goes Offline
- Check service worker isn't being terminated
- Chrome MV3 service workers have limited lifetime
- The extension uses
chrome.alarmsfor keep-alive (verify in console)
Success Criteria
Mark this handoff as completed when:
- Backend health check passes
- Chrome extension loads without errors
- Service worker console shows successful connection
- Agent appears in MongoDB with
status: "online" - Extension badge shows correct state
- Test handoff notification is received
Files Reference
| File | Purpose |
|---|---|
apps/gograb-ai-extension/manifest.json |
Extension manifest |
apps/gograb-ai-extension/background/service-worker.js |
Main service worker |
apps/gograb-ai-extension/background/mcp-connector.js |
WebSocket connection logic |
apps/gograb-ai-extension/popup/popup.html |
Extension popup UI |
apis/backend-ai-api/src/app/mcp-gateway/native-ws.gateway.ts |
Server-side WebSocket handler |
Responding to This Handoff
When complete, respond via:
curl -X POST "http://localhost:3001/ai-api/infrastructure/handoffs/handoff-1769778720607-2d8cc30f/respond" \
-H "Content-Type: application/json" \
-d '{
"respondingAgent": "cowork-browser-agent",
"status": "completed",
"taskResults": [
{"taskId": "task-1", "status": "completed", "result": "Backend healthy"},
{"taskId": "task-2", "status": "completed", "result": "Extension installed"},
{"taskId": "task-3", "status": "completed", "result": "Connection successful"},
{"taskId": "task-4", "status": "completed", "result": "Badge shows connected"},
{"taskId": "task-5", "status": "completed", "result": "Agent visible in MongoDB"},
{"taskId": "task-6", "status": "completed", "result": "Notification received"}
],
"recommendations": ["Any issues found or suggestions"]
}'
Handoff created by Claude Code (Session 75) for Cowork Agent testing