Skip to content

feat(audio-transcribe): skill manifest + fix empty-file race in bridge result_watchers#1874

Open
bassilkhilo-ag2 wants to merge 3 commits into
sonichi:mainfrom
bassilkhilo-ag2:feat/audio-transcribe-manifest-skill
Open

feat(audio-transcribe): skill manifest + fix empty-file race in bridge result_watchers#1874
bassilkhilo-ag2 wants to merge 3 commits into
sonichi:mainfrom
bassilkhilo-ag2:feat/audio-transcribe-manifest-skill

Conversation

@bassilkhilo-ag2

Copy link
Copy Markdown
Contributor

What

Three changes in two commits:

  1. skills/audio-transcribe/manifest.json — adds skill manifest (version: 1.0.0, tierRequired: free) so the skill is discoverable by the skill-installer.
  2. skills/audio-transcribe/SKILL.md — adds YAML frontmatter (name, description) for consistency with other skills.
  3. Fix (src/slack-bridge.py, src/discord-bridge.py, src/telegram-bridge.py) — adds if not reply_text: continue guard in each bridge's result_watcher loop, before the irreversible .pop() on pending_replies.

The race bug (commit 3)

When a result file is written via shell redirect (> file), the OS creates it empty before content is written. The bridge polls every ~2s; if it fires during that window:

  1. reply_text = result_file.read_text().strip()""
  2. pending_replies.pop(task_id) → removes the mapping (irreversible)
  3. The send is skipped because the text is empty
  4. File is archived — reply permanently lost, no error logged

Fix: add if not reply_text: continue BEFORE .pop(). The file stays; the next poll (2s later) finds it non-empty and sends.

Bug surface: active since at least PR #1453 (voice note bridging). Highest-risk path: Slack and Telegram where long Gemini responses can lag the redirect.

Test

tests/bridge-result-race-guard.test.py — structural regression test added as part of this PR. Checks all 3 bridges for the guard in the correct position (after read, before pop).

python3 tests/bridge-result-race-guard.test.py
  ok  slack-bridge: empty-file race guard present and correctly ordered
  ok  discord-bridge: empty-file race guard present and correctly ordered
  ok  telegram-bridge: empty-file race guard present and correctly ordered
PASSED: all 3 bridges have the race guard

Checklist

  • Regression test added
  • No prompts or tool behavior changed (pure plumbing guard)
  • Guard is continue not return (stays in the watcher loop)
  • Guard appears before all irreversible operations (pop, archive)

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01KXQJogmVSdYrKtYX1LwzwT

bassilkhilo-ag2 and others added 3 commits June 30, 2026 19:03
Adds manifest.json (version 1.0.0, free tier) so the skill is discoverable
by the skill-installer. Adds frontmatter to SKILL.md for consistency with
other skills that expose name/description metadata.

Also adds tests/bridge-result-race-guard.test.py — structural regression
test confirming all 3 bridges (slack/discord/telegram) guard against the
empty-file race where a bridge polls a result file before the write
completes and archives it empty, permanently losing the reply.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a result file is written via shell redirect (> file), the OS creates
the file empty before the process writes content. The bridge result_watcher
polls every ~2s; if it fires during that window it reads an empty string,
skips the send, but still pops pending_replies and archives the file —
permanently losing the reply with no error logged.

Fix: add `if not reply_text: continue` after read_text().strip() and
BEFORE the irreversible .pop() in all three bridge result_watcher loops
(slack-bridge.py, telegram-bridge.py, discord-bridge.py).

Regression test: tests/bridge-result-race-guard.test.py (structural check
added in preceding commit) verifies the guard is present and ordered
correctly in all 3 bridges.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXQJogmVSdYrKtYX1LwzwT
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@cla-assistant check

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