Repository navigation
fix: plafonner le streaming sans résultat dans les snapshots + timeout 60 s skippable (bouton « Passer le timeout ») - #384
Open
kryptonfly wants to merge 10 commits into
Conversation
run_command streams each stdout/stderr chunk as a separate tool.output event. A chatty command (e.g. a process printing in a tight loop) can emit thousands of chunks per second, bloating the session event log (observed: 172k events / 472 MB for a single call, and the turn never completed so cleanupOldEvents never ran). The final tool.result already carries the complete (truncated) output, so cap the persisted streaming chunks at 500 per call; the cap is per tool call, not per session.
Each command.skipTimeout click now extends the deadline by a fixed SKIP_TIMEOUT_WINDOW_MS (60s) instead of re-arming a fresh window sized to the command's own timeout. The UI mirrors the same fixed extension so the displayed total grows predictably. Shared constant lives in src/shared/constants.ts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexte
Cinq correctifs identifiés sur l'instance locale (portés du bundle dist vers la source) :
Snapshots : plafonner le streaming des appels sans résultat
trimSnapshotStreamingOutput(fold-state.ts) plafonne désormais la sortie streaming des tool calls sans résultat : max 200 chunks / 100 Ko, la fin (tail) est conservée, flagstreamingOutputTruncated+ compteurtruncatedStreams(additif, compatible avec les callers existants).run_command: timeout par défaut 120 s → 60 sshell.ts: timeout par défaut ramené à 60 s (description mise à jour).run_command: bouton « Passer le timeout » / « Skip timeout »command.skipTimeout(message client,protocol.ts) + handler WS (server.ts) → ackskipped:true/NO_ACTIVE_TIMEOUT/INVALID_PAYLOAD.skipCommandTimeout(toolCallId)(shell.ts) : chaque clic accorde une fenêtre de timeout complète supplémentaire (re-arm viaonTimer), pas infini.RunCommandView: bouton visible pendantstatus === 'pending', feedback client✓ +60 spendant 2,5 s.ToolCallDisplay:timeout ?? 60_000+ passage ducallIdréel (fix du bugINVALID_PAYLOADcausé parargs.idundefined).tool.outputpersistés par tool callcreateToolProgressHandler(tool-streaming.ts) limite désormais la persistance des chunks streaming à 500 événements par tool call (compteur par call, pas par session). Une commande très bavarde (ex. un process qui écrit en boucle serrée) peut émettre des milliers de chunks par seconde ; sans bornage, chaque chunk devenait un événementtool.outputdistinct et gonflait le log de session (observé : 172k événements / 472 Mo pour un seul appel, et le turn n'ayant jamais terminé,cleanupOldEventsn'a jamais pu les supprimer). Letool.resultfinal porte déjà la sortie complète (tronquée), les chunks persistés ne servent qu'à l'affichage live et à la récupération après crash — le plafonner borne le log sans perdre le résultat.Tests
folding.test.ts: plafond (1100 chunks → tail conservé,truncatedStreams), petit stream intact.shell-streaming.test.ts:skipCommandTimeout(id inconnu → false ; commande 1,2 s / timeout 1 s / skip à 400 ms → succès, registry nettoyé).RunCommandView.test.tsx: bouton + envoicommand.skipTimeoutavec lecallId, feedback, bouton absent si fini.tool-streaming.test.ts: cap par appel (500 événements max, premier chunk conservé), compté par tool call et non par session.Suite complète : 5832 tests passés ; typecheck server + web OK ; eslint + prettier OK ; builds tsup + vite OK.
Vérification sur l'instance en cours
WS testé :
command.skipTimeoutavec un id inactif → réponseNO_ACTIVE_TIMEOUT(case active). Session locale débloquée : unrun_commanden boucle VEH infinie (drtest.exe, ~2500 chunks/s) avait produit 172k événementstool.output(472 Mo) et le process était resté orphelin après un redémarrage du serveur, bloquant le turn (aucuntool.result). Ces patchs sont déjà appliqués sur le bundle dist local ; cette PR est la solution durable (les patchs dist seront écrasés parnpm update -g openfox).