Repository navigation
Ask NEMAR's model for one condition per events call - #489
Merged
Merged
Conversation
On nemar.org with 0.8.14 a model asked for all 320 stimulus events of nm000132 sub-001 N170 in one get_events call, sorted them into faces and scrambled faces while copying sample indices into code, and averaged 282 'faces' (the recording has 80) for a 0.6 uV difference where the worked example measures about 4 uV. It also rewrote the filter's slice to start at 0 and excluded EOG channels by exact name, which matched none of ERP CORE's HEOG_left, HEOG_right, VEOG_lower. The prompt now asks for one condition per call, the code asserts each list's length against that call's total_count, the filter's slice is to be kept as written, and non-EEG channels are matched by substring. Tested: pytest test_nemar_runtime and test_nemar_mcp_wiring 43 passed (two new prompt pins); bun frontend/test-data-lane.js 93/93; ruff clean.
This was referenced Sep 24, 2026
Review of #489: a condition longer than get_events' limit (1000 by default) comes back truncated while total_count counts all of it, so the assert would fire and a model might match it to the short list. The prompt now says to raise limit or page with offset while truncated is true. The fallback that told the model to sort an unfiltered answer by hand, contradicting the new rule, now says to report that the filter was ignored. The prompt pins compare whitespace-collapsed text and now cover the EOG/ECG/EKG/EMG list itself. Tested: pytest test_nemar_runtime and test_nemar_mcp_wiring 43 passed; narrowing the list to EOG, and dropping the truncated sentence, each fail a pin; bun frontend/test-data-lane.js 93/93; ruff clean.
Member
Author
Review responseOne Sonnet review, which also checked the prompt against the live server:
|
This was referenced Sep 24, 2026
Merged
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.
Found in the production check on nemar.org/dataset/nm000132 right after 0.8.14 went live.
What went wrong
Asked for an ERP image of faces and scrambled faces at PO8 in sub-001's N170 recording:
nemar_get_eventswithwhere: {"trial_type": ["stimulus"]}, which returned all 320 stimuli (faces, cars, scrambled faces, scrambled cars).sample_indexvalues into the code. The face list began with 410, a response event, and the run reported 282 face and 280 scrambled-face epochs for a recording that has 80 of each.taps // 2later.HEOG,VEOG), which matched none of ERP CORE'sHEOG_left,HEOG_right,VEOG_lower, and reported "33 EEG channels".The prompt allowed all of this. Its example asked for both conditions in one call (
["face", "scrambled_face"]) and said only "put the indices into the code as a list literal per condition".The change
where: {"event_type": ["face"]}, then a second call forscrambled_face.total_countcounts afterwhere, so it is that condition's count. The prompt says never to sort one call's mixed rows by hand.total_count, shown as code, so a copying slip stops the run instead of averaging the wrong epochs.EOG,ECG,EKG,EMGanywhere in the label, with ERP CORE's labels named, and the model says how many EEG channels remain.Tests
pytest tests/test_assistants/test_nemar_runtime.py tests/test_assistants/test_nemar_mcp_wiring.py: 43 passed, including two new pins for these instructionsbun frontend/test-data-lane.js: 93 passed (the ERP filter block is still found and still filters)A model's behavior cannot be unit-tested; the check is the same question on test.nemar.org once develop serves this, then on nemar.org after a patch release.
Refs #497.