Skip to content

feat: make task-agent auto-wake optional#3488

Merged
matthiasn merged 3 commits into
mainfrom
feat/improve_task_agent_section_codex
Jul 16, 2026
Merged

feat: make task-agent auto-wake optional#3488
matthiasn merged 3 commits into
mainfrom
feat/improve_task_agent_section_codex

Conversation

@matthiasn

@matthiasn matthiasn commented Jul 16, 2026

Copy link
Copy Markdown
Owner

What changed

Task agents now default to user-controlled inference while continuing to observe their task:

  • automatic updates are an explicit, top-level opt-in; missing legacy values resolve to off
  • agents with automation off retain their task subscriptions, persist a stale watermark when relevant changes arrive, and do not enqueue inference
  • stale summaries remain readable and surface one focused Wake agent CTA
  • a successful wake records a fresh watermark at wake start, so a task edit that lands during inference cannot be hidden by an older result completing later
  • stale/fresh timestamps merge conservatively across devices
  • enabling automation preserves the existing two-minute coalescing schedule
  • new agents still perform their user-requested creation wake, then remain manual by default

The card information architecture is also rebuilt:

  • report reading and proposals form the desktop reading column
  • automatic updates and current AI setup form a compact utility rail
  • phone layouts use the same hierarchy as a linear stack
  • Read more now follows the report it controls
  • model/setup selection is a dedicated top-level region; automation is no longer buried inside that sheet
  • stale state uses a narrow error accent instead of turning the whole card into an alarm surface

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

Before After
Before: desktop manual state After: desktop stale state and Wake agent CTA

Scheduled state — phone, light

Before After
Before: phone scheduled state After: phone scheduled state
Complete dark/light × desktop/phone comparison matrix

Desktop scheduled — dark

Before After
Before desktop scheduled dark After desktop scheduled dark

Desktop scheduled — light

Before After
Before desktop scheduled light After desktop scheduled light

Desktop manual/stale — light

Before After
Before desktop manual light After desktop stale light

Phone manual/stale — dark

Before After
Before phone manual dark After phone stale dark

Phone manual/stale — light

Before After
Before phone manual light After phone stale light

Phone scheduled — dark

Before After
Before phone scheduled dark After phone scheduled dark

Expert panel

The same deterministic eight-screenshot fixture set was scored at each pass:

Discipline Baseline First redesign Final
UX 5.4 8.7 9.2
Information architecture 5.0 8.8 9.3
Visual design 6.1 8.0 8.8
Responsible-AI trust 3.8 9.3 9.5
Average 5.1 8.7 9.2

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

  • adds a focused task-agent manual under docs/manual/
  • documents desktop/mobile IA, auto-wake behavior, stale recovery, proposals, and the conservative freshness race
  • includes the traditional penguin/sardine/zero-gravity fish-feeder exercise
  • records the repeatable panel method and complete scorecard
  • publishes versioned manual and PR screenshots through lotti-docs commit 1141d06

Validation

  • fvm flutter analyzeno issues found
  • 401 focused model, resolver, service, wake-orchestrator, sync-handler, and card/widget tests — all passed
  • deterministic screenshot harness — all eight scheduled/manual × dark/light × desktop/phone captures generated and reviewed
  • localization regenerated for CS, DE, EN, ES, FR, and RO
  • git diff --check — clean

The 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

    • Task agents now remain paused by default and update only when explicitly woken.
    • Added clear outdated-report messaging and a Wake agent action.
    • Automatic two-minute updates remain available as an opt-in setting.
    • Redesigned the task-agent card to separate report content from automation controls and improve responsive layouts.
  • Documentation

    • Added a focused guide covering task agents, AI summaries, wake behavior, report freshness, and review workflows.
    • Added expert-panel review documentation for the task-agent card.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/improve_task_agent_section_codex

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@matthiasn
matthiasn marked this pull request as ready for review July 16, 2026 22:18

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment thread lib/features/agents/ui/ai_summary_card.dart
Comment thread lib/features/agents/ui/ai_summary_card.dart
Comment thread lib/features/sync/matrix/sync_event_processor_agent_handlers.dart
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/improve_task_agent_section_codex

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0015b3b and aff664c.

📒 Files selected for processing (52)
  • CHANGELOG.md
  • docs/MANUAL.md
  • docs/manual/task_agents.md
  • docs/research/2026-07-16_task_agent_card_expert_panel_review.md
  • flatpak/com.matthiasn.lotti.metainfo.xml
  • lib/features/agents/README.md
  • lib/features/agents/model/agent_config.dart
  • lib/features/agents/model/agent_config.freezed.dart
  • lib/features/agents/model/agent_domain_entity.dart
  • lib/features/agents/model/agent_domain_entity.freezed.dart
  • lib/features/agents/model/agent_domain_entity.g.dart
  • lib/features/agents/service/task_agent_service.dart
  • lib/features/agents/sync/agent_concurrent_resolver.dart
  • lib/features/agents/ui/agent_model_sheet.dart
  • lib/features/agents/ui/ai_summary_card.dart
  • lib/features/agents/ui/ai_summary_card/tldr_section_part.dart
  • lib/features/agents/ui/task_agent_automation_panel.dart
  • lib/features/agents/ui/task_agent_identity_region.dart
  • lib/features/agents/wake/wake_batch_router.dart
  • lib/features/agents/wake/wake_drain_engine.dart
  • lib/features/agents/wake/wake_orchestrator.dart
  • lib/features/sync/matrix/sync_event_processor_agent_handlers.dart
  • lib/l10n/app_cs.arb
  • lib/l10n/app_de.arb
  • lib/l10n/app_en.arb
  • lib/l10n/app_es.arb
  • lib/l10n/app_fr.arb
  • lib/l10n/app_localizations.dart
  • lib/l10n/app_localizations_cs.dart
  • lib/l10n/app_localizations_de.dart
  • lib/l10n/app_localizations_en.dart
  • lib/l10n/app_localizations_es.dart
  • lib/l10n/app_localizations_fr.dart
  • lib/l10n/app_localizations_ro.dart
  • lib/l10n/app_ro.arb
  • test/features/agents/model/agent_automation_policy_test.dart
  • test/features/agents/model/agent_config_test.dart
  • test/features/agents/model/agent_domain_entity_test.dart
  • test/features/agents/service/task_agent_service_test.dart
  • test/features/agents/sync/agent_concurrent_resolver_test.dart
  • test/features/agents/ui/agent_model_sheet_test.dart
  • test/features/agents/ui/ai_summary_card/lifecycle_test.dart
  • test/features/agents/ui/ai_summary_card/screenshots_test.dart
  • test/features/agents/ui/ai_summary_card/test_bench.dart
  • test/features/agents/ui/ai_summary_card/tldr_section_part_test.dart
  • test/features/agents/ui/ai_summary_card/wake_test.dart
  • test/features/agents/ui/task_agent_automation_panel_test.dart
  • test/features/agents/ui/task_agent_identity_region_test.dart
  • test/features/agents/wake/wake_orchestrator_test.dart
  • test/features/daily_os_next/screenshot_harness.dart
  • test/features/sync/matrix/sync_event_processor_agent_handlers_test.dart
  • test/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

Comment thread lib/features/agents/ui/ai_summary_card.dart Outdated
Comment thread lib/features/agents/ui/ai_summary_card/tldr_section_part.dart
Comment thread lib/features/agents/ui/task_agent_automation_panel.dart Outdated
Comment thread lib/features/agents/wake/wake_drain_engine.dart
Comment thread lib/l10n/app_localizations_ro.dart Outdated
Comment thread test/features/agents/ui/ai_summary_card/screenshots_test.dart Outdated
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