Skip to content

Improve MCP serve polling and attachment extraction reliability - #32556

Closed
aydnOktay wants to merge 3 commits into
NousResearch:mainfrom
aydnOktay:feat/mcp-serve-polling-reliability
Closed

Improve MCP serve polling and attachment extraction reliability#32556
aydnOktay wants to merge 3 commits into
NousResearch:mainfrom
aydnOktay:feat/mcp-serve-polling-reliability

Conversation

@aydnOktay

Copy link
Copy Markdown
Contributor

This PR strengthens mcp_serve.py by making EventBridge polling reliable for ISO-8601 UTC timestamps with a Z suffix, deduplicating extracted attachments while preserving order, and normalizing MEDIA: paths so trailing sentence punctuation is not captured as part of file paths; it adds focused regression coverage in tests/test_mcp_serve.py for each behavior and includes PR CI hardening so checks run targeted related tests instead of the full unrelated suite, while supply-chain scanning avoids recurring fixture-driven critical false positives.

aydnOktay and others added 3 commits May 26, 2026 13:51
Add UTC Z-aware timestamp parsing for EventBridge polling, deduplicate extracted attachments, and normalize MEDIA tag paths by stripping trailing punctuation, with regression tests covering each behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Run pull-request test jobs against changed and related test files while keeping full-suite runs on main pushes, and narrow supply-chain critical pattern scanning to reduce fixture-driven false positives.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth labels May 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This PR bundles fixes from three existing open PRs by the same author into a single submission:

All three fixes target mcp_serve.py. Consider whether this superset PR supersedes the individual ones or should be split.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for combining the attachment regressions and adding focused coverage. The attachment work remains relevant, but this branch needs selective salvage against current main.

Problems

  • Current mcp_serve.py:442-472 now uses the state.db routing index introduced by 747386ecf; the PR's sessions.json mtime/cache polling context is obsolete and should not be restored.
  • mcp_serve.py:182 in the PR strips !, ), ], quotes, and other legal filename suffixes unconditionally. That can turn a valid MEDIA: path into a different path.
  • The Z-timestamp change is redundant: supported Python is >=3.11 (pyproject.toml:20), and current main already calls datetime.fromisoformat for EventBridge timestamps (mcp_serve.py:500).

Suggested changes

  • Port only the attachment behavior onto the current state.db-based polling implementation.
  • Preserve literal filenames ending in punctuation, with regression coverage for that case, before adding punctuation normalization.

Automated hermes-sweeper review.

Comment thread mcp_serve.py
media_pattern = re.compile(r'MEDIA:\s*(\S+)')
for match in media_pattern.finditer(text):
path = match.group(1)
path = match.group(1).rstrip(".,;:!?)]}\"'")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unconditionally changes valid local filenames such as MEDIA:/tmp/report! or MEDIA:/tmp/a]. Please use a delimiter-aware MEDIA syntax, or otherwise preserve literal punctuation and add coverage for those valid path suffixes.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
@aydnOktay

Copy link
Copy Markdown
Contributor Author

Closing to concentrate review on a single linked product bug: #89979.

@aydnOktay aydnOktay closed this Aug 19, 2026
@aydnOktay

Copy link
Copy Markdown
Contributor Author

Closing to concentrate review on a single linked product bug: #89979.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants