Repository navigation
feat: add Brainstorm community; generalize Discourse, MATLAB and page tools - #609
Merged
Merged
Conversation
Parse documentation pages with lxml instead of html.parser, which nested everything after an unclosed <p> and lost most of a MoinMoin wiki page. Recognize MoinMoin's div#content as the page body. Every existing MNE page converts identically. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
The parser read only the comments before a function line (EEGLAB style) and
missed the help after it, MATLAB's own convention used by FieldTrip and
Brainstorm. Help stops at a license or copyright notice, %{ %} license blocks
and separator lines are not taken for help, and a classdef file's header is
its help.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
- Honor the configured tags (alone or within categories); they were ignored, so a shared forum such as NeuroStars would have been synced whole. - Read likes from actions_summary and category names from /site.json. - On forums without accepted answers, fall back to the first substantive staff reply; the asker's own liked reply is the last resort. - Run sync.discourse schedules and accept discourse in POST /sync/trigger, which now runs syncs off the event loop. - Record the sync start as the last sync so long runs miss nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
Tutorials from the Brainstorm wiki (108 pages, two preloaded), the user forum, issues and MATLAB help from brainstorm3, bst-users and bst-duneuro, and the four reference papers. Maintained by tmedani. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
fetch_current_page kept the text of every script and read the whole page, so on a Brainstorm tutorial the model saw analytics code instead of the tutorial. Reuse the documentation fetcher's conversion. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
Both had NeuroStars tags configured but no schedule, so their forums were never synced. A test now fails when a forum has no sync.discourse schedule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
Contributor
|
Worker changes detected. After merging to Manual deployment (if needed): cd workers/osa-worker
wrangler deploy --env dev # for develop branch
wrangler deploy # for main branch |
HED does not use NeuroStars as a source. Its forum config and schedule are removed, and with them the search_hed_forum tool. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
The docstring sync only inserted and updated, so removed or renamed functions, deleted files, and text the parser no longer takes for help stayed searchable. Prune each parsed file's stale symbols, and the files missing from a complete repository listing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
A listing page that failed (forum down, or a configured tag or category that does not exist) ended quietly, moved the last-sync time past topics never seen, and counted as a successful job. Such a sync now stores what it read, keeps the last-sync time, and raises DiscourseSyncError, which the scheduler tracks as a failure and the CLI reports. Database errors stop the sync, a non-JSON answer is logged and skipped, and a listing may run to 1,000 pages. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
retrieve_x_docs takes only a url and search_x_discussions has no status filter, so the EEGLAB, FieldTrip, MetaBCI, MNE and Brainstorm prompts taught calls that fail. A test now checks every example call in every prompt against the tool it names. Also clarifies Brainstorm config comments. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
Moves the pruning tests out of tests/test_integration, which the required check skips, and tests sync_repo_docstrings against GitHub served over respx: removed files, truncated listings and failed downloads. Logs the deletions and corrects parser comments. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
The widget page reader now reports a page with no text in its HTML instead of returning an empty success. The worker CORS list is regenerated with scripts/sync_worker_cors.py. Changelog and registry notes updated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11
7 tasks done
2 of 12 tasks
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.
Adds a Brainstorm assistant from the resources its admin (@tmedani) provided. While setting it up I found that several shared tools were not general enough, and some had bugs that also affect other communities. This PR fixes those too.
Brainstorm community (
src/assistants/brainstorm/config.yaml)brainstorm3,bst-users(scripts shared by users) andbst-duneuro.neuroimage.usc.edu. It is allowed incors_originsand in the worker. The maintainer istmedani.Fixes to shared tools, and who they reach
tagshonored; likes, categories and staff answers readbids), MNE, BrainstormfunctionlineDiscourse sync
sync.discoursecrons never ran. Production MNE was last synced by hand on 2026-02-25, and BIDS had 0 topics.POST /sync/triggernow acceptsdiscourseand runs in a worker thread. Note thatallnow includes Discourse, so it can run for hours.tagsis honored. The setting was read and never used; without this fix, a BIDS sync would have downloaded all of NeuroStars.actions_summary, so the most-liked fallback works on any forum. Category names come from/site.json; before, they were always empty.DiscourseSyncError. The scheduler tracks that as a failure, and the CLI exits 1.Prompts
retrieve_*_docstakes only aurl, andsearch_*_discussionshas nostatusfilter. The EEGLAB, FieldTrip, MetaBCI, MNE and Brainstorm prompts showedtitle=...andstatus="open", which teaches the model calls that fail.MATLAB docstrings
Help that follows the
functionline (MATLAB's own convention, used by FieldTrip and Brainstorm) is now indexed. Measured on full clones:License and copyright notices,
%{ %}blocks and separator lines are not taken for help.In EEGLAB, the only changes are 24 docstrings that were empty, a separator or a license, or that ended in a license that is now trimmed.
Pruning: the sync only ever inserted and updated, so removed functions, deleted files and old junk entries stayed searchable. It now prunes them. A file that could not be downloaded is never pruned, and deleted files are pruned only when GitHub's file listing is complete.
HTML documentation and the widget's page reader
div#contentis recognized.html.parserlost about 75% of each Brainstorm tutorial.fetch_current_pageused to keep the text of<script>tags, so on a tutorial the model saw analytics code. It now reads the page's main content only, and reports a page with no readable text instead of returning it empty.Changed
hed, 3 topics, never synced) is removed from HED, along with itssearch_hed_forumtool.Review
Reviewed with the pr-review-toolkit agents, run on Sonnet: code-reviewer, pr-test-analyzer, comment-analyzer, silent-failure-hunter, then code-simplifier. type-design-analyzer was skipped because the PR adds no types.
tests/test_integration, which the required check skips (pr-test-analyzer).Validation
uv run pytest -m "not network": 5,300 passed. The 5 live Discourse tests also pass, including a real Brainstorm forum sync.ruff checkandruff format --checkare clean.After merge
osa sync discourse -c mne --full(about 1.7 hours). The scheduled incremental runs only refresh topics active since the last sync.osa sync discourse -c brainstorm.sync-worker-cors.yml).scripts/sync_worker_cors.pyalso allows*.usc.edu, because it always widens to a domain's last two parts, as it already does for*.github.io.{% include pagelist %}line, so they fetch almost nothing.🤖 Generated with Claude Code
https://claude.ai/code/session_019qLZ5bssRHp7tU3FuMtw11