fix: give the model actions for the calendar and the inbox - #23
Open
luca-71 wants to merge 1 commit into
Open
Conversation
Asked "what's my schedule today?", JARVIS reached for [ACTION:SCREEN] and described the monitor. The reason was visible in the raw completions: "[ACTION:SCREEN] Good evening, sir — let me pull up your calendar" The intent was right and the vocabulary was wrong. The calendar and mail lookups existed, but only the hardcoded English phrase table could reach them — they were never offered to the model as action tags. SCREEN was the only inspection action it had, so it substituted, and a monitor photograph came back instead of a schedule. Add [ACTION:CALENDAR] and [ACTION:MAIL], wired to the same _lookup_and_report machinery the phrase table already used, and narrow SCREEN's description to the display itself. This is not an i18n fix. English was equally broken; it was merely masked, because the phrase table intercepts the exact wordings before the model is consulted. Anything unlisted fell through — "When is my next appointment?" went to SCREEN too, and now does not. Measured over 12 phrasings x 3 runs per language, comparing the tag chosen against the tag expected: English 6/21 wrong -> 0/36 Italian 9/21 wrong -> 0/36 Also give the two actions their own acknowledgement. The model tends to write prose after the tag, which is parsed as the target and stripped, so without this the spoken line degraded to a bare "Right away, sir." Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 10, 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.
Asked "what's my schedule today?", JARVIS took a screenshot and described the monitor.
The cause
Visible in the raw completions, once I stopped guessing and printed them:
The intent was right and the vocabulary was wrong. The calendar and mail lookups already existed and worked — but only the hardcoded English phrase table in
detect_fast_actioncould reach them. They were never offered to the model as action tags.[ACTION:SCREEN]was the only inspection action it had, so it substituted, and a photograph of the monitor came back instead of a schedule.The fix
Add
[ACTION:CALENDAR]and[ACTION:MAIL], wired to the same_lookup_and_reportmachinery the phrase table already used, and narrowSCREEN's description to the display itself — it photographs a monitor, so it can say nothing about an inbox.This is not an i18n fix
That was my first assumption and it was wrong. English was equally broken; it was merely masked, because the phrase table intercepts those exact wordings before the model is ever consulted. Anything unlisted fell straight through — "When is my next appointment?" matches no entry, went to
SCREEN, and now routes correctly.Measuring the model directly (calling
generate_responseand reading the tag, so a misroute costs a token round-trip rather than a screenshot) over 12 phrasings × 3 runs per language:The phrasings deliberately vary — "Do I have meetings tomorrow?", "When is my next appointment?", "Check my inbox." — rather than repeating the two sentences the fix was developed against, plus conversational controls that must produce no tag at all.
Verified end to end too: "Qual è il mio prossimo appuntamento?" →
[ACTION:CALENDAR]→ real Apple Calendar read → "Your schedule is clear today, sir."One more thing
The two actions get their own acknowledgement line. The model tends to write prose after the tag, which
extract_actionparses as the target and strips, so without this the spoken response degraded to a bare "Right away, sir."Scope
The phrase table is left alone. It is a latency optimisation — it answers without an LLM round-trip — and it is still correct for the wordings it lists. This change fixes what happens to everything else.
Independent of #21 and #22; cut from
main.Testing
pytest tests/gives 35 passed, 8 failed — identical tomain, so no regressions. The 8 pre-existing failures are unrelated: 7 needplaywright install, andtest_browse_action_keywordsimportsACTION_KEYWORDS, a symbol that no longer exists inserver.py.🤖 Generated with Claude Code