fix(ax): make JSON state writes atomic
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
37b31e88fc
commit
d737e2c29e
4 changed files with 5 additions and 3 deletions
|
|
@ -423,9 +423,10 @@ Every exported function MUST have a usage-example comment:
|
|||
|
||||
## Changelog
|
||||
|
||||
- 2026-03-29: cmd/core-agent no longer rewrites `os.Args` before startup. The binary-owned commands now use named handlers, keeping the entrypoint on Core CLI primitives instead of repo-local argument mutation.
|
||||
- 2026-03-30: plan files and review queue rate-limit state now use `WriteAtomic`, keeping JSON state writes aligned with the AX safe-write convention.
|
||||
- 2026-03-30: transport helpers preserve request and read causes, brain direct API calls surface upstream bodies, and review queue retry parsing no longer uses `MustCompile`.
|
||||
- 2026-03-30: direct Core process calls replaced the `proc.go` wrapper layer; PID helpers now live in `pid.go` and the workspace template documents `c.Process()` directly.
|
||||
- 2026-03-29: cmd/core-agent no longer rewrites `os.Args` before startup. The binary-owned commands now use named handlers, keeping the entrypoint on Core CLI primitives instead of repo-local argument mutation.
|
||||
- 2026-03-26: net/http consolidated to transport.go (ONE file). net/url + io/fs eliminated. RFC-025 updated with 3 new quality gates (net/http, net/url, io/fs). 1:1 test + example test coverage. Array[T].Deduplicate replaces custom helpers.
|
||||
- 2026-03-25: Quality gates pass. Zero disallowed imports (all 10). encoding/json→Core JSON. path/filepath→Core Path. os→Core Env/Fs. io→Core ReadAll/WriteAll. go-process fully Result-native. ServiceRuntime on all subsystems. 22 named Actions + Task pipeline. ChannelNotifier→IPC. Reference docs synced.
|
||||
- 2026-03-25: Initial spec — written with full core/go v0.8.0 domain context.
|
||||
|
|
|
|||
|
|
@ -423,6 +423,7 @@ Every exported function MUST have a usage-example comment:
|
|||
|
||||
## Changelog
|
||||
|
||||
- 2026-03-30: plan files and review queue rate-limit state now use `WriteAtomic`, keeping JSON state writes aligned with the AX safe-write convention.
|
||||
- 2026-03-30: plan create tests now assert the documented `core.ID()` shape and repeated plan creation produces unique IDs, keeping the plan contract aligned with the simplified generator.
|
||||
- 2026-03-30: dispatch completion monitoring now uses a named helper instead of an inline Action closure, keeping the spawned-process finaliser AX-native.
|
||||
- 2026-03-30: lib task bundle and recursive embed traversal now use `JoinPath` for filesystem paths, removing the last string-concatenated path joins in `pkg/lib`.
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ func writePlanResult(dir string, plan *Plan) core.Result {
|
|||
|
||||
path := planPath(dir, plan.ID)
|
||||
|
||||
if r := fs.Write(path, core.JSONMarshalString(plan)); !r.OK {
|
||||
if r := fs.WriteAtomic(path, core.JSONMarshalString(plan)); !r.OK {
|
||||
err, _ := r.Value.(error)
|
||||
if err == nil {
|
||||
return core.Result{Value: core.E("writePlan", "failed to write plan", nil), OK: false}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ func (s *PrepSubsystem) storeReviewOutput(repoDir, repo, reviewer, output string
|
|||
// saveRateLimitState persists rate limit info for cross-run awareness.
|
||||
func (s *PrepSubsystem) saveRateLimitState(info *RateLimitInfo) {
|
||||
path := core.JoinPath(core.Env("DIR_HOME"), ".core", "coderabbit-ratelimit.json")
|
||||
fs.Write(path, core.JSONMarshalString(info))
|
||||
fs.WriteAtomic(path, core.JSONMarshalString(info))
|
||||
}
|
||||
|
||||
// loadRateLimitState reads persisted rate limit info.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue