Sanitize wizard remarks and make remark parsing robust
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
Direzione di ricerca
Inizia da src/lib/agent/output-signals.ts, inclusi AgentOutputSignals.remark() e il controllo dell’echo di REMARK_INSTRUCTION, quindi segui la chiamata analytics.capture per WIZARD_REMARK_EVENT_NAME. Esamina il flusso remark esistente e determina dove dovrebbero essere testati la consegna strutturata e il sanitization; il lavoro è completo quando sono coperti la consegna tipizzata di remark, gli echo e i valori vuoti rifiutati e i payload analytics sanitizzati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
The end-of-run "remark" is free-form model output that we extract from the agent's prose by string-matching a [WIZARD-REMARK] marker (AgentOutputSignals.remark() in src/lib/agent/output-signals.ts) and then ship straight to analytics:
const remark = signals.remark();
if (remark) analytics.capture(WIZARD_REMARK_EVENT_NAME, { remark });
Two problems with this:
1. It's not sanitized (security)
The remark is untrusted, model-generated text captured from output and sent to PostHog analytics with no sanitization. It can carry things we don't want to ingest verbatim: secrets/API keys the model echoed from the environment, file paths or PII, prompt-injection payloads, or control/escape characters. We should sanitize before capturing — strip control chars, redact secret-shaped tokens, cap length, and validate it looks like a single reflection line rather than arbitrary content.
2. Parsing it out of prose is flaky
Marker-scanning the agent's output stream is fragile. We've already hit failure modes:
- The model echoes the ask itself instead of a real remark (fixed narrowly in #806 / the
REMARK_INSTRUCTIONecho check inremark()). - Only the first line after the marker is captured; multi-line or marker-mid-line output is dropped or truncated.
- Any change to prose formatting can silently break extraction.
As noted in the thread: parsing wizard logs/output for remarks is inherently flaky and should be reworked.
Proposed direction
Move remarks off free-text prose parsing onto a structured channel — e.g. have the agent emit the remark via a dedicated tool call / structured output field instead of an inline marker, so it arrives as a typed value we don't have to regex out of the stream. Then run whatever we receive through a sanitization pass before analytics.capture.
Acceptance criteria
- Remark content is sanitized (control chars stripped, secret-shaped tokens redacted, length-capped) before being captured to analytics.
- Remark delivery no longer depends on regex-scanning prose — it comes through a structured/typed channel.
- Echo-of-the-ask and empty/garbage remarks are reliably rejected.
- Tests cover sanitization and the new extraction path.
Context: found while debugging the Windows skill-install issue; remarks broke (#806) and Vincent flagged the parsing approach as flaky and wanting a rework.
- Lingua principale
- TypeScript
- Stelle
- 208
- Fork
- 58
- Merge medio
- 2g 7h
- PR unite (30g)
- 76
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PostHog/wizard
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 2 giorni
-
wizard --version prints unknown when run through npxForse già presa @bryanlundberg l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
PostHog/wizard#1460 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni
-
Self-driving setup: checkbox labels and Confirm button overlap wrapped description textForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PostHog/wizard#986 · 4 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di PostHog/wizard
Issue simili
-
bug Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
scottbenton/Iron-Link#541 ·
I maintainer di solito rispondono entro 1 giorno
-
hosts settings: the SSH address field and the separate User field are two ways to name one SSH userAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
prime-radiant-inc/evener#8161 ·
I maintainer di solito rispondono entro 1 giorno
-
Ignore Rules is not workingApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nicobailon/pi-subagents#3420 ·
I maintainer di solito rispondono entro 1 giorno
-
Edit content TabList: selected tab's icon/label are hidden by its own selection indicator - a11yAperta01 type: bug 99 tag: UX Accessibility
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni