Skip to content

fix(pantry-pro): address review feedback from #368 - #371

Merged
uzair401 merged 4 commits into
openhome-dev:devfrom
ileana-pr:fix-pantry-pro-review-feedback
Aug 31, 2026
Merged

fix(pantry-pro): address review feedback from #368#371
uzair401 merged 4 commits into
openhome-dev:devfrom
ileana-pr:fix-pantry-pro-review-feedback

Conversation

@ileana-pr

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #368 (@Rizwan-095). Addresses the three review notes that landed after approval/merge:

  1. Load/save safety_load() now returns a success flag. A missing file is fine (empty pantry); a failed read sets load_ok=False, the session refuses to mutate, and _save() will not delete-then-write over real inventory. Same guard on the background daemon.
  2. Item matching — merges (add) use exact or singular/plural only (_names_match_strict), so almond milk no longer bumps milk. Fuzzy substring match stays for lookups (used/remove/update), preferring the longest name.
  3. user_profile.md — recipe LLM fallback reads it for diet/household context (read-only, never written).

Test plan

  • With a saved pantry, simulate a bad inventory read and confirm add/remove does not wipe stock
  • Add milk, then add almond milk — both should exist as separate items
  • Say I used the eggs when stock has egg (or vice versa) — singular/plural still matches
  • Ask for recipe ideas when user_profile.md mentions a diet preference — suggestions should respect it
  • Confirm expiry daemon still loads/saves with the same load_ok guard

Made with Cursor

Refuse saves when inventory failed to load so a bad read cannot wipe stock.
Merge only on exact or singular/plural names; keep fuzzy match for lookups.
Read user_profile.md for recipe suggestions (diet/household), never write it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔀 Branch Merge Check

PR direction: fix-pantry-pro-review-feedbackdev

Passedfix-pantry-pro-review-feedbackdev is a valid merge direction

@github-actions

Copy link
Copy Markdown
Contributor

✅ Community PR Path Check — Passed

All changed files are inside the community/ folder. Looks good!

@github-actions github-actions Bot added the community-ability Community-contributed ability label Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Ability Validation Passed

📋 Validating: community/pantry-pro
  ✅ All checks passed!

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Lint Results

Files linted: community/pantry-pro/background.py community/pantry-pro/main.py

✅ Flake8 — Passed

✅ All checks passed!

Read the whole list when asked instead of truncating. Ask and apply
expiry dates one item at a time for perishables, and answer when a
specific item expires.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ileana-pr

Copy link
Copy Markdown
Contributor Author

Pushed follow-up live-test fixes onto this branch:

  1. Whole list — “give me the whole list” / “want the whole list?” reads every item instead of “and N more.”
  2. Per-item expiry — a date answer applies only to the item asked about; remaining items are asked one at a time. Dry goods like pasta/sauce are not prompted.
  3. Item date lookup — “when does the ground beef expire?” returns that item’s date instead of the “expiring soon” summary.

does_match() hardcoded a HOTWORDS tuple that duplicated whatever gets configured
as this ability's dashboard trigger words -- a second source of truth that can
drift from the first with nothing to notice if it does. No other ability in the
repo overrides does_match() for this reason; invocation is left entirely to the
dashboard. Unlike a couple of other abilities reviewed this same pass, HOTWORDS
had no second job here (e.g. no in-conversation restart check reusing it), so
removing it needed nothing else adjusted.

Verified the three fixes this PR actually addresses are unaffected: strict
add-time matching still keeps "almond milk" distinct from "milk", fuzzy
lookup still resolves "eggs" to a stocked "egg", and the new item_date /
full_list logic added in this PR still runs correctly. File still imports
cleanly with no does_match anywhere in the class.

Separately, and NOT changed here: _search_meals/_lookup_meal call
session_tasks.get_async(), a method name that appears nowhere in the SDK
reference docs (only .create() and .sleep() are documented there) and that no
other ability in this repo uses -- everything else calls session_tasks.get()
or plain requests.get(). That code isn't touched by this PR's diff at all; it's
inherited from openhome-dev#368. Flagging it rather than guessing at a fix, since getting a
live SDK method name wrong by assumption risks trading a real bug for a
different one.

@uzair401 uzair401 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.

Good follow-up, all three review notes from #368 are properly addressed — load/save safety, strict add-matching vs. fuzzy lookups, and the read-only user profile context. Removed the does_match() HOTWORDS duplication for SDK consistency with the rest of the repo. One separate, pre-existing item flagged in a commit note for awareness: _search_meals/_lookup_meal call session_tasks.get_async(), which isn't in the SDK docs and isn't used by any other ability here — inherited from #368, not part of this PR, worth a live check of the recipes feature. Approving.

@uzair401
uzair401 merged commit febc6a2 into openhome-dev:dev Aug 31, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-ability Community-contributed ability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants