Skip to content

Add portal open/close logging with beacon and host IDs#2262

Merged
KCarretto merged 3 commits intomainfrom
copilot/improve-tavern-portal-logging
Apr 17, 2026
Merged

Add portal open/close logging with beacon and host IDs#2262
KCarretto merged 3 commits intomainfrom
copilot/improve-tavern-portal-logging

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Portal lifecycle events (create, open, close) had no structured logging, making it difficult to trace portal activity back to specific beacons and hosts.

Changes

  • mux/mux_create.go — Eager-load host on beacon queries; log "portal created" with portal_id, beacon_id, host_id
  • c2/api_create_portal.go — Log "portal closed" in sendPortalClose() with beacon/host info queried from the portal
  • graphql/mutation.resolvers.go — Log "portal close requested" in ClosePortal mutation with beacon/host info
  • portals/api_open_portal.go — Log "portal opened" in OpenPortal gRPC handler with beacon/host info

All log calls use slog.InfoContext with structured key-value pairs. Beacon/host query failures emit slog.WarnContext and never block the operation.

// Example log output shape
slog.InfoContext(ctx, "portal created", "portal_id", 42, "beacon_id", 7, "host_id", 3)

Copilot AI and others added 2 commits April 17, 2026 22:12
- Log portal creation in mux_create.go with portal_id, beacon_id, host_id
- Log portal close in api_create_portal.go sendPortalClose() with beacon/host info
- Log portal close request in ClosePortal GraphQL mutation with beacon/host info
- Log portal open in OpenPortal gRPC handler with beacon/host info
- Eager-load host on beacon queries in CreatePortal for logging

Agent-Logs-Url: https://github.com/spellshift/realm/sessions/9bdfc37c-7143-43af-a730-2854efdf1456

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
Address code review feedback: add warning logs when beacon/host
queries fail during portal open/close logging, instead of silently
ignoring the errors.

Agent-Logs-Url: https://github.com/spellshift/realm/sessions/9bdfc37c-7143-43af-a730-2854efdf1456

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
@KCarretto KCarretto merged commit bf574fb into main Apr 17, 2026
6 of 8 checks passed
@KCarretto KCarretto deleted the copilot/improve-tavern-portal-logging branch April 17, 2026 22:28
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