Skip to content

fix: resolve debate context amnesia, swarm json decoding, and windows ssrf guards - #1073

Closed
ramashishmaurya wants to merge 7 commits into
SynapseKit:mainfrom
ramashishmaurya:fix-multiple-agent-logic-bugs
Closed

ramashishmaurya wants to merge 7 commits into
SynapseKit:mainfrom
ramashishmaurya:fix-multiple-agent-logic-bugs

Conversation

@ramashishmaurya

Copy link
Copy Markdown
Contributor

Summary

This PR addresses several critical logic bugs across the agent framework and loaders, including debate context amnesia, SwarmAgent JSON decoding failures, and Windows-specific SSRF false positives.

Closes #

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / internal improvement
  • Dependency / tooling update

Changes

  • Debate Context Fix: Injected the full conversation transcript and explicit roles into the rebuttal and defense prompts in DebateOrchestrator to prevent context amnesia caused by ReActAgent clearing its scratchpad.
  • SwarmAgent JSON Parsing Fix: Added Markdown block stripping to _score_complexity and _decompose to prevent JSONDecodeErrors when LLMs wrap output in backticks, which previously caused the agent to fail task decomposition.
  • Windows SSRF Guard Fix: Updated RSSLoader to ignore 1-character schemes (like C:) to prevent urlparse from blocking valid local Windows file paths.
  • Test Suite Fix: Increased the sleep duration in TestPythonREPLTool.test_timeout_on_slow_operation to 10 seconds to reliably trigger timeouts and account for Windows background process overhead.

Testing

  • All existing tests pass (uv run pytest tests/ -q)
  • New tests added for new behaviour
  • No API keys or secrets in the code

Documentation

  • Docstrings updated (if public API changed)
  • synapsekit-docs updated (if new feature)
  • CHANGELOG.md updated

Notes for reviewer

All fixes represent logic and edge-case patches without altering the public API. The Windows SSRF fix in rss.py specifically targets the urlparse edge case where C:/ parses "c" as a URL scheme.

@AmitoVrito AmitoVrito left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

branch is way behind main (~28 commits). the debate orchestrator + the context-amnesia fix already landed in #1072, so that part is a dup and conflicts. couple other things:

  • scratch.py / scratch3.py / fake_audit.jsonl / pr_body.md look like local junk, drop them + gitignore
  • test_semantic_compressor uses unittest.mock.AsyncMock, we don't allow mocks in tests, use a small hand-written fake llm
  • too much in one PR. the rss windows scheme fix and swarm json fence stripping are both fine on their own, can you split those into two small PRs rebased on current main, each with a regression test?
  • SemanticCompressorMemory doesn't subclass the memory base and add() is sync while get_messages() is async (and get_messages triggers llm calls as a side effect). needs a design pass before it fits, lets scope it in an issue first

the unrelated sleep(5)->sleep(10) in test_tools also needs a reason or should come out.

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Hey Ashish, thanks for this. Couple of blockers before it can go in:

The genuinely new stuff worth keeping is the swarm JSON fence stripping and the RSS single-char scheme fix for Windows paths. Could you rebase on latest main and split those into two small focused PRs? The fence-stripping block is duplicated in both swarm methods too, would be nice as a shared helper. Appreciate it.

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Thanks for this, @ramashishmaurya — several of these are real issues. I'm going to close this PR unmerged and reimplement the salvageable fixes fresh on main, because the branch has drifted too far to merge safely:

I'll port the Swarm and RSS fixes (plus the debate role/name prompt injection) onto current main with proper regression tests, and credit you as co-author. Closing in favour of that — really appreciate you surfacing these.

@AmitoVrito AmitoVrito closed this Nov 4, 2026
AmitoVrito added a commit that referenced this pull request Nov 4, 2026
fix: swarm JSON fences, RSS Windows paths, debate role prompts (reimpl of #1073)
ramashishmaurya pushed a commit to ramashishmaurya/SynapseKit that referenced this pull request Nov 7, 2026
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.

2 participants