Add air-quality-pollen-alert ability: proactive AQI and pollen monitor for allergy and asthma sufferers#288
Open
hassan1731996 wants to merge 17 commits into
Conversation
…r for allergy and asthma sufferers
…TWORDS, fix tomorrow_str, guard outer loop
After resume_normal_flow() fires from the background daemon, user_response() returns None on every call — the outer while loop became an infinite no-op, letting the generic assistant handle all follow-up queries. Two architectural fixes: - Remove outer while loop entirely; one trigger = one intent = exit cleanly. Follow-up queries re-trigger via does_match() as fresh invocations. - Extract city from trigger text via LLM before calling user_response() in setup. "set up air quality for Toronto" now completes with zero user_response() calls, eliminating the race with the background daemon entirely.
…sion_tasks sleep loop Background's session_tasks.sleep(300s) kept the ability permanently 'active', preventing does_match() from firing for any subsequent utterance. All follow-up queries (CHECK, FORECAST, ACTIVITY, WINDOWS) went to generic assistant with no [AQAlert] logs. Removing background.py eliminates the sleep loop so the ability goes idle after each foreground invocation, allowing does_match() to fire normally for re-triggers. On-demand queries now work reliably across the full demo flow. README updated: setup phrase now requires city inline; background daemon section removed.
…se() handles all follow-ups After resume_normal_flow() the runtime never calls does_match() again in the same session, so the 'one trigger = one intent = re-trigger' design was always wrong. The outer while loop with user_response() is the only correct multi-turn mechanism. Without background.py (removed last commit), no competing resume_normal_flow() can break user_response(), so the loop runs cleanly for the full session. Stale echo filter added: discards the final-transcription replay of the trigger phrase that fires immediately after speak() returns, preventing spurious SETUP re-runs.
Delay resume_normal_flow() until after STARTUP_GRACE (90s) instead of calling it immediately at daemon startup. This gives the foreground's outer loop exclusive conversation control for the first 90 seconds — long enough for any query session. After 90s the background releases control and monitors for morning/evening alerts. Alert logic, thresholds, and polling interval are unchanged.
…bility, None handling
Contributor
✅ Community PR Path Check — PassedAll changed files are inside the |
Contributor
✅ Ability Validation Passed |
Contributor
🔀 Branch Merge CheckPR direction: ✅ Passed — |
Contributor
🔍 Lint Results✅
|
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
Setup flow
The city goes in the trigger phrase itself:
The ability extracts the city via LLM, geocodes it, and confirms in one step. No follow-up question, no loop. If no city is given, the ability gives a redirect prompt and exits cleanly.
What's included
main.py— 6-intent foreground with outer loopSETUP— city extracted from trigger; saves location, morning time defaults to 7amCHECK— on-demand AQI + pollen with condition-aware response (pollen-first for hay fever, AQI-first for asthma)FORECAST— today and tomorrow outlookACTIVITY— "is it safe to run?" with best outdoor time windowWINDOWS— "should I keep windows closed?" with pollen-aware responseUPDATE— change morning alert time, health conditions, pollen triggersAll follow-up queries in a session are handled by a
user_response()outer loop — no re-triggering needed.background.py— 5-minute daemon, two alert windowsresume_normal_flow()is delayed 90 seconds after daemon start, giving the foreground's outer loop exclusive conversation control for a full session before the background takes overAPIs
Validation