Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Limit response size for github_list_releases tool to prevent context overruns

Aperta
#83 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@blinkagent ci sta già lavorando.

Dal 2/12/2025.

  • #91 di @blinkagent — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
ai, tooling

Direzione di ricerca

Inizia in packages/github/src/tools.ts intorno alla riga 928, nella definizione di github_list_releases. Riproduci la risposta di grandi dimensioni con include_body_and_assets abilitato, quindi traccia come vengono mappati per_page, i body delle release e gli asset. Il lavoro è completato quando le risposte rimangono entro i limiti concordati e indicano chiaramente quando i dati sono stati troncati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

The github_list_releases tool can return excessively large responses that cause the model to exceed context limits, resulting in "Input is too long for requested model" errors in brand new chats.

Root Cause Analysis

When fetching releases with include_body_and_assets: true, the tool returns massive amounts of data. Testing with coder/coder:

  • 5 releases with bodies and assets = ~38KB of JSON
  • Each release has ~24 assets (download URLs, sizes, counts, etc.)
  • Release bodies can be ~1KB each (full changelogs)
  • Requesting 100 releases with full data could exceed 500KB+

The tool implementation at packages/github/src/tools.ts (line ~928) passes data through without any size limits:

list_releases: toolWithOctokit(({ octokit }) =>
  tool({
    inputSchema: z.object({
      owner: z.string(),
      repo: z.string(),
      page: z.number(),
      per_page: z.number(),  // No max limit!
      include_body_and_assets: z.boolean(),
    }),
    execute: async (args, opts) => {
      // ...
      return {
        releases: response.data.map((release) => ({
          // Full body returned, no truncation
          body: args.include_body_and_assets
            ? (release.body ?? undefined)
            : undefined,
          // ALL assets returned
          assets: args.include_body_and_assets
            ? release.assets.map((asset) => ({ ... }))
            : undefined,
        })),
      };
    },
  })
),

Proposed Solution

Modify the tool in packages/github/src/tools.ts:

  1. Cap per_page to a reasonable max (e.g., 10 releases)
  2. Truncate release bodies to ~500-1000 chars with a [truncated] indicator
  3. Limit assets per release to 5-10 most relevant ones
  4. Add response size indicator so the model knows data was limited
list_releases: toolWithOctokit(({ octokit }) =>
  tool({
    inputSchema: z.object({
      owner: z.string(),
      repo: z.string(),
      page: z.number(),
      per_page: z.number().max(10), // Hard cap
      include_body_and_assets: z.boolean(),
    }),
    execute: async (args, opts) => {
      const MAX_BODY_LENGTH = 500;
      const MAX_ASSETS = 5;
      
      const response = await (await octokit()).request(...);
      
      return {
        releases: response.data.map((release) => ({
          // ...
          body: args.include_body_and_assets && release.body
            ? release.body.length > MAX_BODY_LENGTH
              ? release.body.slice(0, MAX_BODY_LENGTH) + '... [truncated]'
              : release.body
            : undefined,
          assets: args.include_body_and_assets
            ? release.assets.slice(0, MAX_ASSETS).map((asset) => ({ ... }))
            : undefined,
          total_assets: release.assets.length, // Let model know if more exist
        })),
        _truncated: true, // Signal that limits were applied
      };
    },
  })
),

Related Context

This affects the Blink agent (coder/agents) which uses github.tools directly. The fix should be in the SDK (coder/blink) since that's where the tool is defined.

Lingua principale
TypeScript
Stelle
165
Fork
20
Merge medio
1m
PR unite (30g)
7

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di coder/blink

Tutte le issue di coder/blink

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.