fix(agent-messages): sentinel temizliği girintiyi yok etmesin#684
Merged
lilyshen0722 merged 1 commit intoJul 19, 2026
Merged
Conversation
sanitizeAgentContent her satıra .trim() uygulayıp .filter(Boolean) ile boş satırları atıyordu. Amaç NO_REPLY sentinel temizliğiydi; yan etkisi agentların yazdığı HER mesajın girintisini ve paragraf yapısını düzleştirmekti. Etki: bir pod'da girintiye duyarlı içerik normal trafiktir (Python, YAML, diff, iç içe markdown). Kullanıcı @auto-router'a tek hatası eksik ':' olan bir Python bloğu gönderdiğinde, agent'a girintisi silinmiş — yani ayrıca IndentationError üreten — bambaşka bir kod ulaşıyordu: router çözülmesi istenen problemi bozuyordu. Agentların cevaplarındaki kod blokları da düzleşiyordu. Kanıt (2026-07-16, canlı): aynı metin iki yoldan yazıldı — messageController (kullanıcı) -> 'def f(x)' / ' y = x + 1' girinti VAR agent runtime (bu yol) -> 'def f(x)' / 'y = x + 1' girinti YOK Düzeltme: yalnız sentinel çıkarılır; satır içi girinti ve boş satırlar korunur. Yalnızca sentinel'dan ibaret satırlar boşa indirgenir (başıboş boşluk kalmasın), baş/son boş satırlar hâlâ kırpılır. Doğrulama (backend restart sonrası, agent runtime endpoint'inden POST): girintili mesaj -> girinti + boş satır korunuyor ✓ 'NO_REPLYNO_REPLY' -> pod'da NO_REPLY izi yok ✓ (temizlik bozulmadı) Not: birim testi (agentMessageService.chatNoise.test.js) bu ortamda çalıştırılamadı — mongodb-memory-server kurulum sırasında binary indirmeye çalışıyor, ağ kapalı. Doğrulama canlı uçtan uca yapıldı. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lilyshen0722
approved these changes
Jul 19, 2026
lilyshen0722
left a comment
Contributor
There was a problem hiding this comment.
Verified against the original NO_REPLYNO_REPLY edge (the 2026-07-03 note survives) and the fix is precisely scoped: sentinel removed, interior indentation and blank lines preserved, sentinel-only lines collapse to blank instead of stray spaces. Whitespace-sensitive agent payloads (Python/YAML/diffs) are core traffic — this was a real correctness bug. Great live verification methodology in the PR body too.
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.
Sorun
AgentMessageService.sanitizeAgentContenther satıra.trim()uygulayıp.filter(Boolean)ile boş satırları atıyordu. AmaçNO_REPLYsentinel temizliğiydi; yan etkisi agentların yazdığı her mesajın girintisini ve paragraf yapısını düzleştirmek.Bir agent pod'unda girintiye duyarlı içerik normal trafiktir: Python, YAML, diff, iç içe markdown.
Etki (canlı gözlem, 2026-07-16)
Kullanıcı
@auto-router'a tek hatası eksik:olan bir Python bloğu gönderdi. Agent'a ulaşan metinde girintiler silinmişti — yani agent, ayrıcaIndentationErrorüreten bambaşka bir kod gördü. Router, çözülmesi istenen problemi bozuyordu. Agentların cevaplarındaki kod blokları da düzleşiyordu.Aynı metin iki yoldan yazılıp karşılaştırıldı:
Değişiklik
Yalnız sentinel çıkarılır; satır içi girinti ve boş satırlar korunur. Yalnızca sentinel'dan ibaret satırlar boşa indirgenir (başıboş boşluk kalmasın), baş/son boş satırlar hâlâ kırpılır.
Doğrulama
Backend restart sonrası, agent runtime endpoint'inden POST:
NO_REPLYNO_REPLY→ pod'daNO_REPLYizi yok ✓ (sentinel temizliği bozulmadı)Not: birim testi (
agentMessageService.chatNoise.test.js) bu ortamda çalıştırılamadı —mongodb-memory-serverkurulum sırasında binary indirmeye çalışıyor, ağ kapalıydı. Doğrulama canlı uçtan uca yapıldı; test beklentileri değişmiyor (sentinel davranışı aynı).🤖 Generated with Claude Code