Skip to content

feat: L2 event manifest as preferred StopLoss feature source - #467

Merged
dahai80 merged 1 commit into
mainfrom
feat/stoploss-l2-source
Dec 2, 2026
Merged

dahai80 merged 1 commit into
mainfrom
feat/stoploss-l2-source

Conversation

@dahai80

@dahai80 dahai80 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

What

StopLoss feature extraction (#449) now prefers the Folio-style L2 event manifest (shipped in #462, FUSION_CODE_L2_MANIFEST=1) over raw stream-json when both exist.

  • stoploss_lib.py: _is_l2_manifest detects the record shape (kind=tool_use/tool_result/text), l2_to_events adapts bounded digests into pseudo stream events so the existing feature extractors work unchanged; resolve_feature_source picks L2 first, stream-json fallback for pre-feat: L2 event manifest sidecar (FUSION_CODE_L2_MANIFEST=1) #462 runs.
  • fusion_code_agent_external.py: after each trial, copy the run's newest matching *.events.jsonl sidecar from ~/.fusion-code/projects into logs_dir as fusion-code-events.jsonl (best-effort, fail-open).
  • stoploss_dataset.py: use resolve_feature_source.

Why

The L2 manifest is bounded (200-char digests), compact, and written at a single choke point — a cheaper and more stable monitor input than multi-MB stream logs. Digest-based fingerprints can collide in theory, which only makes the monitor more conservative.

Validation

S1 trial fix-git__CzCsxVs: L2-derived and stream-derived features agree on all six values (turns=11, no_edit_streak=11, seconds_per_turn=88.87). Synthesized L2 manifest feeds the dataset builder end-to-end (1 sample produced).

Refs #449

🤖 Generated with Claude Code

stoploss_lib now prefers a Folio-style L2 manifest
(fusion-code-events.jsonl, #462) over stream-json when both exist:
_is_l2_manifest detects the record shape, l2_to_events adapts bounded
digests into pseudo stream events (digest-based repeat_identical
fingerprints), resolve_feature_source picks the source. The external
adapter copies the run's newest matching L2 sidecar from
~/.fusion-code/projects into logs_dir so the dataset builder sees it.

Validated on the S1 trial fix-git__CzCsxVs: L2-derived and
stream-derived features agree on all six values (turns=11,
no_edit_streak=11, seconds_per_turn=88.87); stream-json stays as
fallback for pre-#462 runs.

Refs #449

Co-Authored-By: Claude Code <[email protected]>
@dahai80
dahai80 merged commit 41f9e8b into main Dec 2, 2026
1 check passed
@dahai80
dahai80 deleted the feat/stoploss-l2-source branch December 2, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant