Repository navigation
Description
Summary
The event log's writers cap actor/summary with raw UTF-16 slices at exactly the lengths validateStreamEvent enforces (200 / 500). The validator checks length only, so when an astral character straddles a writer's cap, the event validates, is appended, and a lone high surrogate is persisted into the append-only, hash-chained event log (#1739/#3322). Same defect class as #7694/#7711/#7725/#7731 — at the event log's writer boundary, which none of those fixes covered.
Evidence
Raw slice sites (main 722fbe8aa2):
pm-stack/aggregator/src/sources/live.ts:1065— session-registry event:summary: `session ${r.label} (${r.agentLabel}) merged into the registry`.slice(0, 500)(label/agentLabel are source data)pm-stack/aggregator/src/sources/live.ts:1630— orchestration action event:summary: action.summary.slice(0, 500)(summary comes from the orchestration feed)pm-stack/aggregator/src/sources/live.ts:1643— tier-change event:summary: `tier ${prev} → ${tier} (run ${section.runId})`.slice(0, 500)pm-stack/aggregator/src/server.ts:1248— action-result event:actor: updated.appliedByRun ?? body.byRun.slice(0, 200)(theappliedByRunbranch is pair-safe after aggregator(actions): markResult caps split surrogate pairs — appliedByRun/resultNote stored with a lone surrogate (residual of #7694) #7711; the fallback raw-slices the request'sbyRun)pm-stack/aggregator/src/server.ts:1254— action-result event: constructed summary(... + note).slice(0, 500)(note is caller-supplied)
The receiving side does not re-guard: validateStreamEvent (events.ts:160-171) rejects only length > 200 / length > 500; a 200/500-unit string ending in a lone surrogate passes. EventsStore.record (events.ts:795) validates through it, and the summary is folded into the hash chain (events.ts:308).
Verification (this run, laptop primary @ 722fbe8aa2)
Probe ~/git/fleet/probe-roadmap-events-surrogate/probe.ts (laptop), importing the real validateStreamEvent and EventsStore:
- Writer-shaped summary
("x"×499 + 😀 + "y"×50).slice(0, 500)(thelive.ts:1630expression shape) →validateStreamEventreturnsok; value length 500, last code unit0xd83d(lone high surrogate); UTF-8 round-trip contains U+FFFD. - Writer-shaped actor
("r"×199 + 😀 + "z"×10).slice(0, 200)(theserver.ts:1248fallback shape) → same:ok, lone0xd83dat the tail. - Recording the summary event through a real
EventsStorepersists it: the events JSON file on disk contains the escaped lone surrogate\ud83d.
Why it matters
The event log is the cross-stack audit stream: append-only, hash-chained, rendered in the UI and searched (events.ts:390). A corrupted summary is not a transient display glitch — it is written into the durable record (and its hash), and every UTF-8 read-back renders U+FFFD. Orchestration summaries and session labels are feed data, so a straddling emoji at the boundary is a matter of time, not imagination.
Acceptance criteria
- No event writer can emit an
actororsummaryending in a lone surrogate: pair-safe caps at the five sites above, or an equivalent guard at therecordStreamEvent/validateStreamEventboundary — triage picks the placement (per-site mirrors the aggregator(actions): cleanText caps can split a surrogate pair — a stored action field ends in a lone surrogate #7694-family pattern; a boundary guard covers future writers). - Regression tests: straddling pair at the 500-unit summary cap and at the 200-unit actor cap (fail pre-fix), exact-fit pair at each cap (stays intact), under-cap values unchanged.
- Existing events test suite (
pm-stack/aggregator/test/events.test.ts) passes; hash-chain integrity check stays green for newly written events.
Activity
developing-today commentedon Nov 8, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 10, 2026
🤖 Agent note · triaged
task/small-fix· priority/normal · effort/s ·kind/bugrepo-health:v1:fix:developing-today/code:issue:7740→ queuerepo-health-code-pilot, task 14514 (enqueued by triage-step this run).dezren39 commentedon Nov 10, 2026
agent-note:v1
task 14514 (queue repo-health-code-pilot, lane code-y) — picked up, in progress.
Revalidated fresh: issue #7740 OPEN, no hard-stop labels, no status/needs-triage. Direct execution lane (lane row 5702).
Work: pair-safe capUnits at the five raw-slice writer sites (live.ts x3, server.ts x2) plus a boundary guard in validateStreamEvent (events.ts) dropping a lone trailing surrogate in actor/summary, with regression tests in test/events-surrogate-7740.test.ts. Branch: queue/14514-7740-event-surrogate-caps (laptop worktree ~/git/fleet/14514-7740).
dezren39 commentedon Nov 10, 2026
🤖 Agent note · parked
dezren39 commentedon Nov 10, 2026
🤖 Agent note · awaiting CI (parked)
queue/14514-7740-event-surrogate-caps, head d24409aMerge pull request #8114 from developing-today/queue/14514-7740-event…
dezren39 commentedon Nov 10, 2026
agent-note:v1
task 14514 — done (lane code-k). PR #8114 MERGED 212b60b; issue #7740 CLOSED. Targeted tests: targeted tests verified by prior shifts (recorded on issue #7740); Codex review failed to run (usage limits), zero Codex findings on PR. PR checks were QUEUED in the fleet CI backlog; merged under standing merge authority (verified diff + targeted tests; CI runs on main). Labels cleaned.
dezren39 commentedon Nov 10, 2026
🤖 Agent note · done (already_done)
already_done.