feat: make task-agent auto-wake optional#3488
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request makes task agent automatic updates opt-in by default, introducing manual 'Wake agent' triggers and freshness watermarks (reportStaleAt and reportFreshAt) to track outdated summaries without spending unnecessary inference tokens. The UI has been redesigned to separate report reading from automation controls and setup. The review feedback highlights critical syntax errors in ai_summary_card.dart due to invalid conditional collection syntax (?), and a potential subscription leak in sync_event_processor_agent_handlers.dart where old subscriptions are not cleared before registering new ones during an agent identity update.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/features/agents/ui/ai_summary_card.dart`:
- Line 117: Update the asynchronous toggle flow around the handler at lines
295-321 to capture the originating agentId before awaiting, and track the
in-flight/busy state per agent rather than using the shared
_automaticUpdatesBusy flag. After the await, use the captured identity for
provider invalidation and error handling, and ensure the current agent’s toggle
state is not blocked by a request belonging to a different agent.
In `@lib/features/agents/ui/ai_summary_card/tldr_section_part.dart`:
- Around line 63-84: Update the agent-name interactive element in the
displayName block, around InkWell and its Padding, to enforce a minimum width
and height of kMinInteractiveDimension while preserving the existing styling,
tap handler, and text layout.
In `@lib/features/agents/ui/task_agent_automation_panel.dart`:
- Around line 98-112: Update the conditional rendering around _StaleReportNotice
and _WakeActions so the stale notice is shown only when isStale and
automaticUpdatesEnabled is false; automatic mode must continue rendering
_WakeActions with its active countdown and cancel action. Add coverage for
automaticUpdatesEnabled true, isStale true, and an active countdown.
In `@lib/features/agents/wake/wake_drain_engine.dart`:
- Around line 556-585: The _markReportFresh method can overwrite a newer
reportStaleAt written concurrently by wake_batch_router.dart. Re-read the agent
state immediately before persisting, or use an updatedAt/version compare-and-set
guard, and only write reportFreshAt when the snapshot is still current; preserve
the existing stale-state and watermark checks.
In `@lib/l10n/app_localizations_ro.dart`:
- Around line 9716-9717: Update the Romanian localization getter
taskAgentWakeAgent to use “Treziți agentul” instead of “Activați agentul”,
preserving the existing getter and localization structure.
In `@test/features/agents/ui/ai_summary_card/screenshots_test.dart`:
- Around line 8-15: Update the screenshot command documentation in
screenshots_test.dart to use the portable /tmp/lotti-task-agent-card-screenshots
output path instead of the developer-specific absolute path. Correct the
surrounding comments to accurately distinguish LOTTI_SCREENSHOT_DIR output
outside the repository from LOTTI_CAPTURE_SCREENSHOTS=true output under
screenshots/task_agent_card.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4d4d6c08-3c75-4faf-8055-12d3b6e5b145
📒 Files selected for processing (52)
CHANGELOG.mddocs/MANUAL.mddocs/manual/task_agents.mddocs/research/2026-07-16_task_agent_card_expert_panel_review.mdflatpak/com.matthiasn.lotti.metainfo.xmllib/features/agents/README.mdlib/features/agents/model/agent_config.dartlib/features/agents/model/agent_config.freezed.dartlib/features/agents/model/agent_domain_entity.dartlib/features/agents/model/agent_domain_entity.freezed.dartlib/features/agents/model/agent_domain_entity.g.dartlib/features/agents/service/task_agent_service.dartlib/features/agents/sync/agent_concurrent_resolver.dartlib/features/agents/ui/agent_model_sheet.dartlib/features/agents/ui/ai_summary_card.dartlib/features/agents/ui/ai_summary_card/tldr_section_part.dartlib/features/agents/ui/task_agent_automation_panel.dartlib/features/agents/ui/task_agent_identity_region.dartlib/features/agents/wake/wake_batch_router.dartlib/features/agents/wake/wake_drain_engine.dartlib/features/agents/wake/wake_orchestrator.dartlib/features/sync/matrix/sync_event_processor_agent_handlers.dartlib/l10n/app_cs.arblib/l10n/app_de.arblib/l10n/app_en.arblib/l10n/app_es.arblib/l10n/app_fr.arblib/l10n/app_localizations.dartlib/l10n/app_localizations_cs.dartlib/l10n/app_localizations_de.dartlib/l10n/app_localizations_en.dartlib/l10n/app_localizations_es.dartlib/l10n/app_localizations_fr.dartlib/l10n/app_localizations_ro.dartlib/l10n/app_ro.arbtest/features/agents/model/agent_automation_policy_test.darttest/features/agents/model/agent_config_test.darttest/features/agents/model/agent_domain_entity_test.darttest/features/agents/service/task_agent_service_test.darttest/features/agents/sync/agent_concurrent_resolver_test.darttest/features/agents/ui/agent_model_sheet_test.darttest/features/agents/ui/ai_summary_card/lifecycle_test.darttest/features/agents/ui/ai_summary_card/screenshots_test.darttest/features/agents/ui/ai_summary_card/test_bench.darttest/features/agents/ui/ai_summary_card/tldr_section_part_test.darttest/features/agents/ui/ai_summary_card/wake_test.darttest/features/agents/ui/task_agent_automation_panel_test.darttest/features/agents/ui/task_agent_identity_region_test.darttest/features/agents/wake/wake_orchestrator_test.darttest/features/daily_os_next/screenshot_harness.darttest/features/sync/matrix/sync_event_processor_agent_handlers_test.darttest/test_helper.dart
💤 Files with no reviewable changes (1)
- lib/features/agents/ui/agent_model_sheet.dart
👮 Files not reviewed due to content moderation or server errors (1)
- lib/l10n/app_localizations.dart
What changed
Task agents now default to user-controlled inference while continuing to observe their task:
The card information architecture is also rebuilt:
Why
The former opt-out behavior could re-run an agent roughly every two minutes as task context changed. With many active agents, that made repeated inference the path of least resistance and was estimated to consume roughly 10–15× more tokens and energy than necessary for this workflow.
This change makes the cost-bearing action intentional without sacrificing awareness: observation remains active, outdated output is clearly labelled, and the user decides when a fresh inference pass is valuable.
Before / after
Outdated/manual state — desktop, dark
Scheduled state — phone, light
Complete dark/light × desktop/phone comparison matrix
Desktop scheduled — dark
Desktop scheduled — light
Desktop manual/stale — light
Phone manual/stale — dark
Phone manual/stale — light
Phone scheduled — dark
Expert panel
The same deterministic eight-screenshot fixture set was scored at each pass:
The first redesign cleared 8/10 but used an overly loud full-card stale perimeter. The final pass reduced this to a focused accent and moved proposals into the desktop reading column, resolving the remaining visual-hierarchy and dead-space concerns without conflict between reviewers.
Documentation
docs/manual/lotti-docscommit1141d06Validation
fvm flutter analyze— no issues foundgit diff --check— cleanThe approximately 27,000-test full suite is intentionally delegated to CI, where it runs in 10 shards. No full-suite test run was performed locally.
Summary by CodeRabbit
New Features
Documentation