fix: drain task queue on session completion to stop orphan CWMP requests

After OperationalState, the state machine was marked completed but leftover
tasks in the CWMPTaskQueue (queued by ConfigurationEvaluationState callbacks)
were being served to the CPE on subsequent empty POSTs via the continue()
task fallback path, causing spurious GetParameterNames + SetParameterValues
exchanges after the session officially ended.

Fix: call taskQueue.clearPendingTasksForDevice() in completeMachine() so no
tasks bleed into the next session.

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
This commit is contained in:
Kevin L'HereecandContinue committed 2026-06-08 14:20:59 +00:00
1 parent 92a3d992de
commit 08c620ee68
1 file changed
+2
@@ -434,6 +434,8 @@ export class StateMachineManager extends EventEmitter {
const deviceKey = JSON.stringify(machine.deviceId)
this.deviceSessions.delete(deviceKey)
this.sessionMachines.delete(machine.session)
// Drain any leftover tasks so they don't bleed into the next session
this.taskQueue.clearPendingTasksForDevice(machine.deviceId)
}
private failMachine(machine: StateMachineInstance, error: string): void {