Skip to content

feat(app): Agent Debug Log NDJSON export (#21) - #422

Merged
maatheusgois-dd merged 2 commits into
mainfrom
feat/agent-debug-log
Jul 22, 2026
Merged

feat(app): Agent Debug Log NDJSON export (#21)#422
maatheusgois-dd merged 2 commits into
mainfrom
feat/agent-debug-log

Conversation

@maatheusgois-dd

Copy link
Copy Markdown
Contributor

Summary

Gives AI agents (Cursor DEBUG MODE / XcodeBazelMCP agent_debug tools) a single aggregated NDJSON log they can pull from the simulator, so they can reason over network, crash, console, stderr, lifecycle, and EventBus events without scraping scattered sources.

  • AgentDebugLog — singleton that writes NDJSON lines to Documents/agent-debug.ndjson (or $AGENT_DEBUG_LOG_PATH when set). On enable() it mirrors existing Network + Console history, then streams live Network, Console, Stderr, Lifecycle, Crash, and EventBus events. Schema/protocol matches DebugSwift/skills swift-agent-debug-log.
  • AgentDebugLogViewController — new screen under App that surfaces the log path, pull commands, NDJSON schema, and a toggle for the underlying beta feature.
  • EventBusSubscriber — listeners move from an append-only array to a UUID-keyed dictionary; subscribe now returns a token and unsubscribe(_:) removes by token. Lets the log detach cleanly on disable() and prevents listener leaks.
  • Registers .agentDebugLog under DebugSwiftBetaFeature, wires it into FeatureHandling.enable/disable, adds it to the App action menu, enables it in the Example app, and updates FeatureBaseTests.allCases.

Implements #21. Follows the convention from prior feature PRs (#404#412).

Type of change

  • Feature

Test plan

  • Unit tests updated
  • Manual testing completed
  • CI passing

Manual test steps

  1. Launch the Example app — Agent Debug Log appears under the App section.
  2. Toggle the feature on; verify Documents/agent-debug.ndjson starts populating with network/console/event lines.
  3. Run AgentDebugLogTests — covers path resolution (AGENT_DEBUG_LOG_PATH override + Documents fallback), NDJSON line schema, enable/disable mirroring, EventBus subscription teardown, and session ID stability.

Screenshots / recordings (if applicable)

Checklist

  • I reviewed my own changes
  • I updated docs when needed
  • I considered backward compatibility

Give AI agents (Cursor DEBUG MODE / XcodeBazelMCP agent_debug tools)
a single aggregated log they can pull from the simulator, so they can
reason over network, crash, console, stderr, lifecycle, and EventBus
events without scraping scattered sources.

- AgentDebugLog: singleton writing NDJSON lines to
  `Documents/agent-debug.ndjson` (or `AGENT_DEBUG_LOG_PATH` when set).
  Mirrors Network/Console history on enable, then streams live events.
- AgentDebugLogViewController: exposes log path, pull commands, NDJSON
  schema, and a toggle for the `agentDebugLog` beta feature.
- EventBusSubscriber: switch listeners to a UUID-keyed dictionary and
  add `subscribe` returning a token + `unsubscribe(_:)` so the log
  can detach cleanly on disable (was append-only, leaked listeners).
- Register `.agentDebugLog` under DebugSwiftBetaFeature, wire it into
  FeatureHandling.enable/disable, the App action menu, and the Example
  app; update FeatureBaseTests.allCases.

Co-authored-by: oh-my-pi <https://omp.sh>
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Warnings
⚠️ Please assign yourself to the PR.
Messages
📖 Project coverage: 24.84%
📖 The PR added 902 and removed 7 lines. 9 file(s) changed.

DebugSwift: Coverage: 14.79

File Coverage
AgentDebugLogViewController.swift 0.0% ⚠️
EventBusSubscriber.swift 100.0%
AgentDebugLog.swift 83.19%
App.Controller.swift 17.46% ⚠️
FeatureHandling.swift 86.05%

Example.app: Coverage: 13.72

File Coverage
ExampleApp.swift 43.8% ⚠️

ExampleTests.xctest: Coverage: 97.49

File Coverage
FeatureBaseTests.swift 92.31%
AgentDebugLogTests.swift 97.77%

Generated by 🚫 Danger Swift against 5541106

Drop comments that restate the next line of code (section headers
echoing the heading string, "Singleton." on an empty init, verbose
multi-line docs collapsed to one-liners). Keeps MARKs, the `// Singleton.`
that silences the no_empty_block lint rule, and the `/// Source kind`
doc.

No behavior change. Build + AgentDebugLogTests (12/12) pass.

Co-authored-by: oh-my-pi <https://omp.sh>
@maatheusgois-dd
maatheusgois-dd merged commit 98caca5 into main Jul 22, 2026
5 checks passed
@maatheusgois-dd
maatheusgois-dd deleted the feat/agent-debug-log branch July 22, 2026 05:27
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