[FR]: Testing agent should run dynamic (activity-scoped) app functions in their activity

Open
#105 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
android, kotlin

Research direction

Read ExecuteAppFunctionUseCase and the Debug tab state that exposes AppFunctionState.activityIds; the issue does not name their file paths. Start by tracing how the use case builds ExecuteAppFunctionRequest and how the Debug tab chooses a registering activity. Done means Debug can run a dynamic function in a selected registering activity, while agent calls either target the foreground activity or omit unsupported dynamic functions until that is possible.

Written by the indexing model from the issue text.

Description

Is there an existing issue for this?
  • I have searched the existing issues
Describe the problem

Dynamic app functions (@AppFunctionSignature(scope = AppFunctionMetadata.SCOPE_ACTIVITY), registered from an Activity with AppFunctionManager.registerAppFunction / handleAppFunction) can only be executed with ExecuteAppFunctionRequest.activityId set to an activity that registers them. Otherwise the platform returns ERROR_FUNCTION_NOT_FOUND.

The testing agent never sets an activity ID (ExecuteAppFunctionUseCase builds the request from the package name, function ID and parameters only), so:

  • The Debug tab can't run a dynamic function. Since #104, it shows the function as "Dynamic" with the number of activities that register it, and keeps Run disabled with an explanation.
  • In Agent Demo and Live sessions, a registered dynamic function is offered to the model (isEnabled is true while it is registered), but every call fails with FUNCTION_NOT_FOUND.
Describe the solution
  • Debug tab: run a dynamic function in an activity that registers it (AppFunctionState.activityIds, API 37+), with a choice when several activities register it.
  • Agent: for the overlay / split-screen CUJ described in #94 ("put a poem into the current chat thread"), target the foreground activity, e.g. via VoiceInteractionSession.getAppFunctionActivityId. Until then, consider leaving dynamic functions out of the tools sent to the model, since calls to them can't succeed.
Additional context

Found during "Function state & tests" (#104). Related to #94 and #98.

Code of Conduct
  • I agree to follow this project's Code of Conduct
Dominant language
Kotlin
Stars
222
Forks
54
Avg merge
1d 11h
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/appfunctions

All issues in android/appfunctions

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.