mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
fix(test): retry failed voice cleanup and always attempt hangup
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ec9c476f55
commit
94f83aadb7
5 files changed
+40
-13
No files matched your search
@@ -78,4 +78,6 @@ All 83 real-database voice persistence/authority regressions passed (`/tmp/speko
|
||||
|
||||
Latest UI review repair: voice start, inspection, and hangup requests now have ten-second deadlines. Production-client/controller regressions prove that a lost start retains its idempotency key across reload, and an uncertain hangup retains the exact call for cleanup retry without reopening media. All 36 focused API/lifecycle/recovery tests, UI typecheck, and token gates passed. No UI component markup or lockfiles changed.
|
||||
|
||||
Runtime follow-up review repairs preserve pending questions across reconnect, allow canonical authenticated task-page answers to continue the original voice request, and retain accepted guest tasks in their saved sandbox when future-call settings change. Current permission, credential, isolation, sandbox availability, and company ownership checks remain enforced. All 85 voice persistence tests and server typecheck passed. Native/legacy signed-tool and task-page continuation regressions are being verified separately.
|
||||
Runtime follow-up review repairs preserve pending questions across reconnect, allow canonical authenticated task-page answers to continue the original voice request, and retain accepted guest tasks in their saved sandbox when future-call settings change. Current permission, credential, isolation, sandbox availability, and company ownership checks remain enforced. All 85 voice persistence tests and server typecheck passed. Five focused native/legacy signed-tool and task-page continuation/authority regressions passed; the other 145 cases were intentionally unselected in that focused run.
|
||||
|
||||
Harness review repairs: successful local cleanup operations are tracked individually; failed operations remain retryable and End stays available until local and provider cleanup complete. Six cleanup/redaction tests pass. The live browser harness attempts provider hangup independently of evidence-write failures. README links now point to the included report and runbook instead of absent historical private reports.
|
||||
@@ -241,9 +241,13 @@ try {
|
||||
}).catch(() => null);
|
||||
if (audioMeasurements) await writeFile(resolve(out, 'audio-measurements.json'), JSON.stringify(audioMeasurements), { mode: 0o600 });
|
||||
if (audio) await writeFile(resolve(out, 'received.webm'), Buffer.from(audio), { mode: 0o600 });
|
||||
} catch { event('evidence_failed'); process.exitCode = 1; } finally {
|
||||
// Evidence failures must never bypass hangup of a paid provider session.
|
||||
if (session) {
|
||||
const button = page.getByRole('button', { name: /^(End call|Retry ending call)$/ });
|
||||
if (await button.count()) await button.click().catch(() => {});
|
||||
try {
|
||||
const button = page.getByRole('button', { name: /^(End call|Retry ending call)$/ });
|
||||
if (await button.count()) await button.click();
|
||||
} catch { event('ui_cleanup_unavailable'); }
|
||||
try {
|
||||
const response = await page.request.post(`${origin}/api/companies/${fixture.companyId}/voice-sessions/${session.id}/end`, { headers: { Origin: origin }, data: {} });
|
||||
event('end_requested', { status: response.status() });
|
||||
@@ -255,7 +259,6 @@ try {
|
||||
event('cleanup_verified');
|
||||
} catch { event('cleanup_unconfirmed'); process.exitCode = 1; }
|
||||
}
|
||||
} catch { event('evidence_cleanup_failed'); process.exitCode = 1; } finally {
|
||||
try {
|
||||
await writeFile(resolve(out, 'report.json'), JSON.stringify({ startedAt: new Date(started).toISOString(), events, session, browserNotificationDisabledForIdleProbe: idleProbe, syntheticMicrophone: true, audioReview: 'required independently; script success does not confirm complete spoken playback', resumedIssueId: resumeIssueId, diskScenario, delayedTemplate, expectedWord: templateScenario ? expectedWord : undefined, executionProvider: templateScenario ? 'claude_local' : 'fixture', server: 'real', speko: 'live' }, null, 2), { mode: 0o600 });
|
||||
console.log(JSON.stringify({ evidence: out }));
|
||||
|
||||
@@ -143,7 +143,7 @@ Publish a restricted report without transcripts, audio, keys or caller data:
|
||||
node summarize-run.mjs /absolute/private/run/report.json reports/new-run.json
|
||||
```
|
||||
|
||||
The original polling investigation is in
|
||||
`doc/plans/2026-09-11-speko-hosted-continuation-repro.md`. The newer application
|
||||
notification results are in
|
||||
`doc/plans/2026-09-12-speko-application-notification-proof.md`.
|
||||
See the [current qualification report](../../doc/plans/2026-10-09-speko-pr-qualification.md)
|
||||
and [E2E runbook](../../doc/plans/2026-09-11-speko-voice-e2e-runbook.md) for inspectable
|
||||
results and remaining acceptance gaps. Historical private call reports are not
|
||||
included in this checkout.
|
||||
@@ -1,23 +1,28 @@
|
||||
/** Preserve final evidence and permit retrying an unconfirmed provider hangup. */
|
||||
export function createCleanup({ local, provider, report, failed }) {
|
||||
let localEnded = false, providerEnded = false, reportSaved = false, pending;
|
||||
const localSuccesses = new Set();
|
||||
const attempt = async (operation, action) => {
|
||||
try { await action(); return true; }
|
||||
catch { failed(operation); return false; }
|
||||
};
|
||||
return {
|
||||
get complete() { return providerEnded && reportSaved; },
|
||||
get complete() { return localEnded && providerEnded && reportSaved; },
|
||||
end() {
|
||||
if (pending) return pending;
|
||||
pending = (async () => {
|
||||
let ok = true;
|
||||
try {
|
||||
if (!localEnded) {
|
||||
localEnded = true;
|
||||
ok = await attempt('local.cleanup', () => local(async (operation, action) => {
|
||||
let localOk = true;
|
||||
const completed = await attempt('local.cleanup', () => local(async (operation, action) => {
|
||||
if (localSuccesses.has(operation)) return;
|
||||
const succeeded = await attempt(operation, action);
|
||||
if (!succeeded) ok = false;
|
||||
})) && ok;
|
||||
if (succeeded) localSuccesses.add(operation);
|
||||
else localOk = false;
|
||||
}));
|
||||
localEnded = completed && localOk;
|
||||
ok = localEnded && ok;
|
||||
}
|
||||
if (!providerEnded) providerEnded = await attempt('session.end', provider);
|
||||
ok = providerEnded && ok;
|
||||
|
||||
@@ -49,3 +49,20 @@ test('failed report can be retried without redialing or repeating a confirmed ha
|
||||
assert.equal(ends, 1);
|
||||
assert.equal(reports, 2);
|
||||
});
|
||||
|
||||
|
||||
test('retries failed local operations and keeps End available until all media cleanup succeeds', async () => {
|
||||
let tracks = 0, sdk = 0, ends = 0, reports = 0;
|
||||
const cleanup = createCleanup({
|
||||
local: async attempt => {
|
||||
await attempt('tracks.stop', async () => { tracks++; });
|
||||
await attempt('sdk.end', async () => { if (++sdk === 1) throw new Error('temporary failure'); });
|
||||
},
|
||||
provider: async () => { ends++; }, report: async () => { reports++; }, failed: () => {},
|
||||
});
|
||||
assert.equal(await cleanup.end(), false);
|
||||
assert.equal(cleanup.complete, false);
|
||||
assert.equal(await cleanup.end(), true);
|
||||
assert.equal(cleanup.complete, true);
|
||||
assert.deepEqual({tracks, sdk, ends, reports}, {tracks: 1, sdk: 2, ends: 1, reports: 2});
|
||||
});
|
||||
Reference in new issue
Block a user