Skip to content

feat(auip): add a user-controlled AI application interaction switch - #310

Merged
Lucas1479 merged 7 commits into
Code-Amadeus:mainfrom
NopeCharon:feat/auip-interaction-switch
Nov 25, 2026
Merged

Lucas1479 merged 7 commits into
Code-Amadeus:mainfrom
NopeCharon:feat/auip-interaction-switch

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

What and why

Implements #259. AUIP was always on. An ordinary chat could pay for an extra AUIP control-model query whenever a launch candidate, active Work, project history or focused app existed. AUIP_CONTROL_DECISION_ENABLED only selects the control path. This adds the single persisted, user-facing AI application interaction switch the issue asks for.

AUIP_INTERACTION_ENABLED (default true) is a catalog boolean with live host application. The existing Settings switch saves it across restarts and applies it to the running backend through system.set_config. It is shown under Settings → Providers. Each gate reads the live value at the boundary that already owns the behavior, so there is no new router, classifier or per-session override.

While off

  • Cooperative Chat: skips the AUIP turn hook. There is no entry or focused-control query and no [AUIP launchable applications] prompt. The speech-time entry prefetch and the focused-app role context are also skipped.
  • Late decisions: AuipHandler.route_control and the focused-app dispatcher refuse a decision captured before the switch with auip_interaction_disabled. This happens before any step model call, read, launch or app action, and the refusal is presented through the ordinary auip_rejected receipt.
  • Engagement: AuipEngagementCoordinator offers no participant turns and refuses explicit steps and collaborate/delegate mode changes. Receipt bookkeeping keeps running.
  • Narration: AuipNarrationAdapter adds no commentary.
  • Attach tickets: a participant ticket issued earlier opens a spectator-capable app in observe mode.

Turning it off also reconciles interaction already in progress (SystemHandler → AuipHandler.suspend_interaction):

  • Each live AppSession that can spectate goes back to observe through the ordinary AUIP_MODE_SET transition. That cancels private Participant decisions, revokes a Controller lease and emits the usual update and revoke envelopes.
  • A participant-only app keeps its mode, but its deferred and in-flight decisions are cancelled.
  • Queued narration and not-yet-launched entry continuations are dropped.
  • An action already sent is not undone. Its pending receipt is still recorded truthfully.

Turning it back on restores entry, participation and narration for later turns, with no replay. Apps keep their current mode; the user picks collaborate or delegate again.

Unchanged: creating apps through Work (the Work planner still gets app capabilities), opening them, manual use, AppSession identity, permission checks and receipts.

UI:

  • The capabilities panel shows Application interaction as "Turned off" and its Configure button opens the switch.
  • The Work page's app card now shows a refused mode or step request (e.g. auip_interaction_disabled) instead of silently ignoring it.
  • docs/auip_application_sessions.md documents exactly what the switch disables.

Known limits:

  • The base Main Chat contract still contains its conditional AUIP clauses. They only apply when the Host supplies launch candidates or app_context, and neither is supplied while off.
  • If a model still proposes op=auip with no entry owner, it gets the same existing rejection as in a session with no apps.
  • I did not change the prompt snapshots.

Linked Issue for product-semantic or public-contract changes: #259

Change class

  • Routine fix, documentation, test, maintenance, or presentation-only UI
  • Product-semantic or public-contract change discussed in the linked Issue
  • Isolated, default-off experiment

Owning layer: Host. The settings catalog and system.set_config own the switch. Each existing AUIP owner gates its own behavior: Cooperative Chat ingress for entry and prompt, AuipHandler for control routing and reconciliation, AuipEngagementCoordinator for participation, AuipNarrationAdapter for commentary, and AuipRuntime for attach mode.

User-visible effect: a new switch, Settings → Providers → AI application interaction. When it is off, Amadeus stops querying for, joining, acting in or commenting on apps from chat, and open apps return to watching. Manual app use is unchanged.

Compatibility or migration impact:

  • New public config key AUIP_INTERACTION_ENABLED, default true, so existing installs keep current behavior. No migration is needed.
  • system.get_config gains auip_interaction_enabled, and system.set_config accepts it.
  • AUIP control requests can now return the error code auip_interaction_disabled.

Evidence

Commands and manual journeys run (Linux aarch64, CPython 3.12, Node 22.21):

  • pytest tests/test_auip_interaction_switch.py tests/test_cooperative_auip_entry.py: 44 passed. With only the tests applied (implementation reverted), 9 of the new tests fail; the default-config check passes, as expected.

  • pytest on test_auip_runtime, test_auip_handler, test_auip_engagement, test_auip_narration, test_auip_self_attach and test_config_catalog: all pass.

  • tools/run_tests.py --shard-count 3, all three shards. 12 suites fail, and they fail with identical counts on unmodified main in the same environment: no browser, no ACP SDK connection, Windows-only layers. Affected suites: test_acp_provider, test_acp_skills, test_auip_artifact_style, test_auip_work_recovery, test_backend_cleanup, test_windows_desktop_layer, test_cooperative_planner_after_work, test_provider_request_role_identity, test_auip_cross_axis_assembly, test_auip_entry_preflight, test_cooperative_auip_preparation, test_work_ledger_coordinator.

  • ruff check . and tools/architecture/generate_views.py --check: pass.

  • electron: npm test (709 tests, 0 failures, including check:config after npm run generate:config) and npm run build: pass.

  • Not run: the live model and the Windows packaged desktop. No screenshots: I had no display server to render the desktop app. The switch is a standard catalog SwitchCard rendered by the existing renderRuntimeGroup, the same as "Work and Chat approval".

  • Relevant Python tests pass

  • CPU/model-less baseline remains supported

  • Electron npm run build passes when Electron code changed

  • Dependency audit passes when dependencies changed (no dependency changes)

  • Before/after screenshots are attached for visible UI changes (not captured, see above)

  • Documentation/examples are updated for changed settings or contracts

Final check

  • This PR addresses one coherent problem without unrelated cleanup
  • It does not add a speculative API, fallback, or compatibility path
  • No secrets, local state, model weights, voice material, or restricted assets are included
  • Third-party notices and provenance are preserved

Closes Code-Amadeus#259.

AUIP was on for everyone, and an ordinary chat could pay for an extra
AUIP control-model query whenever a launch candidate, active Work,
project history or focused app existed. The only related flag,
AUIP_CONTROL_DECISION_ENABLED, picks the control path; it does not turn
the feature off.

Add one persisted, global setting, AUIP_INTERACTION_ENABLED (default
true, so existing installs keep their behavior). It is a catalog
boolean with live "host" application, so the existing Settings switch
saves it across restarts and applies it to the running backend through
system.set_config. It appears under Settings > Providers.

While it is off, the live value is read at each owning boundary:

- Cooperative Chat skips the AUIP turn hook, so there is no entry or
  focused-control query and no launch-candidate prompt. The speech-time
  entry prefetch and the focused-app role context are skipped too.
- AuipHandler.route_control and the focused-app dispatcher refuse a
  decision captured before the switch with auip_interaction_disabled,
  before any step model call, read, launch or app action. It is
  presented through the ordinary auip_rejected receipt.
- AuipEngagementCoordinator offers no participant turns, and refuses
  explicit steps and collaborate/delegate mode changes. Receipt
  bookkeeping keeps running.
- AuipNarrationAdapter adds no commentary.
- A participant attach ticket issued earlier opens a spectator-capable
  app in observe mode.

Turning it off also reconciles interaction already in progress
(SystemHandler -> AuipHandler.suspend_interaction):
- each live AppSession that can spectate goes back to observe through
  the ordinary AUIP_MODE_SET transition. That cancels private
  Participant decisions, revokes a Controller lease and emits the usual
  update and revoke envelopes;
- a participant-only app keeps its mode, but its deferred and in-flight
  decisions are cancelled;
- queued narration and not-yet-launched entry continuations are
  dropped.
An action already sent is not undone; its pending receipt is still
recorded. Turning it back on restores entry, participation and
narration for later turns without replaying anything.

Creating apps through Work, opening them and using them by hand,
AppSession identity, permission checks and receipts are unchanged.

The capabilities panel shows Application interaction as "Turned off"
and links to the switch. The Work page's app card now shows a refused
mode or step request instead of ignoring it. docs/auip_application_sessions.md
documents what the switch disables.

Tests: tests/test_auip_interaction_switch.py covers suspension (observe,
controller revoke, sent-action receipt, participant-only apps),
engagement gates and re-enable, route refusal, narration, attach
tickets, the strict live setting and the default. A Cooperative Chat
journey checks that the off state makes zero AUIP queries and leaves out
the launch prompt, and that turning it back on gives exactly one entry.
Electron tests cover the catalog policy, persistence and the capability
projection.

@Lucas1479 Lucas1479 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the persisted setting and the chat-entry tests. The immediate stop matches the original issue. We’ve clarified when switching off should take effect.

Please keep Main Chat’s usual AUIP evaluation running while the switch is pending off, so a user can still direct an active game from chat. All sessions that were active when the user turned the switch off can continue. Block new AUIP sessions during this period, including deferred launches. Switch off when the last active AUIP session ends, or immediately if none are active. Switching back on restores normal evaluation and cancels any pending shutdown.

Please reflect that timing in the help text and tests. With two active sessions, both should remain usable and a request to open a third should be refused. Ending the first should leave chat evaluation running. Ending the second should make the next turn skip AUIP. Please also cover switching off with no active session and switching back on.

…ion ends

Turning the switch off with no active AppSession takes effect at once.
With any active, it is pending off: Main Chat keeps its usual AUIP
evaluation, sessions that were active continue, and the Host starts no
new session, including deferred or earlier launch requests. The switch
takes effect when the last active session ends, and turning it back on
cancels the pending shutdown.
@NopeCharon

Copy link
Copy Markdown
Contributor Author

Reworked to the pending-off timing in 0169973. Off with no active session applies at once; otherwise chat evaluation and the active sessions keep running, new launches (including deferred ones) are refused, and it takes effect when the last session ends. Turning it back on cancels the pending shutdown. Help text, docs and tests are updated, including the two-session case and the off and back-on cases.

@Lucas1479 Lucas1479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @NopeCharon for the quick rework. Deriving pending off from the active sessions keeps the state simple: nothing extra is stored, and switching back on needs no cancellation step. The launch refusals also cover deferred launches and earlier launch requests, and the two-session test follows the clarified timing.

Two things need fixing:

  1. CI: a copy of the repository was committed by accident. 0169973 adds 8,920 files under 192.168.224.184haron/oss-nc/11200550-cfa1c/repo/, which are nested copies of the working tree. All failing checks come from this directory:

    • the seven Windows jobs fail at checkout with "Filename too long";
    • dependency-review flags the copied agent_host/pi_runtime/package-lock.json;
    • the source checks in core-tier and voice-tier fail on unused imports in the copied tests;
    • cpu-model-less fails because the Windows suites failed.

    Please remove the directory in a new commit; the squash merge only takes the final tree. Without it, tests/test_auip_interaction_switch.py passes locally (11 passed).

  2. Sessions opened after switching off still get AUIP. The intended rule is that sessions already open when the switch goes off keep AUIP until they end, and sessions opened afterwards get none. ai_interaction_in_effect() returns ai_interaction_enabled() or has_active_session(), which matches that rule only if no session can become active while the switch is off. Three paths still register sessions while it is off:

    • by opening an app from Project apps or Work (auip.attach.prepare without a request_id is not gated);
    • through the self-attach card, which still offers the play options;
    • with an attach ticket issued before the switch went off.

    I reproduced two cases on this branch:

    • Switch fully off, no active session: a participant-only app attached with "Let … play" registers in delegate mode, and ai_interaction_in_effect() becomes True. The chat, engagement, narration and route_control gates then all pass. Chat evaluates AUIP again while the switch is off, contrary to the help text and #259's first acceptance item.
    • Pending off with two sessions: a third session registered after switching off keeps ai_interaction_in_effect() True after both original sessions end.

    The derived state can stay; the invariant needs to be enforced at admission. register_attached is the only production entry, and a session never becomes active again once it ends. So while the switch is off, register_attached and the self-attach request should refuse with auip_interaction_disabled instead of downgrading to observe. The app still opens and can be used manually: a refused connection leaves it standalone, as "Not now" does (see attach() in the 2048 example). Please replace test_participant_attach_ticket_opens_as_spectator_while_off with tests for these refusals during pending off and with the switch fully off. They should also check that pending off still ends when the original sessions end.

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
…g off

register_attached and the self-attach request now refuse with
auip_interaction_disabled instead of downgrading to observe, so no
session can become active after the switch goes off and pending off
ends with the original sessions. Tests and docs updated.

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
@NopeCharon

Copy link
Copy Markdown
Contributor Author

Removed the stray directory in c99aec9 and merged main. In 1826281 register_attached and the self-attach request now refuse with auip_interaction_disabled while the switch is off or pending off, so the app stays standalone. The downgrade test is replaced by refusal tests for fully off and pending off, including that pending off still ends with the original sessions.

Lucas1479 and others added 2 commits November 26, 2026 03:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With AI application interaction off, the Host still prepares the launch
so the app can be used by hand, but refuses its registration. The Work
page then kept waiting for a connection that never came. The prepare
result now carries auip_interaction_enabled, and the Work page says the
app opened on its own instead of waiting. The docs now say to reopen
the app after turning the switch back on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Lucas1479 Lucas1479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @NopeCharon for the quick and precise follow-up. Refusing admission in register_attached and in the self-attach request closes every path by which a session could become active while the switch is off, so the derived pending-off state now holds without extra bookkeeping.

I re-ran my earlier reproduction on 1826281. An attach with the switch fully off is refused, a late attach during pending off is refused, and pending off ends when the original sessions end. The four new tests fail on 0169973 and pass here.

I pushed one small follow-up, 9496a73, on top of a merge of main. With the switch off, Open on the Work page still opened the app, but its AUIP status stayed at "Waiting for the application", because nothing told the page that the registration was refused. The prepare result now carries auip_interaction_enabled, and the Work page says that the app opened on its own. The docs also say to reopen the app after turning the switch back on, since a refused ticket is used up. Merging.

@Lucas1479
Lucas1479 merged commit 265d25e into Code-Amadeus:main Nov 25, 2026
16 checks passed
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.

2 participants