mirror of
https://github.com/meshtastic/firmware.git
synced 2026-05-19 14:25:28 -04:00
* Implement rotating JSONL recorder for persistent logging * Fixes * Update documentation and clean up imports in command files * Address remaining recorder review feedback Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/2541773c-869a-463f-9fae-8505272c06ff Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * recorder: fix lock re-entry deadlock on start() and force_rotate_all() The previous "Fixes" commit added `_files_snapshot()` which acquires `self._lock` so handlers don't race with `stop()` clearing `_files`. But two callers were already holding `self._lock` when they invoked methods that go through the snapshot: - `start()` writes the `recorder_start` event from inside its `with self._lock:` block. `_write_event` -> `_files_snapshot` re-acquires the same non-reentrant `threading.Lock`, freezing process startup. - `force_rotate_all()` calls `self.status()` (which also acquires `self._lock`) while still holding the lock from rotating each file. Both fixes release the lock before the call. The recorder_start marker still lands in events.jsonl because the started/started_at flags are already set when we write it. Verified end-to-end against the standalone /tmp/verify_pr_fixes.py harness — all 9 PR review-comment fixes pass, including pause/resume event ordering and concurrent start/stop without KeyError. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix markdown linting issues in leakhunt.md and repro.md * Handle recorder startup and query review fixes Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Tighten recorder follow-up tests Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Stabilize recorder startup tests Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Remove brittle recorder startup test Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Polish recorder follow-up errors Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Refine recorder startup and regex errors Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Clean up recorder follow-up nits Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/78540a9f-fe62-4350-b252-0ae5621f0b8a Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Trunk --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude Code slash commands for the mcp-server test suite
Three AI-assisted workflows wrapping mcp-server/run-tests.sh and the meshtastic MCP tools. Each one has a twin in .github/prompts/ for Copilot users.
| Slash command | What it does | Copilot equivalent |
|---|---|---|
/test [args] |
Runs the test suite (auto-detects hardware) and interprets failures | .github/prompts/mcp-test.prompt.md |
/diagnose [role] |
Read-only device health report via the meshtastic MCP tools | .github/prompts/mcp-diagnose.prompt.md |
/repro <test> [n=5] |
Re-runs one test N times, diffs firmware logs between passes and failures | .github/prompts/mcp-repro.prompt.md |
Why two surfaces
The Claude Code commands and Copilot prompts cover the same three workflows but each speaks its host's idiom:
- Claude Code (
/test) uses$ARGUMENTSfor pass-through, has direct access to Bash + all MCP tools registered in the user's settings, and runs in the terminal context. - Copilot (
/mcp-test) runs in VS Code's agent mode; it has terminal + MCP access too but typically asks the operator to confirm inputs interactively.
A contributor using either IDE gets equivalent assistance. Keep the two in sync when behavior changes — the diff of intent should be minimal.
House rules
- No destructive writes without explicit operator approval. Skills that could reflash, factory-reset, or reboot a device must describe the action and stop — the operator authorizes.
- Interpret failures, don't just echo them. The skill body should pull firmware log lines from
mcp-server/tests/report.html(theMeshtastic debugsection, attached bytests/conftest.py::pytest_runtest_makereport) and classify the failure. - Keep MCP tool calls sequential per port. SerialInterface holds an exclusive port lock; two parallel tool calls on the same port deadlock.
- Never speculate about root cause. If the evidence doesn't support a classification, say "unknown" and list what you'd need to disambiguate.
Adding a new command
-
Write the Claude Code version at
.claude/commands/<name>.mdwith YAML frontmatter:--- description: one-line purpose (used for auto-invocation by the model) argument-hint: [optional-hint] --- -
Write the Copilot equivalent at
.github/prompts/mcp-<name>.prompt.mdwith:--- mode: agent description: ... --- -
Add the row to the table above. Cross-link in both bodies.
-
Smoke-test on Claude Code first (
/<name>should appear in autocomplete), then in VS Code Copilot (/mcp-<name>in Chat).