Skip to content

Add Muse Code tracing, import, and attach - #70

Merged
Stephen Belanger (Qard) merged 21 commits into
mainfrom
t3code/plan-sdk-312-implementation
Oct 27, 2026
Merged

Stephen Belanger (Qard) merged 21 commits into
mainfrom
t3code/plan-sdk-312-implementation

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Muse Code supports native tracing across live capture, historical import, managed runs, and attach. Live hooks and exports share deterministic model/tool IDs; detaching leaves native work open, and late completion enriches the same spans without allowing older root snapshots to replace newer answers.

  • Support all 17 native hook events, tool success/failure and batch results, permission observations, child lifecycle, compaction, and failed turns. Preserve native timing, response metadata, final output, and counted-once token totals.
  • Use muse-code-sdk = 1.4.12 for MSP initialization, stdio framing, request correlation, and concrete session-list parameters/results. The client lives in bt-daemon/src/muse/msp.rs; subprocess creation retains the repository's Windows-safe helper, bounded diagnostics, timeouts, and cancellation cleanup.
  • Keep hook/export wire types, messages, outcomes, token DTOs, authored row metadata, and generated configuration in focused modules under bt-daemon/src/muse. Decode hooks once into a typed event enum; stream export records through that same translator. Reducer state stays in translate/muse*.rs.
  • Preserve explicit null versus absent completion metadata for replay fingerprints. Unknown native records are skipped; malformed known events have contextual diagnostics. Resource samples never become token counters. JSON remains at transport/row boundaries, open provider/tool leaves, and foreign configuration preservation.
  • Preserve enterprise/user hooks, migrate owned legacy configurations, and isolate managed-run routes. muse/config/settings.rs, hooks.rs, and ownership.rs type existing settings, hook collections, command handlers, and strict owned-file recognition. Setup orchestration contains no dynamic JSON navigation. Missing/null distinctions and unknown extension data survive edits; only exact owned files/handlers are eligible for migration/removal. Typed settings use the shared atomic writer under Muse’s native lock.
  • Declare Rust 1.97 as the daemon minimum and pin development/CI to 1.97.1, matching the SDK requirement. bt already uses 1.97.1.

Validation:

  • cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked: 622 passed, 9 opt-in tests ignored.
  • Strict all-feature/all-target Clippy, formatting, locked metadata, and diff checks pass.
  • All four opt-in Muse tests pass on macOS against Muse Code 1.4.11-R6667.1 with deterministic loopback inference/ingest: tool/retry/failure tracing; active attach/detach/reattach plus SDK-backed import muse --all; and both managed-hook coexistence/sanitized-environment tests.
  • Native tests use Muse's file credential backend and disable telemetry with temporary homes. Linux native tests and Linux/macOS/Windows Rust checks run in CI; CI for the latest revision is reported separately from local validation.

Native fidelity limits remain explicit: hook messages/output are previews; permission hooks do not report decisions; compaction lacks operation IDs. Observed built-in reminder child hook/export metadata omits parent identity, so ancestry is not guessed across concurrent sessions. Legacy exports without model_step cannot guarantee live/export model deduplication. Muse's official installer supports Linux/macOS; Windows runs Rust fixture tests only.

Distribution: hooks ship through bt. After merge, its existing update-bt-daemon.yml workflow prepares the consumer pin/lockfile PR; publication follows the bt release process.

Review follow-up: consistently resolve BRAINTRUST_MUSE_BIN through the environment helper; prepare fresh explicit daemon endpoints before sanitized hooks run; supply host information from the standalone entry point; and reject empty one-shot imports while allowing empty attach polls and preserving nonempty active sessions. Regressions cover standalone/custom-socket startup and empty imports; native managed-run verification also checks real hook delivery at a fresh explicit endpoint.

@Qard
Stephen Belanger (Qard) force-pushed the t3code/plan-sdk-312-implementation branch 2 times, most recently from a86284a to 345b900 Compare September 11, 2026 13:21
@Qard
Stephen Belanger (Qard) force-pushed the t3code/plan-sdk-312-implementation branch 3 times, most recently from 1a0c8e0 to 6d624cd Compare September 24, 2026 15:47
@Qard
Stephen Belanger (Qard) force-pushed the t3code/plan-sdk-312-implementation branch from 7b8ecd6 to 45ce4f7 Compare October 16, 2026 18:34
@Qard Stephen Belanger (Qard) changed the title Add Muse Code hook tracing Add Muse Code tracing, import, and attach Oct 20, 2026
@Qard
Stephen Belanger (Qard) force-pushed the t3code/plan-sdk-312-implementation branch from 45ce4f7 to 6dc2a78 Compare October 20, 2026 17:49
@Qard
Stephen Belanger (Qard) marked this pull request as ready for review October 23, 2026 14:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T14:56:21.790014Z 6be6464 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6be646487f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread bt-daemon/src/managed_run/muse.rs Resolved
Comment thread bt-daemon/src/managed_run/mod.rs Resolved
Comment thread bt-daemon/src/managed_run/muse.rs Resolved
@Qard
Stephen Belanger (Qard) force-pushed the t3code/plan-sdk-312-implementation branch from 56c085b to 87559fc Compare October 26, 2026 18:22
@Qard
Stephen Belanger (Qard) merged commit c10aa28 into main Oct 27, 2026
23 checks passed
@Qard
Stephen Belanger (Qard) deleted the t3code/plan-sdk-312-implementation branch October 27, 2026 16:40
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