Repository navigation
Conversation
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.
Description of the Change
Problem
Model-generated subtask titles or descriptions can contain NUL bytes (
\x00), which PostgreSQL does not accept in text fields. Saving such a subtask fails with:Subtask generation and plan replacement write rows individually without a transaction. During refinement, existing planned subtasks are deleted before the replacement is fully saved. If a later insert fails, the task can be left waiting with an incomplete plan and missing report steps.
Solution
database.SaveSubtaskPlanoperation for subtask generation, refinement, and assistant plan patches.SanitizeUTF8helper to titles and descriptions before insertion. It removes NUL bytes, replaces malformed UTF-8, and preserves valid text.Related issue: None.
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
Run from
backend/:Run database and controller tests:
go test ./pkg/database ./pkg/controllerRun provider tests:
go test ./pkg/providersTo run the remaining tests excluding the two known failing groups:
Run static checks and build the affected packages:
Verify formatting and whitespace with
gofmtandgit diff --check.Test Results
go vet, package builds, andgit diff --checkpassed.Security Considerations
This change does not alter authentication, authorization, permissions, or credential handling. Text normalization prevents unsupported characters from reaching PostgreSQL; it does not replace parameterized queries.
Adds
github.com/DATA-DOG/go-sqlmock v1.5.2for database regression tests only. It is not used by production code.Performance Impact
Plan persistence adds one transaction per generation or replacement operation. Text normalization is linear in the length of each title and description.
LLM calls remain outside the transaction. No performance benchmark was performed.
Documentation Updates
backend/docs/database.mdto describe text normalization, atomic plan persistence, and cache invalidation after commit.Deployment Notes
Rebuild and deploy the backend to apply the fix.
No database migrations, new environment variables, API changes, or configuration changes are required.
This change prevents future partial plan writes. It does not automatically restore subtasks lost during earlier failed executions; affected tasks may require explicit replanning.
Checklist
Code Quality
go fmtandgo vet(for Go code)pnpm run lint(for TypeScript/JavaScript code)Security
Compatibility
Documentation
Additional Notes
No frontend, REST API, GraphQL schema, or generated sqlc files were changed.
Custom implementations of
database.Querierused for plan persistence must also provide the transactionalSaveSubtaskPlanoperation. Unsupported implementations fail explicitly rather than falling back to non-transactional writes.The unchecked test-suite item reflects the two baseline failures documented above. JavaScript linting, breaking-change documentation, and API-change documentation are not applicable to this PR.