Skip to content

Refactor GAgent registry ownership ports#452

Draft
louis4li wants to merge 8 commits intodevfrom
refactor/2026-04-27_registry-ownership-ports
Draft

Refactor GAgent registry ownership ports#452
louis4li wants to merge 8 commits intodevfrom
refactor/2026-04-27_registry-ownership-ports

Conversation

@louis4li
Copy link
Copy Markdown
Contributor

Summary

Refactors the legacy IGAgentActorStore surface into explicit GAgent registry command, query, and command-admission ports for issue #348.

What Changed

  • Adds IGAgentActorRegistryCommandPort, IGAgentActorRegistryQueryPort, and IScopeResourceAdmissionPort contracts.
  • Replaces the actor-backed store implementation with ActorBackedGAgentRegistryPorts backed by GAgentRegistryGAgent.
  • Adds typed registry admission messages and GAgentRegistryOperation enum.
  • Moves list paths to eventually consistent registry read-model snapshots with StateVersion, UpdatedAt, and ObservedAt freshness fields.
  • Moves NyxID chat, StreamingProxy, and draft-run target operations to registry admission instead of projection/list-based ownership checks.
  • Enforces create-before-register semantics for immediately operable resources and adds rollback for registration failure/cancellation paths.
  • Disables direct generic POST /{scopeId}/gagent-actors registration with a 405 response so target creation stays in capability command endpoints.
  • Adds docs/canon/gagent-registry-ownership.md and updates related lifecycle docs.
  • Adds architecture guard coverage to prevent production references to the retired IGAgentActorStore/ActorBackedGAgentActorStore abstractions.

Impact

This separates registry lifecycle writes, list queries, and command-path admission into distinct semantics. Command admission no longer depends on projection freshness, while list responses remain explicitly eventually consistent.

Validation

Passed:

  • git diff --check
  • bash tools/ci/test_stability_guards.sh
  • dotnet test test/Aevatar.GAgentService.Tests/Aevatar.GAgentService.Tests.csproj --no-restore --nologo --filter "FullyQualifiedName~GAgentDraftRunActorPreparationServiceTests"
  • dotnet test test/Aevatar.AI.Tests/Aevatar.AI.Tests.csproj --no-restore --nologo --filter "FullyQualifiedName~StreamingProxyEndpointsCoverageTests"
  • dotnet test test/Aevatar.GAgentService.Integration.Tests/Aevatar.GAgentService.Integration.Tests.csproj --no-restore --nologo --filter "FullyQualifiedName~ScopeGAgentEndpointsTests"

Known existing blocker observed while reviewing:

  • bash tools/ci/architecture_guards.sh reaches playground_asset_drift_guard and fails because demos/Aevatar.Demos.Workflow.Web/wwwroot/app.js differs from a freshly built CLI playground asset. This appears unrelated to the registry ownership change but still blocks the full guard command until asset drift is reconciled.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 79.20489% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.59%. Comparing base (298cec8) to head (f84ca16).
⚠️ Report is 7 commits behind head on dev.

Files with missing lines Patch % Lines
...ture/ActorBacked/ActorBackedGAgentRegistryPorts.cs 74.25% 31 Missing and 12 partials ⚠️
...tService.Hosting/Endpoints/ScopeGAgentEndpoints.cs 76.00% 16 Missing and 2 partials ⚠️
...peGAgents/GAgentDraftRunActorPreparationService.cs 92.30% 1 Missing and 3 partials ⚠️
...e.Abstractions/ScopeGAgents/GAgentRegistryPorts.cs 89.65% 3 Missing ⚠️
@@            Coverage Diff             @@
##              dev     #452      +/-   ##
==========================================
- Coverage   70.59%   70.59%   -0.01%     
==========================================
  Files        1208     1208              
  Lines       86806    87013     +207     
  Branches    11369    11383      +14     
==========================================
+ Hits        61284    61424     +140     
- Misses      21093    21146      +53     
- Partials     4429     4443      +14     
Flag Coverage Δ
ci 70.59% <79.20%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...oProjectionReadModelServiceCollectionExtensions.cs 91.53% <ø> (ø)
...DependencyInjection/ServiceCollectionExtensions.cs 100.00% <100.00%> (ø)
...e.Abstractions/ScopeGAgents/GAgentRegistryPorts.cs 89.65% <89.65%> (ø)
...peGAgents/GAgentDraftRunActorPreparationService.cs 88.67% <92.30%> (+5.34%) ⬆️
...tService.Hosting/Endpoints/ScopeGAgentEndpoints.cs 83.29% <76.00%> (-3.18%) ⬇️
...ture/ActorBacked/ActorBackedGAgentRegistryPorts.cs 74.25% <74.25%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor Author

补充说明一下这轮 review 的处理边界:

  • 前三项属于仍然存在、但不在这次 registry ports/dev diff 修复范围内的 ownership/admission 架构债务,已单独开 issue 跟踪:Track remaining ownership/admission paths that still depend on read models or actor ID shape #462

    • StudioMemberService.BindAsync 仍依赖 StudioMember projection readmodel 做 bind admission。
    • relay scope fallback 仍通过 ChannelBot registration projection 按 API key 反查 scope。
    • scoped relay conversation actorId 仍编码 scope ownership 信息。
  • 后两项已在本 PR 内修复:

    • registry register receipt 不再把普通 dispatch ACK 直接声明为 AdmissionVisible;现在会显式验证 admission visibility,验证不到时降级为 AcceptedForDispatch
    • unregister receipt 不再返回 AdmissionVisible,新增并返回 AdmissionRemovedIsAdmissionVisible 对该阶段为 false

同时补了 NyxID create conversation 的回滚逻辑:当注册没有达到 admission-visible 时,会 unregister registry entry 并 destroy actor,避免返回成功但留下半成品 actor/ownership 状态。

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