Repository navigation
feat(auip): add a user-controlled AI application interaction switch - #310
Conversation
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.
There was a problem hiding this comment.
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.
|
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
left a comment
There was a problem hiding this comment.
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:
-
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-lessfails 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.pypasses locally (11 passed). -
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()returnsai_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.preparewithout arequest_idis 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
delegatemode, andai_interaction_in_effect()becomesTrue. The chat, engagement, narration androute_controlgates 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()Trueafter both original sessions end.
The derived state can stay; the invariant needs to be enforced at admission.
register_attachedis the only production entry, and a session never becomes active again once it ends. So while the switch is off,register_attachedand the self-attach request should refuse withauip_interaction_disabledinstead of downgrading to observe. The app still opens and can be used manually: a refused connection leaves it standalone, as "Not now" does (seeattach()in the 2048 example). Please replacetest_participant_attach_ticket_opens_as_spectator_while_offwith 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. - by opening an app from Project apps or Work (
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>
|
Removed the stray directory in c99aec9 and merged main. In 1826281 |
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
left a comment
There was a problem hiding this comment.
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.
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_ENABLEDonly selects the control path. This adds the single persisted, user-facing AI application interaction switch the issue asks for.AUIP_INTERACTION_ENABLED(defaulttrue) is a catalog boolean with livehostapplication. The existing Settings switch saves it across restarts and applies it to the running backend throughsystem.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
[AUIP launchable applications]prompt. The speech-time entry prefetch and the focused-app role context are also skipped.AuipHandler.route_controland the focused-app dispatcher refuse a decision captured before the switch withauip_interaction_disabled. This happens before any step model call, read, launch or app action, and the refusal is presented through the ordinaryauip_rejectedreceipt.AuipEngagementCoordinatoroffers no participant turns and refuses explicit steps and collaborate/delegate mode changes. Receipt bookkeeping keeps running.AuipNarrationAdapteradds no commentary.Turning it off also reconciles interaction already in progress (
SystemHandler→AuipHandler.suspend_interaction):AUIP_MODE_SETtransition. That cancels private Participant decisions, revokes a Controller lease and emits the usual update and revoke envelopes.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:
auip_interaction_disabled) instead of silently ignoring it.docs/auip_application_sessions.mddocuments exactly what the switch disables.Known limits:
app_context, and neither is supplied while off.op=auipwith no entry owner, it gets the same existing rejection as in a session with no apps.Linked Issue for product-semantic or public-contract changes: #259
Change class
Owning layer: Host. The settings catalog and
system.set_configown the switch. Each existing AUIP owner gates its own behavior: Cooperative Chat ingress for entry and prompt,AuipHandlerfor control routing and reconciliation,AuipEngagementCoordinatorfor participation,AuipNarrationAdapterfor commentary, andAuipRuntimefor 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:
AUIP_INTERACTION_ENABLED, defaulttrue, so existing installs keep current behavior. No migration is needed.system.get_configgainsauip_interaction_enabled, andsystem.set_configaccepts it.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.pytestontest_auip_runtime,test_auip_handler,test_auip_engagement,test_auip_narration,test_auip_self_attachandtest_config_catalog: all pass.tools/run_tests.py --shard-count 3, all three shards. 12 suites fail, and they fail with identical counts on unmodifiedmainin 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 .andtools/architecture/generate_views.py --check: pass.electron:npm test(709 tests, 0 failures, includingcheck:configafternpm run generate:config) andnpm 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
SwitchCardrendered by the existingrenderRuntimeGroup, the same as "Work and Chat approval".Relevant Python tests pass
CPU/model-less baseline remains supported
Electron
npm run buildpasses when Electron code changedDependency 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