Skip to content

fix(search): distinguish invalid QMD output - #47

Merged
moomooskycow merged 1 commit into
masterfrom
exec/exocortex-typed-search-failure
Sep 1, 2026
Merged

fix(search): distinguish invalid QMD output#47
moomooskycow merged 1 commit into
masterfrom
exec/exocortex-typed-search-failure

Conversation

@moomooskycow

Copy link
Copy Markdown
Contributor

Intent

Stop directing operators toward installation or collection recovery when QMD exits successfully but violates its JSON output contract.

Decision

Add the typed qmd.ErrInvalidOutput boundary for non-JSON and malformed JSON stdout. CLI and MCP continue to return the stable search_unavailable conflict but now use a data-specific recovery hint for producer output failures; process/dependency failures keep the installation/index hint. Integer and decimal score shapes remain native float64 decoding.

The historical deployed failure no longer reproduces with installed QMD 2.6.3: the exact September BM25 journal query now returns structured results. The malformed fixture preserves the original decimal-boundary failure shape and proves truthful handling if it recurs.

Checks

  • ./scripts/check.sh: passed.
  • CLI and MCP malformed-output boundary tests: passed.
  • QMD integer/decimal score and malformed-output tests: passed.
  • Real go run ./cmd/exocortex search September --mode bm25 --type journal: returned structured Daybook results.

Rollback

Revert this PR. Search dependency failures remain unchanged; only successful-process invalid-output diagnostics would return to the generic hint.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 97c76d00-7677-4a63-a2ff-49938cbd4cf6

📥 Commits

Reviewing files that changed from the base of the PR and between b45e427 and 601bb7d.

📒 Files selected for processing (7)
  • internal/cli/cli.go
  • internal/cli/orient_test.go
  • internal/mcp/mcp.go
  • internal/mcp/search_test.go
  • internal/qmd/qmd.go
  • internal/qmd/qmd_test.go
  • modules.budget

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T23:40:08.557890Z 601bb7d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 601bb7d02b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/qmd/qmd.go
var ErrInvalidOutput = errors.New("qmd returned invalid search output")

// FailureHint distinguishes dependency failures from invalid producer output.
func FailureHint(err error) string {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the invalid-output hint to brief

When exocortex brief receives malformed or non-JSON output from both the hybrid query and its BM25 fallback, qmd.Search returns ErrInvalidOutput, but cmdBrief still emits its hard-coded installation/indexing hint at internal/cli/cli.go:482. As a result, the new classification remains bypassed for the core brief operation and continues sending operators toward the wrong recovery action; route that error through FailureHint(err) as well.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

@moomooskycow
moomooskycow merged commit 72d31d6 into master Sep 1, 2026
2 checks passed
@moomooskycow
moomooskycow deleted the exec/exocortex-typed-search-failure branch September 1, 2026 23:41
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.

1 participant