fix(plugin): restore understand_media parsing against the current everos parser - #273
Merged
Merged
Conversation
…ros parser EverOS moved multimodal LLM resolution into aparse_file and dropped the llm keyword from enrich_content_items, so every understand_media call raised TypeError. The per-item `except Exception` then reported it as "could not understand" once per attachment, hiding an interface mismatch behind a plausible per-file failure. Drop the stale keyword; keep the up-front client probe so an unconfigured deployment still fails once rather than once per file; and re-raise a TypeError from the parser as a batch-level MultimodalUnavailableError, since a signature mismatch is true of every attachment. Also steer image reads to read_file in the tool description. Both tools claimed images, so the model could pick the one that returns another model's transcription instead of the picture itself. The existing tests stub understand_files wholesale and never reach everos, which is why the drift was invisible; the new contract tests stub only the parser-extra probe and the vision call. Scoping this file's sys.modules cleanup fixture to the fakes it injects stops it from evicting lancedb, whose Rust extension panics when re-imported. Co-authored-by: Claude (claude-opus-5[1m]) <noreply@anthropic.com>
Cover the branches the parser-contract class left untested: an unconfigured LLM failing the whole call exactly once (the reason for the up-front client probe), the parser extra missing, per-item degradation for unsupported modalities and LLMError parse_error read-back, and a missing file mixed into a batch. Co-authored-by: Claude (claude-fable-5) <noreply@anthropic.com>
0xKT
previously approved these changes
Aug 6, 2026
.pre-commit-config.yaml pins ruff v0.15.12 while the dev group resolves 0.15.11, and 0.15.12 collapses these signatures onto a single line. Local `uv run ruff format --check` therefore passes on the same files that the `pre-commit diff` job rejects. Formatting only; no test behaviour changes. Co-authored-by: Claude (claude-opus-5[1m]) <noreply@anthropic.com>
The dev group resolved ruff 0.15.11 while .pre-commit-config.yaml pins v0.15.12, and the two disagree on formatting, so `uv run ruff format --check` passed on files the `pre-commit diff` job then rejected. An exact pin is what removes the drift. A range does not: local ruff only has to differ from the hook's version, in either direction, for the two to format the same file differently. This now has to move in lockstep with the rev in .pre-commit-config.yaml. The looser `ruff>=0.6.0` in the published `dev` extra is left alone; it is for consumers installing `raven[dev]`, not what `uv run ruff` resolves. Co-authored-by: Claude (claude-opus-5[1m]) <noreply@anthropic.com>
0xKT
self-requested a review
August 6, 2026 09:41
0xKT
approved these changes
Aug 6, 2026
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
understand_mediahas been failing on every call. EverOS moved multimodal LLM resolution intoaparse_fileand dropped thellmkeyword fromenrich_content_items, so the call raisedTypeError. The per-itemexcept Exceptionthen degraded that into a per-file[could not understand: ...]note, so an interface mismatch read like an attachment the parser could not handle.Three changes:
llm=keyword. The up-frontget_multimodal_llm_client()probe stays: the parser resolves its own client per file, so without it an unconfigured deployment reports the same failure once per attachment.TypeErrorfrom the parser as a batch-levelMultimodalUnavailableError. A signature mismatch is true of every attachment, so per-item degradation is the wrong shape for it.read_filein the tool description. Both tools claimed images, so the model could pick the one that hands back another model's transcription instead of the picture itself. This matches whatrender.build_user_contentalready tells the model next to each attachment.The existing tests stub
understand_fileswholesale and never reach everos, which is why the drift was invisible.TestEverosParserContractstubs only the two external boundaries -- the optional parser extra's availability probe and the vision call -- and lets the realenrich_content_itemsrun, so the next signature change fails a test instead of a user. It covers the failure contract as a whole: a signature mismatch aborts the batch; an unsupported modality, an LLM error and a missing file are each reported per item without stopping the rest; and an unconfigured client or a missing parser extra fails the call once, before any file is parsed.That exposed a pre-existing isolation bug in the same test file: the autouse
_cleanup_modulesfixture evicted every module a test imported, including lancedb, whose Rust extension panics when re-imported after a logger is installed. It now clears only the fakes it injects.Fixing the
pre-commit diffjob then surfaced a second version skew..pre-commit-config.yamlpins ruff v0.15.12 while the dev group resolved 0.15.11, and the two format the same signatures differently, souv run ruff format --checkpassed locally on files CI rejected. The dev group is now pinned toruff==0.15.12. A range does not fix this: local ruff only has to differ from the hook's version, in either direction, for the two to disagree. The publisheddevextra keeps its looserruff>=0.6.0, since that is for consumers installingraven[dev]rather than whatuv run ruffresolves.Not covered here:
read_fileon a PDF still ends atError reading file: 'utf-8' codec can't decode byte ...with no pointer tounderstand_media, andrender.build_user_contentnamesunderstand_mediaunconditionally even where the plugin is not registered. Both need a way for core code to refer to an optional tool without hardcoding its name, which is worth designing separately.Type
Verification
uv run pytest tests/ --ignore=tests/integration-> 1 failed, 5176 passed, 40 skipped. The failure istests/test_cli_theme.py::test_bold_accent_renders_styled_not_bare, which fails identically on an unmodified checkout (the local terminal reports 16-color rather than truecolor) and passes in theunitjob here.uv run pytest tests/test_plugin_tools.py-> 36 passed.uv run ruff format .-> 873 files left unchanged, anduv run ruff check .-> All checks passed, both on the newly pinned 0.15.12.uv run pre-commit runover this branch's diff -> every hook Passed or Skipped, with the working tree unmodified afterwards. This is the same command thepre-commit diffjob runs.The new tests were confirmed red before the fix, reporting
enrich_content_items() got an unexpected keyword argument 'llm'-- the same string users were seeing.Relevant tests pass locally
Relevant lint / type checks pass locally
Risk
understand_mediagoes from always-failing to working, so attachments that used to produce "could not understand" now spend vision-model calls and tokens. It still requiresEVEROS_MULTIMODAL__*; an unconfigured deployment gets one clear error instead of one per file.A
TypeErroranywhere under the parser now aborts the batch rather than degrading a single file. That is the intent; per-item isolation is unchanged for every other exception.The dev ruff pin is exact, so it has to be bumped together with the rev in
.pre-commit-config.yaml. Moving one without the other puts local formatting and CI back out of step.No schema, config, or on-disk format changes. Rollback is a revert of these commits.
Backward compatibility considered
Rollback path is clear for risky changes
Related Issues
N/A