Skip to content

Split BusReader and HistoricalBusReader out of MessageBus for read-only CLI verbs - #5285

Merged
trissim merged 1 commit into
mainfrom
perf/bus-reader-cut10
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/bus-reader-cut10

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Core cold-start Cut 10a: decouples read-only bus operations from MessageBus / OwnerPublisher so cli_verbs/threads.py, cli_verbs/inbox.py, and cli_verbs/history.py stop importing the publication, coordination, and maintenance-barrier stacks.

Changes

  • src/agent_comms/messaging/published_bus.py: factored read-only catalog reads (_channels, require_channel, channel_in, channel_declarations) into BusCatalog(BusResources); PublishedBus[Writes](BusCatalog) inherits it with zero duplication.
  • src/agent_comms/messaging/bus_reader.py: moved read-only bus access (BusReader(BusCatalog, BusReadSource), UnreadCut, _CachedPendingProjection) out of message_bus.py.
  • src/agent_comms/messaging/historical_views.py: added HistoricalBusReader(BusReader) carrying HistoryArchive.
  • src/agent_comms/messaging/message_bus.py: MessageBus[Writes: Publisher](PublishedBus[Writes], HistoricalBusReader) inherits all read/history methods cleanly via C3 MRO and keeps only publication/coordination/owner-message methods.
  • src/agent_comms/cli_verbs/{threads,inbox,history}.py: switched read-only execute() paths from MessageBus(..., OwnerPublisher) to BusReader / HistoricalBusReader.
  • tests/test_revision_owner_annotations.py: mirrored the Goals/GoalSnapshotReader assertion (issubclass(MessageBus, bus_source) + bus_source in BusReader.__bases__).

Verification

  • 4-round alternating unprofiled warm A/B cold-start:
    • cli_verbs.threads: 684 -> 654 mods (-30), 909.5 -> 853.0 ms (-56.6 ms), message_bus & publisher True -> False
    • cli_verbs.inbox: 677 -> 642 mods (-35), 873.4 -> 812.6 ms (-60.8 ms), message_bus & publisher True -> False
    • cli_verbs.history: 685 -> 680 mods (-5), message_bus & publisher True -> False
  • Focused tests: 87/87 passed across test_revision_owner_annotations, test_historical_views, test_read_ledger, test_message_notifications, test_command_families
  • Imports: 952/952 modules imported (0 errors), REL_IMPORTS=0, 0 new NRA non-dead findings.

@trissim
trissim merged commit b32a919 into main Nov 28, 2026
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