Skip to content

[Repo Assist] fix: honour PreferStructuredCategories setting in notification categorizer#104

Closed
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/fix-prefer-structured-categories-cfdb7e220d855953
Closed

[Repo Assist] fix: honour PreferStructuredCategories setting in notification categorizer#104
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/fix-prefer-structured-categories-cfdb7e220d855953

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated draft PR from Repo Assist.

Summary

PreferStructuredCategories was persisted in SettingsManager and SettingsData (default true) but never read. The categorizer always ran the full pipeline — Intent → Channel → UserRules → keyword fallback — regardless of the user's preference.

Root cause

NotificationCategorizer.Classify() had no parameter to opt out of the structured metadata steps. OpenClawGatewayClient also had no way to forward the setting to the categorizer.

Fix

  • NotificationCategorizer.Classify() gains a bool preferStructuredCategories = true parameter. When false, the Intent and Channel checks (steps 1–2) are skipped; classification starts from user-defined rules then keyword fallback. The default keeps all existing behaviour.
  • OpenClawGatewayClient gains SetPreferStructuredCategories(bool) and stores the flag. Both EmitNotification and EmitChatNotification forward it to Classify().
  • App.xaml.cs calls SetPreferStructuredCategories(_settings.PreferStructuredCategories) when initialising the gateway client.

Trade-offs

Relationship to PR #93

Both PRs touch OpenClawGatewayClient.cs and App.xaml.cs. If #93 merges first, a brief rebase will be needed to resolve the overlapping lines; no semantic conflict exists.

Test Status

dotnet test tests/OpenClaw.Shared.Tests/
Passed! - Failed: 0, Passed: 508, Skipped: 18, Total: 526

Five new tests cover the preferStructuredCategories = false branch:

  • PreferStructuredCategories_False_SkipsIntent
  • PreferStructuredCategories_False_SkipsChannel
  • PreferStructuredCategories_False_UserRulesStillApply
  • PreferStructuredCategories_False_FallsBackToKeywords
  • PreferStructuredCategories_True_Default_BehaviourUnchanged

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

…rizer

The PreferStructuredCategories setting was persisted in SettingsManager
and SettingsData but never read. The categorizer always ran the full
pipeline (Intent → Channel → UserRules → keyword fallback) regardless
of the user's preference.

Changes:
- NotificationCategorizer.Classify() gains a preferStructuredCategories
  parameter (default true, backward-compatible). When false, the Intent
  and Channel checks (steps 1–2) are skipped; classification starts from
  user-defined rules then keyword fallback.
- OpenClawGatewayClient gains SetPreferStructuredCategories(bool) and
  stores the flag; both EmitNotification and EmitChatNotification now
  forward it to Classify().
- App.xaml.cs calls SetPreferStructuredCategories(_settings.PreferStructuredCategories)
  when initialising the gateway client.
- Five new unit tests cover the false branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman
Copy link
Copy Markdown
Collaborator

Implementing fresh on current master — the Classify() call sites changed after #93 merged (added _userRules).

@shanselman shanselman closed this Apr 1, 2026
shanselman added a commit that referenced this pull request Apr 1, 2026
#104)

Adds preferStructuredCategories parameter to Classify() — when false,
structured metadata (Intent, Channel) is skipped, going straight to
user rules and keyword fallback.

Reimplemented on current master (post-#93 UserRules merge).
5 new tests covering all code paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanselman added a commit that referenced this pull request Apr 1, 2026
#104)

Adds preferStructuredCategories parameter to Classify() — when false,
structured metadata (Intent, Channel) is skipped, going straight to
user rules and keyword fallback.

Reimplemented on current master (post-#93 UserRules merge).
5 new tests covering all code paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanselman added a commit that referenced this pull request Apr 1, 2026
#104)

Adds preferStructuredCategories parameter to Classify() — when false,
structured metadata (Intent, Channel) is skipped, going straight to
user rules and keyword fallback.

Reimplemented on current master (post-#93 UserRules merge).
5 new tests covering all code paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanselman added a commit that referenced this pull request Apr 1, 2026
When PreferStructuredCategories is false, classification skips structured metadata (Intent, Channel) and goes straight to user rules + keyword fallback.

5 new tests. 521 shared tests pass.

Reimplements #104 on current master.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant