Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: let Stop cancel a code-engine recording that is waiting on the audio unlock (#8375)

[._.]/ Adam Eivy61ba5bc226b1
diff --git a/client/src/components/music/CodePanel.jsx b/client/src/components/music/CodePanel.jsx
index bd4766a944..c933380695 100644
--- a/client/src/components/music/CodePanel.jsx
+++ b/client/src/components/music/CodePanel.jsx
@@ -128,7 +128,11 @@ export default function CodePanel({
setFrameError('');
post({ type: 'play', code });
};
- const stop = () => post({ type: 'stop' });
+ // Stop also cancels a recording (or one waiting on the audio unlock).
+ const stop = () => {
+ post({ type: 'stop' });
+ setSavePhase((phase) => (phase === 'recording' ? null : phase));
+ };
const save = () => {
if (!code.trim() || !trackId) return;
@@ -234,7 +238,7 @@ export default function CodePanel({
<Play className="h-4 w-4" />
<span>{playing ? 'Re-run' : 'Play'}</span>
</button>
- <button type="button" onClick={stop} disabled={!frameReady || !!savePhase || !playing} className={GHOST_BTN}>
+ <button type="button" onClick={stop} disabled={!frameReady || savePhase === 'uploading' || !(playing || frameState === 'blocked' || savePhase === 'recording')} className={GHOST_BTN}>
<Square className="h-4 w-4" />
<span>Stop</span>
</button>
diff --git a/client/src/components/music/CodePanel.test.jsx b/client/src/components/music/CodePanel.test.jsx
index 6a65e2c9a8..2516b31b92 100644
--- a/client/src/components/music/CodePanel.test.jsx
+++ b/client/src/components/music/CodePanel.test.jsx
@@ -131,6 +131,17 @@ describe('<CodePanel>', () => {
expect(form.get('title')).toBe('Night Drive');
});
+ it('lets Stop cancel a recording that is waiting on the audio unlock', async () => {
+ window.localStorage.setItem('portos.musicDesigner.strudelCode', JSON.stringify({ trackId: 'track-1', code: CODE }));
+ await mountReady();
+ fireEvent.click(screen.getByRole('button', { name: /Save as take/ }));
+ await fromFrame({ type: 'state', state: 'blocked' });
+ expect(screen.getByText(/holding audio back/)).toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: /^Stop$/ }));
+ expect(posted).toHaveBeenLastCalledWith({ type: 'stop' }, '*');
+ expect(screen.getByRole('button', { name: /Save as take/ })).toBeEnabled();
+ });
+
it('ends a failed recording without uploading', async () => {
window.localStorage.setItem('portos.musicDesigner.strudelCode', JSON.stringify({ trackId: 'track-1', code: CODE }));
await mountReady();