Skip to content

[FEAT] Add InjectionHandle wait_until_ready hook - #13

Merged
Nina Chikanov (nina-msft) merged 14 commits into
microsoft:mainfrom
nina-msft:dev/nina-msft/8252
Apr 20, 2026
Merged

[FEAT] Add InjectionHandle wait_until_ready hook#13
Nina Chikanov (nina-msft) merged 14 commits into
microsoft:mainfrom
nina-msft:dev/nina-msft/8252

Conversation

@nina-msft

@nina-msft Nina Chikanov (nina-msft) commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Today, the only mechanism to wait for injected content to become visible to the target agent is a fixed asyncio.sleep() driven by InjectionHandle.indexing_delay_seconds (see XPIAExecution._activate_handles_async()). This works for simple time-based delays but doesn't generalize to scenarios where readiness can be actively verified, such as:

  • Polling an API until an injected document appears in search results
  • Querying a database row until it becomes visible
  • Waiting for a webhook callback or pipeline completion

This PR introduces a wait_until_ready async method on the InjectionHandle protocol that surfaces can override to implement custom readiness logic. The current sleep-based delay becomes one default implementation of this hook.


Protocol Changes (Breaking)

  • Removed indexing_delay_seconds property from InjectionHandle protocol.
  • Added wait_until_ready() async method to InjectionHandle protocol — surfaces now control their own readiness strategy instead of exposing a passive delay value.

New

  • sleep_until_ready(delay) — free helper function in rampart.core.injection for surfaces that only need a simple sleep-based readiness wait.
  • _OneDriveInjection.wait_until_ready() — delegates to sleep_until_ready using the surface's indexing_delay. Future versions will poll the Graph API instead.
  • TestOneDriveInjectionWaitUntilReady — test class verifying the OneDrive wiring to sleep_until_ready.

Changed

  • XPIAExecution._activate_handles_async — replaced sequential max(indexing_delay_seconds) + asyncio.sleep with concurrent per-handle readiness via asyncio.TaskGroup.
  • OneDriveSurface — internal references changed from private attributes (self._drive_id, self._folder_path) to public property accessors (self.drive_id, self.folder_path).
  • test_xpia.py_mock_handle no longer sets delay / indexing_delay_seconds; cleanup tests now assert wait_until_ready was called.
  • test_protocols.py — structural subtyping tests updated to match the new protocol shape.
  • test_onedrive.py — assertions use public properties; removed test_indexing_delay_from_surface.

Housekeeping

  • Fixed unnecessary f-string prefixes on strings without interpolation in onedrive.py.
  • Removed !.vscode/settings.json from .gitignore.

  • unit tests pass
  • pre-commit run --all-files run w/ success

Comment thread .gitignore
@nina-msft
Nina Chikanov (nina-msft) marked this pull request as ready for review April 15, 2026 22:22
@nina-msft
Nina Chikanov (nina-msft) requested a review from a team April 15, 2026 22:22
Reverts unintentional removal of \r\r characters on the Icon
line (L26) and extra blank line, per PR review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread rampart/surfaces/onedrive.py
Comment thread docs/work-items/exception-group-infra-error.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great

@nina-msft
Nina Chikanov (nina-msft) merged commit df647b8 into microsoft:main Apr 20, 2026
1 check passed
@nina-msft
Nina Chikanov (nina-msft) deleted the dev/nina-msft/8252 branch April 20, 2026 19:08
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