Skip to content

fix(policy): an agent limited to chosen apps with none chosen can use no app - #130

Merged
DIYgod merged 2 commits into
DIYgod:mainfrom
Dshuishui:fix/empty-app-scope
Nov 14, 2026
Merged

DIYgod merged 2 commits into
DIYgod:mainfrom
Dshuishui:fix/empty-app-scope

Conversation

@Dshuishui

Copy link
Copy Markdown
Contributor

Fixes #129.

What changes

An agent set to "Only the apps I choose" with no app listed could use every app, while Settings › Agents said "Can use no app yet".

  • Policy: policy.Input gets Scoped, which the gateway sets for an apps scope, so the engine's two scope checks (actions and app changes) hold for an empty list too. The home key and the home screen stay in reach. phone_apps and phone_logs already read the empty list this way.
  • Settings › Agents: Save is disabled while "Only the apps I choose" has no app, with the first-connection card's tooltip ("Name at least one app"). No new message; only the description of needsApproveNoApps in en.json changes.

Tests

  • New: TestAgentScopeWithNoApps in internal/policy and in internal/gateway; TestGatewayAgentScope in ui now also covers Save. All three fail without the fix.

  • go build ./..., go vet ./... and go test ./... pass on macOS 27.0 (arm64, Go 1.27.4), except three keychain tests in internal/secret that fail the same way on main when run over ssh ("the person cancelled").

  • iPhone 14 (iOS 27.0.1, USB), this branch run as pinky daemon:

    Agent scope Before After
    (empty) Clock, WeChat, Messages, Photos all open all scope_denied
    Clock Clock opens, WeChat scope_denied

Suggested release notes

  • An agent set to "Only the apps I choose" with no app listed can no longer use any app, as Settings › Agents says; before, it could use all of them. Settings no longer saves that choice without an app.
  • 设为「仅限我选择的应用」但一个应用都没填的智能体,现在确实不能使用任何应用,与「设置 › 智能体」显示的一致;此前它可以使用所有应用。「设置」里不再允许不填应用就保存这一选项。

Dshuishui and others added 2 commits November 14, 2026 23:54
… no app

An agent whose scope is "Only the apps I choose" with an empty list could
use every app: the engine applied the scope only to a non-empty list, and
the gateway handed the empty list over as it was. Settings › Agents said
"Can use no app yet" of the same agent, and phone_apps and phone_logs
already read the empty list as no app.

policy.Input gets Scoped, which the gateway sets for an apps scope, so the
engine's two scope checks hold for an empty list too. Settings › Agents no
longer saves "Only the apps I choose" without an app, as the first-connection
card does not approve it.

Fixes DIYgod#129.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DIYgod
DIYgod merged commit e45f8b9 into DIYgod:main Nov 14, 2026
3 checks passed
@DIYgod

DIYgod commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Merged and released in 2026.1115.1, thanks! Before merging I moved appIn's doc comment back above appIn; the rest went in as you wrote it.

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.

"Only the apps I choose" with no app listed lets the agent use every app

2 participants