fix: make preview startup and task saves resilient - #85
Merged
nquyencubas523-cloud merged 3 commits intoAug 4, 2026
Conversation
nquyencubas523-cloud
marked this pull request as ready for review
August 4, 2026 02:42
nquyencubas523-cloud
deleted the
codex/fix-save-or-update-atomic-20260803
branch
August 4, 2026 02:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SaveOrUpdateTaskoperationRoot cause
Preview startup treated a valid keyframe as invalid based only on encoded packet size. The encoder was reopened repeatedly, so channel 1 algorithm overlay preview could fail until the device was restarted.
Task saving performed parameter, area, and strategy updates before
SwitchTask(true)checked the resource score. When that final check returnedResourceLimit, the API reported failure after task state had already been persisted, with no transaction or compensation path. Batch apply used the same sequence.Impact
Valid preview startup frames are now published normally. A failed task save is rejected before mutation when its schedule or start-resource admission is invalid, so callers no longer receive an error after partial state has been applied. Existing enabled tasks can still update parameters while the device is busy because no new start transition is required.
Validation
[save-or-update]: 2 cases, 72 assertions[video-task-handler]: 34 cases, 96 assertions200regression test returnsResourceLimitwithout creating or changing a tasktaskList.json,param.json, andarea.jsonbyte-identical192.168.100.1The Sophon CI hardware-test job is still queued on the self-hosted runner; the same generated test binary has already passed the targeted suites directly on the target device.