github / github/copilot-cli

Tool call hangs after extension startup fails

Ouverte
#4,670 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

area:plugins area:sessions area:tools
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

Describe the bug

After I resumed a large session, an extension failed inside joinSession() before reporting ready, and its process exited.

The CLI continued to offer the extension's custom tool. I asked the CLI to call it. The CLI started the call, but the handler did not run and the call reported no error. I aborted it after 9 minutes 38 seconds.

This issue concerns cleanup and dispatch after extension startup failure. A separate large-session attachment defect triggered the failure in this run.

Environment
GitHub Copilot CLI 1.0.82
@github/copilot-sdk 1.0.9-preview.2
Node.js v24.18.1
Linux x86_64
Confirmed startup trigger

I traced the installed 1.0.82 app.js bundle. joinSession() sends a session.resume request containing registration options rather than session history. The host still serializes the resident session's full event array while attaching the extension:

  1. handleSessionResumeCore() handles session.resume and calls the host's initializeSession() with replayEvents: false.
  2. The host's initializeSession() ignores that option and passes session.getEvents() to seamHost.initializeSession().
  3. seamHost.initializeSession() calls JSON.stringify(events).

Node.js v24.18.1 rejects JavaScript strings longer than 536,870,888 UTF-16 code units and throws Invalid string length. I estimated each serialized event array's length from its session event log. Extension attachment succeeded below the limit and failed above it.

In the run that reproduced the stale registration, joinSession() failed with Invalid string length. That session's events.jsonl file was about 1.2 GB.

Honoring replayEvents: false would remove this trigger. Registration cleanup must still handle every startup failure.

Reduced extension
import { writeFile } from "node:fs/promises";
import { joinSession } from "@github/copilot-sdk/extension";

await joinSession({
    tools: [{
        name: "stale_tool_probe",
        description: "Verify extension tool lifecycle.",
        parameters: {
            type: "object",
            properties: {},
            additionalProperties: false,
        },
        skipPermission: true,
        handler: async () => {
            await writeFile(
                new URL("handler-ran.marker", import.meta.url),
                "handler ran\n",
            );
            return "handler-ran";
        },
    }],
});
Observed sequence
  1. I stored the reduced extension under ~/.copilot/session-state/<session-id>/extensions/stale-tool-probe/extension.mjs.
  2. I resumed the large session.
  3. joinSession() failed with Invalid string length before the extension reported ready, and the extension process exited.
  4. I asked the CLI to call stale_tool_probe. The CLI started the call instead of rejecting it as an unknown tool.
  5. The call was still pending when I aborted it. handler-ran.marker did not appear.
Expected behavior
  • The CLI offers an extension's registrations only while the extension is ready and connected.
  • Startup failure or process exit removes every registration owned by that extension.
  • A tool call fails promptly if its owning extension is unavailable at dispatch or exits while the call is pending.
Actual behavior
  • The failed extension's tool remained available after its process exited.
  • The call did not reach the handler or report an error.
Related issues

#4590 reports a different session.resume failure involving hook-processor disposal during extension reconnects.

#3856 reports the inverse symptom: Extension tools disappear after a resume.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le cycle de vie de l’extension autour de joinSession(), handleSessionResumeCore(), initializeSession() et seamHost.initializeSession(), en utilisant l’extension stale_tool_probe reproduite comme point d’entrée. Suivez l’échec du démarrage, le nettoyage des enregistrements et le dispatch pendant que le processus n’est pas disponible. Le travail est terminé lorsque les extensions ayant échoué ou s’étant arrêtées n’exposent plus d’enregistrements et que les appels d’outils en attente ou nouveaux échouent rapidement au lieu de rester bloqués.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, node.js
Domaine
backend, cli
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
64/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.