Fix /solve echo bug, type errors, ruff config & README inconsistencies - #2
Merged
Merged
Conversation
Correctness: - /solve now echoes the caller's submitted problem instead of the canned playbook example. Returns a copy via dataclasses.replace so the cached KB singleton is not mutated. The LLM-fallback branch also stopped dropping the domain hint and calling _rule_match twice. - Add regression test test_solve_echoes_submitted_problem. Type safety (mypy 4 -> 0): - Wrap ChatOpenAI api_key in SecretStr. - Coerce non-str response.content to str before parsing. - Mark optional neo4j/langchain_ollama imports type: ignore[import-not-found]. Config: - Move ruff select/ignore under [tool.ruff.lint] (removes deprecation warning). Docs (README): - Remove stray line corrupting the Mermaid architecture diagram. - Rewrite 4-Section Canon as 8-Section Canon (matches prompt/examples/model). - Fix endpoint list and test count (15 -> 17); drop stray heading. - Fix malformed single-quote docstring in test_api.py. Verified: pytest 16 passed/2 skipped, ruff clean, mypy clean.
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.
Summary
Fixes a real correctness bug plus 4 type errors, 1 config deprecation, and 5 documentation bugs found during review.
🐛 Correctness
/solvereturned the canned example problem instead of the user's input. Submitted "…across 2M accounts…", got back "…across 2 million accounts…". Fixed insolve()and the LLM-fallback branch viadataclasses.replace(...)— a copy, since mutating the cached KB singleton would corrupt later calls. The fallback branch also dropped thedomainhint and called_rule_matchtwice; both fixed.test_solve_echoes_submitted_problemas a regression guard.🔒 Type safety (mypy: 4 → 0)
ChatOpenAI(api_key=...)wrapped inSecretStr.strresponse.contentcoerced tostrbefore parsing.neo4j/langchain_ollamaimports marked# type: ignore[import-not-found].⚙️ Config
pyproject.toml: ruffselect/ignoremoved under[tool.ruff.lint]— removes the deprecation warning on every run.📄 README
SolutionResponse./agent,/domainsnever existed).15 tests→17 tests.# Community Updateheading."docstring intest_api.py.Verification
pytest: 16 passed, 2 skipped (graph tests require Neo4j — by design)ruff check .: All checks passed! (no deprecation warning)mypy src: Success: no issues found in 17 source filesFiles changed
src/agent/sentinel.py·src/graph/neo4j_client.py·pyproject.toml·tests/test_api.py·README.md