fix(calendar): surface degraded get_calendar_events sentinel so web fallback fires#2833
Draft
Copilot wants to merge 1 commit into
Draft
fix(calendar): surface degraded get_calendar_events sentinel so web fallback fires#2833Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
…llback fires The riksdag-regering MCP get_calendar_events tool returns a "successful" empty events:[] result with an error/rawHtml sentinel when upstream data.riksdagen.se/kalender/ serves HTML. The client read this as a legitimate zero-event window, masking the outage and suppressing the web-scraper fallback. Add isDegradedKalenderSentinel detection in both calendar clients (throw CalendarMcpError 'html' so orchestrator falls back), plus regression tests and agentic guidance steering agents to the resilient scripts/calendar-fetch.ts CLI / data/runtime/calendar-status.json. Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pethers
May 29, 2026 23:14
View session
Contributor
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: documentation,testing,refactor,size-m Label Categories
For more information, see |
Contributor
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
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.
Analysis of the last 5 agentic-workflow PRs (#2819, #2821, #2822, #2823, #2824) for degraded datasources surfaced a client masking bug: when
data.riksdagen.se/kalender/serves an HTML error page, the riksdag-regering MCPget_calendar_eventstool returns a successful result wrapping a sentinel{count:0, events:[], error, rawHtml}. The clients read the emptyevents:[]as a legitimate zero-event window, soscripts/calendar-fetch.tsreported a falsestatus:ok, path:mcp-primaryand the web-scraper fallback never fired — masking the outage as a real zero-sitting week.Client code
scripts/fetch-calendar/mcp/errors.ts— newisDegradedKalenderSentinel()detector; triggers only on a non-emptyerrorstring orrawHtml, so a clean{count:0, events:[]}stays a valid empty window.scripts/fetch-calendar/mcp/client.ts— detect the sentinel in both the content-wrapped and direct-result paths and throwCalendarMcpError(..., 'html', rawHtml);orchestrator.tsalready breaks the retry loop onkind:'html'and falls straight to the public-page scraper.scripts/mcp-client/methods/calendar.ts— mirror the detection (throw instead of returning[]).scripts/fetch-calendar.ts— re-export the new detector.With the fix, the CLI now reports
status:error, path:noneduring the outage instead of a fabricated zero-event success.Agentic config / prompts / instructions
analysis/templates/session-baseline.md— added a 📅 Calendar sourcing degraded-source guard and pointed the 3 inlineget_calendar_eventsreferences at the resilientdata/runtime/calendar-status.json/scripts/calendar-fetch.ts..github/prompts/02-mcp-access.md— added a data-sourcing rule: fetch the calendar via the resilient CLI / pre-warm artifact (never the raw tool); record[DATA GAP: calendar source degraded]when both paths fail.Tests
tests/fetch-calendar/mcp/errors.test.ts,tests/fetch-calendar/mcp/client.test.ts(content + direct sentinel →kind:'html'),tests/fetch-calendar/orchestrator-integration.test.ts(sentinel → web-fallback), andtests/mcp-client/methods/calendar.test.ts(sentinel → throws).Out of scope (documented)
The public fallback page moved from
/sv/kalendarium/(now 404) to a Next.js/sv/aktuellt/kalendersida/serving data in__NEXT_DATA__; repointing the HTML scraper needs a parser rewrite plus markup fixtures. The now-honeststatus:error/path:noneensures the degradation is no longer silently masked in the meantime.IMF (no change)
The other degraded source flagged in the manifests is already mitigated by the 3-tier WEO pipeline and
data/imf-context.jsondegraded/unavailablehandling.