@debugg-ai/debugg-ai-mcp 1.0.47 → 1.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,36 @@ const logger = new Logger({ module: 'testPageChangesHandler' });
15
15
  // Cache the template UUID and project UUIDs within a server session to avoid re-fetching
16
16
  let cachedTemplateUuid = null;
17
17
  const projectUuidCache = new Map();
18
+ // Concurrency control — max 2 simultaneous browser checks.
19
+ // Additional requests queue and run when a slot opens.
20
+ const MAX_CONCURRENT = 2;
21
+ let running = 0;
22
+ const queue = [];
23
+ async function acquireSlot() {
24
+ if (running < MAX_CONCURRENT) {
25
+ running++;
26
+ return;
27
+ }
28
+ await new Promise((resolve) => queue.push({ resolve }));
29
+ }
30
+ function releaseSlot() {
31
+ running--;
32
+ const next = queue.shift();
33
+ if (next) {
34
+ running++;
35
+ next.resolve();
36
+ }
37
+ }
18
38
  export async function testPageChangesHandler(input, context, progressCallback) {
39
+ await acquireSlot();
40
+ try {
41
+ return await testPageChangesHandlerInner(input, context, progressCallback);
42
+ }
43
+ finally {
44
+ releaseSlot();
45
+ }
46
+ }
47
+ async function testPageChangesHandlerInner(input, context, progressCallback) {
19
48
  const startTime = Date.now();
20
49
  logger.toolStart('check_app_in_browser', input);
21
50
  const client = new DebuggAIServerClient(config.api.key);
package/dist/index.js CHANGED
@@ -199,6 +199,18 @@ process.on('SIGTERM', async () => {
199
199
  await Telemetry.shutdown();
200
200
  process.exit(0);
201
201
  });
202
+ process.on('unhandledRejection', (reason) => {
203
+ logger.error('Unhandled promise rejection', {
204
+ error: reason instanceof Error ? reason.message : String(reason),
205
+ stack: reason instanceof Error ? reason.stack : undefined,
206
+ });
207
+ });
208
+ process.on('uncaughtException', (error) => {
209
+ logger.error('Uncaught exception', {
210
+ error: error.message,
211
+ stack: error.stack,
212
+ });
213
+ });
202
214
  /**
203
215
  * Start the server
204
216
  */
@@ -14,6 +14,7 @@ let initialized = false;
14
14
  * Resolve the current project context: repo → project → environments → credentials.
15
15
  * Safe to call multiple times — caches after first successful resolution.
16
16
  */
17
+ const STARTUP_TIMEOUT_MS = 10_000; // hard cap so we never block MCP connection
17
18
  export async function resolveProjectContext() {
18
19
  if (initialized)
19
20
  return cached;
@@ -23,6 +24,24 @@ export async function resolveProjectContext() {
23
24
  logger.info('No git repo detected — skipping project context');
24
25
  return null;
25
26
  }
27
+ try {
28
+ // Race against a timeout so a slow/unreachable backend never blocks startup
29
+ return await Promise.race([
30
+ resolveProjectContextInner(repoName),
31
+ new Promise((resolve) => {
32
+ setTimeout(() => {
33
+ logger.warn('Project context resolution timed out — continuing without it');
34
+ resolve(null);
35
+ }, STARTUP_TIMEOUT_MS);
36
+ }),
37
+ ]);
38
+ }
39
+ catch (err) {
40
+ logger.warn(`Failed to resolve project context: ${err}`);
41
+ return null;
42
+ }
43
+ }
44
+ async function resolveProjectContextInner(repoName) {
26
45
  try {
27
46
  const client = new DebuggAIServerClient(config.api.key);
28
47
  await client.init();
@@ -71,13 +71,20 @@ export const createWorkflowsService = (tx) => {
71
71
  });
72
72
  return execution;
73
73
  }
74
+ // Check abort before sleeping to avoid missing a signal fired between polls
75
+ if (signal?.aborted) {
76
+ throw new Error(`Polling cancelled for execution ${executionUuid}`);
77
+ }
74
78
  await new Promise((resolve, reject) => {
75
79
  const timer = setTimeout(resolve, POLL_INTERVAL_MS);
76
80
  if (signal) {
77
- signal.addEventListener('abort', () => {
81
+ const onAbort = () => { clearTimeout(timer); reject(new Error(`Polling cancelled for execution ${executionUuid}`)); };
82
+ if (signal.aborted) {
78
83
  clearTimeout(timer);
79
84
  reject(new Error(`Polling cancelled for execution ${executionUuid}`));
80
- }, { once: true });
85
+ return;
86
+ }
87
+ signal.addEventListener('abort', onAbort, { once: true });
81
88
  }
82
89
  });
83
90
  }
@@ -14,6 +14,7 @@ export class AxiosTransport {
14
14
  instance ??
15
15
  axios.create({
16
16
  baseURL: baseUrl.replace(/\/+$/, "/"),
17
+ timeout: 30_000,
17
18
  headers: {
18
19
  Accept: "application/json",
19
20
  "Content-Type": "application/json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugg-ai/debugg-ai-mcp",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.",
5
5
  "type": "module",
6
6
  "bin": {