Skip to content

Fix Astra habit listings and single-day fallback periods - #996

Merged
thomasluizon merged 1 commit into
mainfrom
fix/ticket-1617-g8r2-summary
Oct 29, 2026
Merged

thomasluizon merged 1 commit into
mainfrom
fix/ticket-1617-g8r2-summary

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Tracks thomasluizon/orbit-tickets#1617

A request to list habits and goals could select a daily recap, and a one-day recap fallback rendered the same date twice. Habit-query and daily-summary descriptions now distinguish listings from completion recaps; the shared read rule requires both queries for compound listings of habits and goals. The shared fallback formatter renders a single day once, using Today or Hoje when it matches the account's current date.

Approach

  • GetDailySummaryTool.cs, QueryHabitsTool.cs and the existing grounding rule in GlobalRulesSection.cs clarify model tool selection. The tool set and executed model plan stay intact.
  • ReadFallbackText.cs owns period labels for summaries, totals, comparisons, metrics, recaps, habit calendars and history. Composition passes the turn's IUserDateService date through every period fallback path. Stored typed-block negotiation receives the current account date through AstraBlockAnswerService; stored text retains its original wording.
  • AnswerComposition.md documents this behavior. The captured g8r2 tool plan replays at the model-service port through production tools and composition. Other tests cover past, present, future and multi-day labels, serialization, streamed replies, persistence and downgrade replay.
  • Missing-kind habit and goal count lines remain unchanged. No response contract or strict enum changes. The Release build regenerated the supported OpenAPI artifacts with no content changes.

Assumptions

  • The final g8r2 brief scopes this round to habit-read guidance and single-day fallback labels; rejected rebuilding the original ticket's already implemented family policy.
  • Account today is supplied to the shared formatter rather than inferred from a relative-period argument, server clock or message text; unknown date context uses an absolute single date.
  • A stored typed block downgraded on a later account day uses its absolute date; rejected preserving a stale Today label. Already composed text remains the recorded response.

Test evidence

Before implementation changes:

  • dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~ReadFallbackTextTests|FullyQualifiedName~G8_CapturedCompoundFallbackKeepsFactsWithoutTitles': exit 0, 114 passed with the defect present.
  • dotnet test tests/Orbit.Application.Tests --no-build --filter 'FullyQualifiedName~DaySummary_PreservesIndependentReadTextFallback': exit 0, 8 passed. This unchanged test explicitly expected the duplicated date range.
  • After replacing that expectation and adding the unmodified g8r2 tool-plan replay: dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~DaySummary_PreservesIndependentReadTextFallback|FullyQualifiedName~G8R2_CapturedSummaryFallbackUsesAccountToday': exit 1, 12 failed for the intended date-label mismatch. The captured path returned 29/10/2026 a 29/10/2026 or 10/29/2026 to 10/29/2026 instead of Hoje or Today.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter 'FullyQualifiedName~AstraBehaviourPromptTests': exit 0, 19 unchanged tests passed.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter 'FullyQualifiedName~HabitListings_RequireHabitAndGoalQueriesInsteadOfADailyRecap': exit 1, 2 failed in both composition modes before the prompt fix.

After implementation changes:

  • dotnet test tests/Orbit.Application.Tests --configuration Release --no-build --filter 'FullyQualifiedName~ReadFallbackTextTests|FullyQualifiedName~G8_CapturedCompoundFallbackKeepsFactsWithoutTitles|FullyQualifiedName~G8R2_|FullyQualifiedName~DaySummary_|FullyQualifiedName~AstraBlockAnswerServiceTests|FullyQualifiedName~ChatToolMetadataTests': exit 0, 197 passed, including the strengthened tests.
  • dotnet test tests/Orbit.Infrastructure.Tests --configuration Release --no-build --filter 'FullyQualifiedName~AstraBehaviourPromptTests|FullyQualifiedName~AstraBlockAnswerRecoveryTests|FullyQualifiedName~AstraPickListPreviewTests': exit 0, 45 passed.

Full verification after the commit:

Command Exit code Result
dotnet build Orbit.slnx --configuration Release 0 0 errors, 25 existing warnings
dotnet test tests/Orbit.Domain.Tests --configuration Release --no-build 0 1,215 passed
dotnet test tests/Orbit.Application.Tests --configuration Release --no-build 0 9,146 passed
dotnet test tests/Orbit.Infrastructure.Tests --configuration Release --no-build 0 6,600 passed, 14 skipped
dotnet test tests/Orbit.Analyzers.Tests --configuration Release --no-build 0 40 passed
python3 .github/scripts/openapi_artifacts.py freshness 0 All supported artifacts match committed generation
git diff --exit-code -- src/Orbit.Api/openapi.json src/Orbit.Api/openapi_v2.json src/Orbit.Api/openapi_v1-r2.json src/Orbit.Api/openapi_v2-r2.json 0 No generated schema changes

The pre-commit format, root allowlist, dash, timeless-text and suppression checks passed. Deterministic replay preserves the captured daily-summary tool choice; it does not prove live model selection changed. The coordinator owns the bilingual live gate rerun.

Copy for approval

Model instructions are sent in English for both request locales. The pt-BR versions below are review translations of the changed text, not additional runtime prompts. Unchanged instruction tails retain their existing wording.

get_daily_summary description:

  • en: Read a completion summary with totals and an optional narrative recap for a date range, defaulting to today. Use only when the person asks for completion totals or a recap. Use query_habits for habit listings and schedules; a request for habits and goals needs query_habits and query_goals. Pass generate_narrative: true to include its saved narrative when available.
  • pt-BR: Consulte um resumo de conclusões com totais e, se solicitado, um texto de recapitulação para um período, usando hoje como padrão. Use apenas quando a pessoa pedir totais de conclusões ou uma recapitulação. Use query_habits para listar hábitos e consultar a programação; um pedido de hábitos e metas precisa de query_habits e query_goals. Envie generate_narrative: true para incluir o texto salvo quando estiver disponível.

Changed prefix of query_habits description:

  • en: Read individual habits, schedules, metrics and checklists. Use for habit listings, including compound requests for habits and goals; pair with query_goals for the goals. A daily summary does not replace this listing. Call before answering habit questions; indexes do not ground replies.
  • pt-BR: Consulte hábitos individuais, programação, métricas e checklists. Use para listar hábitos, inclusive quando a pessoa pedir hábitos e metas juntos; consulte as metas com query_goals. Um resumo diário não substitui essa lista. Faça a consulta antes de responder sobre hábitos; os índices não servem de base para afirmar dados na resposta.

Changed read-rule sentences:

  • en: For habit listings, use query_habits; for goals, use query_goals. A compound request for habits and goals needs both queries. Reserve get_daily_summary for requested completion totals or a narrative recap; it does not replace a habit listing. For schedule questions, use query_habits with date.
  • pt-BR: Para listar hábitos, use query_habits; para metas, use query_goals. Um pedido de hábitos e metas juntos precisa das duas consultas. Reserve get_daily_summary para pedidos de totais de conclusões ou de recapitulação; ele não substitui uma lista de hábitos. Para consultar a programação, use query_habits com date.

Visible period labels reuse the existing localized catalog:

  • en: Today: Completed / scheduled: 0/2; another single day: 10/28/2026: Completed / scheduled: 0/2; a multi-day range keeps 10/28/2026 to 10/29/2026.
  • pt-BR: Hoje: Concluídos / agendados: 0/2; outro dia: 28/10/2026: Concluídos / agendados: 0/2; um período de vários dias mantém 28/10/2026 a 29/10/2026.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Across all 22 changed files, reviewed the habit-read guidance, shared period formatting, account-local date propagation, and stored-response downgrade behavior.

  • Tool selection: Habit listings explicitly use query_habits, compound habit-and-goal listings require both queries, and get_daily_summary is reserved for completion totals or recaps.
  • Period labels: Single-day fallbacks render one localized date or account-local Today/Hoje; multi-day ranges retain both endpoints across the shared formatter's callers.
  • Stored replay: Typed blocks use the current account date when downgraded, while already composed text remains unchanged. No response-contract changes were introduced.
  • Verification: All 197 focused Application tests and 54 focused Infrastructure tests passed. The captured replay verifies formatting and delivery, not live-model tool selection; the bilingual live gate rerun remains outside this review.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@sonarqubecloud

Copy link
Copy Markdown

@thomasluizon
thomasluizon merged commit 610379e into main Oct 29, 2026
27 checks passed
@thomasluizon
thomasluizon deleted the fix/ticket-1617-g8r2-summary branch October 29, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant