Skip to content

feat(OMN-9633): add remote task state repository - #1412

Merged
jonahgabriel merged 3 commits into
jonah/omn-9632-task-p12-scaffold-remote-agent-invoke-effectfrom
jonah/omn-9633-task-p13-add-remotetaskstaterepository-persistence-adapter
Apr 26, 2026
Merged

jonahgabriel merged 3 commits into
jonah/omn-9632-task-p12-scaffold-remote-agent-invoke-effectfrom
jonah/omn-9633-task-p13-add-remotetaskstaterepository-persistence-adapter

Conversation

@jonahgabriel

Copy link
Copy Markdown
Collaborator

Summary

  • add the migration and rollback
  • add a Postgres-backed for upsert/get/load_unfinished
  • cover the migration and repository with unit and live-Postgres integration tests

Verification

  • All checks passed!
  • ============================= test session starts ==============================
    platform darwin -- Python 3.12.12, pytest-9.0.3, pluggy-1.6.0 -- /Users/jonah/Code/omni_worktrees/OMN-9620/OMN-9632/omnibase_infra/.venv/bin/python
    cachedir: .pytest_cache
    hypothesis profile 'default'
    rootdir: /Users/jonah/Code/omni_worktrees/OMN-9620/OMN-9632/omnibase_infra
    configfile: pyproject.toml
    plugins: anyio-4.12.1, hypothesis-6.151.6, mock-3.15.1, locust-2.43.3, xdist-3.8.0, split-0.11.0, timeout-2.4.0, cov-6.3.0, pytest_httpserver-1.1.5, asyncio-1.3.0
    asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
    collecting ... collected 6 items

tests/unit/db/test_migration_069.py::test_migration_069_files_exist PASSED [ 16%]
tests/unit/db/test_migration_069.py::test_migration_069_creates_remote_task_state_table PASSED [ 33%]
tests/unit/db/test_migration_069.py::test_migration_069_declares_lifecycle_check_constraints PASSED [ 50%]
tests/unit/db/test_migration_069.py::test_migration_069_rollback_reverts_schema_version PASSED [ 66%]
tests/integration/db/test_remote_task_state_repository.py::test_upsert_then_load_unfinished PASSED [ 83%]
tests/integration/db/test_remote_task_state_repository.py::test_terminal_status_excluded_from_unfinished PASSED [100%]

============================== 6 passed in 0.20s ===============================

@coderabbitai

coderabbitai Bot commented Apr 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d799350-721d-44dc-adf9-2db3d864def0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-9633-task-p13-add-remotetaskstaterepository-persistence-adapter

Comment @coderabbitai help to get the list of available commands and usage tips.

Bumps omnibase-core pin from 9d64d5a3 to 6a65f885 (post-OMN-9637 merge of
PR 912) so ModelRemoteTaskState is importable.

Also adjusts test imports in
tests/integration/nodes/test_node_remote_agent_invoke_effect_integration.py
to use full module paths since the delegation package __init__.py does not
re-export the model classes.

OMN-9633
@jonahgabriel
jonahgabriel marked this pull request as ready for review April 26, 2026 02:47
@jonahgabriel
jonahgabriel merged commit affdcd8 into jonah/omn-9632-task-p12-scaffold-remote-agent-invoke-effect Apr 26, 2026
4 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-9633-task-p13-add-remotetaskstaterepository-persistence-adapter branch April 26, 2026 02:48
jonahgabriel added a commit that referenced this pull request Apr 27, 2026
* feat(OMN-9633): add remote task state repository

* fix(OMN-9633): normalize postgres retry typing

* fix(OMN-9633): bump core pin to merged delegation models

Bumps omnibase-core pin from 9d64d5a3 to 6a65f885 (post-OMN-9637 merge of
PR 912) so ModelRemoteTaskState is importable.

Also adjusts test imports in
tests/integration/nodes/test_node_remote_agent_invoke_effect_integration.py
to use full module paths since the delegation package __init__.py does not
re-export the model classes.

OMN-9633

---------

Co-authored-by: jonahgabriel <jonahgabriel@users.noreply.github.com>
andywu42 pushed a commit to andywu42/omnibase_infra that referenced this pull request Jun 10, 2026
* feat(OMN-9632): scaffold remote agent invoke effect

* fix(OMN-9632): add local stub models and integration test to unblock CI

- Contract module references changed from omnibase_core.models.delegation
  (not yet merged) to node-local models package
- Remove unsupported 'persistence' field from contract.yaml
- Add EnumAgentTaskStatus, ModelInvocationCommand, ModelAgentTaskLifecycleEvent
  as importable stubs satisfying the contract linter import check
- Add integration test at tests/integration/ (glob-visible to CI gate)
- Replace persistence assertion in unit test with module-reference assertion

Closes OMN-9632.

* chore: retrigger CI after PR body update [OMN-9632]

* chore: retrigger CI — clean PR body to single ticket ref [OMN-9632]

* feat(OMN-9633): add remote task state repository (OmniNode-ai#1412)

* feat(OMN-9633): add remote task state repository

* fix(OMN-9633): normalize postgres retry typing

* fix(OMN-9633): bump core pin to merged delegation models

Bumps omnibase-core pin from 9d64d5a3 to 6a65f885 (post-OMN-9637 merge of
PR 912) so ModelRemoteTaskState is importable.

Also adjusts test imports in
tests/integration/nodes/test_node_remote_agent_invoke_effect_integration.py
to use full module paths since the delegation package __init__.py does not
re-export the model classes.

OMN-9633

---------

Co-authored-by: jonahgabriel <jonahgabriel@users.noreply.github.com>

* feat(OMN-9634): implement real A2A submit and watch path (OmniNode-ai#1414)

* feat(OMN-9634): implement A2A submit handler

* feat(OMN-9635): implement A2A watch lifecycle loop

* feat(OMN-9634): use real a2a sdk transport

* fix(OMN-9634): align A2A handler with core delegation models

The A2A handler/tests were written against the older ModelA2ATaskResponse
shape (status: str, ModelTargetAgent.agent_ref, etc). The merged core
delegation models (PR omnibase_core#912) tightened the schema:

  - ModelA2ATaskResponse.status -> EnumAgentTaskLifecycleType
  - ModelTargetAgent fields: target_ref + base_url + protocol (no agent_ref,
    no protocol_version)

Map raw A2A peer status -> typed lifecycle enum at the SDK boundary in
_task_to_response and stop double-mapping inside watch(). Persist the raw
peer status string into ModelRemoteTaskState.last_remote_status via
response.status.value so the existing str | None field stays satisfied.

Other changes required to unblock the suite:
  - bump omnibase-core pin to OMN-9637 branch HEAD (delegation models)
  - bump dep spec + version_compatibility _FALLBACK_MATRIX to 0.40/<0.41
    so the auto-derived runtime VERSION_MATRIX accepts the new core
  - register ProtocolA2ATransport in KNOWN_INFRA_PROTOCOLS (test_protocol_ownership)
  - flip test_handlers_are_deferred_to_p14 -> test_p14_handler_is_wired
    now that this PR _is_ P14 and the handler is registered in contract.yaml
  - add remote-agent-invoke topic to _BASELINE_DEAD_LETTER_ALLOWLIST
    (publisher node_delegation_orchestrator pending in OMN-9620 epic)
  - integration test imports delegation models from each module directly
    instead of the package level (the pinned core branch's
    delegation/__init__.py is still empty)

---------

Co-authored-by: jonahgabriel <jonahgabriel@users.noreply.github.com>

* fix(OMN-9632): register node_remote_agent_invoke_effect entry point

Drift discovered during rebase onto origin/main: the new node was
present in src/ but missing from [project.entry-points."onex.nodes"].
Required by tests/scripts/test_generate_entry_points.py.

OMN-9632

* fix(OMN-9632): wrap A2A transport errors and resolve CR feedback (OmniNode-ai#1410)

Address CodeRabbit review threads on PR OmniNode-ai#1410:

- Wrap transport.submit() in try/except: on failure, mark repository row
  FAILED with error and re-raise as InfraConnectionError with
  ModelInfraErrorContext.with_correlation (operation=a2a_submit,
  transport_type=HTTP). Prevents phantom SUBMITTED rows and preserves
  correlation_id traceability.
- Wrap transport.get_task() in watch() with the same error-context
  wrapping (operation=a2a_watch).
- Add @pytest.mark.serial to the Kafka integration test so deterministic
  consumer-group assertions don't race parallel workers.
- Replace Ellipsis (...) Protocol method bodies with docstrings to
  satisfy CodeQL "statement has no effect" findings.
- Add unit tests covering submit-failure cleanup and watch-failure
  error-context wrapping.

---------

Co-authored-by: jonahgabriel <jonahgabriel@users.noreply.github.com>
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.

1 participant