Skip to content

Fix cover/repaint generation failures: wrong audio dir, bad request JSON format, missing debug logs#13

Merged
lmangani merged 2 commits intomainfrom
copilot/fix-cover-mode-detection
Mar 8, 2026
Merged

Fix cover/repaint generation failures: wrong audio dir, bad request JSON format, missing debug logs#13
lmangani merged 2 commits intomainfrom
copilot/fix-cover-mode-detection

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

Cover mode and regular generations were silently failing due to a combination of a wrong AUDIO_DIR path, LM-specific fields leaking into dit-vae request JSONs, and overly strict route validation. Debug logging was absent, making these failures nearly impossible to diagnose.

Root causes & fixes

server/src/config/index.ts — Wrong audioDir (primary failure cause)

config.storage.audioDir resolved to <project>/public/audio (APP_ROOT = repo root), but:

  • LocalStorageProvider writes to server/public/audio
  • Express serves /audio/ from server/public/audio

resolveAudioPath('/audio/reference-tracks/…') was looking in the wrong directory — --src-audio pointed at a nonexistent path, crashing dit-vae.

// Before — wrong: resolves to <project>/public/audio
audioDir: resolveFromRoot(process.env.AUDIO_DIR || path.join(APP_ROOT, 'public', 'audio'))

// After — correct: resolves to <project>/server/public/audio
const SERVER_ROOT = path.resolve(__dirname, '../..');
audioDir: resolveFromRoot(process.env.AUDIO_DIR || path.join(SERVER_ROOT, 'public', 'audio'))

server/src/services/acestep.ts — Mode-specific request JSON

All modes were receiving the same JSON including LM-specific fields (lm_temperature, lm_cfg_scale, vocal_language, etc.) that only ace-qwen3 needs. audio_cover_strength was also written into text2music requests.

Now each mode gets only its relevant fields:

  • text2music → LM fields for ace-qwen3
  • coveraudio_cover_strength
  • repaintrepainting_start, repainting_end
  • passthroughaudio_codes; throws early if missing

Mode detection is now driven by explicit taskType flags (isCover, isRepaint, isPassthru, skipLm) rather than ad-hoc sourceAudioUrl presence checks.

server/src/routes/generate.ts — Validation too strict for cover/repaint

Custom-mode requests with only sourceAudioUrl (no style/lyrics) were rejected. Added requiresSourceAudio exception so cover/audio2audio/repaint requests pass through.

Debug logging added

Every generation now emits structured logs covering:

  • API entry: taskType, ditModel, sourceAudio URL, repaint region, user ID
  • Spawn: full ace-qwen3 and dit-vae CLI commands (previously truncated to 6 args), request JSON written to disk, resolved model paths
  • resolveAudioPath: every URL→filesystem resolution
  • Errors: validation failures and binary errors always include the full message

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cover mode format detection issue Fix cover/repaint generation failures: wrong audio dir, bad request JSON format, missing debug logs Mar 8, 2026
@lmangani lmangani marked this pull request as ready for review March 8, 2026 12:14
@lmangani lmangani merged commit 70117e3 into main Mar 8, 2026
4 checks passed
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