Skip to content

fix(quick-router): keep the city when a weather query ends "in the morning"#628

Closed
davion-knight wants to merge 1 commit into
GeniePod:mainfrom
davion-knight:fix/quick-router-weather-in-the-morning
Closed

fix(quick-router): keep the city when a weather query ends "in the morning"#628
davion-knight wants to merge 1 commit into
GeniePod:mainfrom
davion-knight:fix/quick-router-weather-in-the-morning

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

Summary

The deterministic quick-router extracts a weather location with
rsplit_once(" in ") — the last " in " in the utterance. A natural query
that ends with an "in the " phrase therefore loses the city:
"what's the weather in Denver in the morning?" routed to
get_weather{location: "morning"} and geocoded the wrong place, instead of
location: "denver". It is a wrong tool-call argument — exactly what the BFCL
tool-call scoring measures — across a whole class of everyday phrasings.

The existing trailing-time-word trim (#597) never fixes this, because the city
is already discarded by the marker split before that per-location trim runs.

Changes

  • extract_location_after_marker (crates/genie-core/src/tools/quick.rs):
    strip a trailing " in the morning/afternoon/evening/night" phrase before
    the rsplit_once(marker) split, so the city survives. Forecast detection reads
    the whole utterance, so it is unaffected.
  • Extend weather_location_drops_trailing_time_qualifier with the three
    previously-broken phrasings (Denver/Austin/Tokyo "in the morning/evening/afternoon").

Real Behavior Proof

  • I have built and run the affected code locally (or noted why I could not).
  • I have verified the change end-to-end on Jetson hardware.
  • I have NOT verified on Jetson hardware, and I explain the equivalent verification path or validation gap below.

Tested profile / hardware (check all that apply):

  • jetson
  • raspberry_pi
  • portable_sbc
  • laptop
  • mac
  • CI-only / docs-only
  • Not run locally

What I ran

x86_64 Linux laptop, stable Rust (cargo 1.96.1). The changed code is
platform-agnostic string routing (str::rsplit_once / str::trim_end_matches),
so an x86_64 build exercises the exact logic that runs on Jetson. I wrote the
regression cases first and ran them against unmodified main to confirm the
bug, then applied the fix:

# Repro (before fix): FAILS
cargo test -p genie-core --lib weather_location_drops_trailing_time_qualifier
# After fix + no regressions:
cargo test -p genie-core --lib tools::quick
cargo test -p genie-core --lib
cargo fmt -p genie-core -- --check
cargo clippy -p genie-core --all-targets --locked -- -D warnings
cargo clippy -p genie-core --no-default-features --locked -- -D warnings

What I observed

  • Repro before fix: weather_location_drops_trailing_time_qualifier failed —
    left: "morning", right: "denver" for "what's the weather in Denver in the morning?".
  • After fix: target test ok; tools::quick 52 passed / 0 failed;
    genie-core --lib 822 passed / 0 failed / 4 ignored.
  • fmt: clean. clippy (default and --no-default-features): 0 warnings.

…rning"

extract_location_after_marker splits the location off with the last " in "
in the utterance, so a trailing "in the morning/afternoon/evening/night"
phrase won the split and discarded the city: "what's the weather in Denver
in the morning?" routed to get_weather{location: "morning"} and geocoded the
wrong place.

Strip that trailing time-of-day phrase before the marker split so the city
survives. Forecast detection reads the whole utterance, so it is unchanged.
The GeniePod#597 trailing-time-word trim never reached this case because it runs on
the already-split location, after the city was gone.
@github-actions github-actions Bot added the bug Something isn't working label Jul 4, 2026

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

Thanks — but this is the same fix as #597 and #615 (both merged), which already trimmed trailing time words from weather locations. Closing as duplicate.

@matedev01 matedev01 closed this Jul 6, 2026
@davion-knight

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @matedev01 — no argument that this is the same area as #597/#615. One thing I wanted to flag in case it changes the call:

On current main, this specific phrasing still routes wrong:

route("what's the weather in Denver in the morning?")
→ get_weather{location: "morning"}   // expected "denver"

#597 trims trailing time words from the location, but it runs after extract_location_after_marker splits on the last " in " — so for "…in Denver in the morning" the city is already discarded before that trim sees it. #615 (still open, as far as I can see) fixes the separate "will it rain in <city>" branch.

This PR strips the " in the <time-of-day>" phrase before the split, so the city survives. Happy to keep it minimal or fold it into #615 if you'd prefer — just didn't want the "in the morning" case to slip through. Either way, thanks for taking a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants