Skip to content

Move runtime wrapper composition and disposal to the host, stop chaining dispose #165

Description

@radu-mocanu

Problem

Runtime wrappers own and dispose their delegate. dispose on the outermost wrapper walks down the chain: instrumented, licensed, BTS, resumable, hydration, each one calling self.delegate.dispose().

That makes ownership implicit and unrepresentable. Nothing in UiPathDisposableProtocol says whether a wrapper disposes what it wraps, so the answer is only discoverable by reading every implementation, and it is not the same in all of them. ConversationalWorkspaceRuntime was written as a non owning decorator, which is the more principled choice for a decorator, and that single difference silently leaks the whole chain below it, because callers only ever hold the outermost object.

Consumers work around it by keeping a side list of the runtimes they still own and disposing those by hand. The list is populated by passing it into the function that builds the stack and appending to it there, so the owner of the list is not the code that writes to it. A new call site that forgets the argument gets a runtime error at execution time, and only for one specific combination of inputs, so tests do not catch it.

PR #164 makes the conversational wrapper chain like the others. That unblocks the leak, but it settles the inconsistency by spreading the weaker convention rather than fixing it.

Proposal

Give the host, meaning the CLI or whatever composes the stack, the job of creating the wrappers and disposing them, and make every wrapper a non owning decorator with no dispose chaining.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions