fix(state): avoid goal progress accounting deadlock
This commit is contained in:
@@ -159,6 +159,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed paused goals silently un-freezing their sidebar timer: usage keeps
|
||||
accruing while paused, and the next goal snapshot used to clear the frozen
|
||||
instant. Paused goals now stay frozen until an explicit resume.
|
||||
- Fixed durable `/goal` progress accounting so usage and continuation updates
|
||||
release the shared SQLite connection before re-reading the updated goal,
|
||||
unblocking resumed goal loops and full workspace release tests.
|
||||
- Fixed a scheduled-automation race where deleting an automation while its
|
||||
run was being enqueued left the already-created task running untracked;
|
||||
the run record is now persisted unconditionally.
|
||||
|
||||
+10
-8
@@ -832,9 +832,9 @@ impl StateStore {
|
||||
time_delta_seconds: i64,
|
||||
now: i64,
|
||||
) -> Result<Option<ThreadGoalRecord>> {
|
||||
let conn = self.conn()?;
|
||||
let changed = conn
|
||||
.execute(
|
||||
let changed = {
|
||||
let conn = self.conn()?;
|
||||
conn.execute(
|
||||
r#"
|
||||
UPDATE thread_goals
|
||||
SET tokens_used = tokens_used + ?2,
|
||||
@@ -844,7 +844,8 @@ impl StateStore {
|
||||
"#,
|
||||
params![thread_id, token_delta, time_delta_seconds, now],
|
||||
)
|
||||
.context("failed to record thread goal usage")?;
|
||||
.context("failed to record thread goal usage")?
|
||||
};
|
||||
if changed == 0 {
|
||||
return Ok(None);
|
||||
}
|
||||
@@ -861,9 +862,9 @@ impl StateStore {
|
||||
thread_id: &str,
|
||||
now: i64,
|
||||
) -> Result<Option<ThreadGoalRecord>> {
|
||||
let conn = self.conn()?;
|
||||
let changed = conn
|
||||
.execute(
|
||||
let changed = {
|
||||
let conn = self.conn()?;
|
||||
conn.execute(
|
||||
r#"
|
||||
UPDATE thread_goals
|
||||
SET continuation_count = continuation_count + 1,
|
||||
@@ -872,7 +873,8 @@ impl StateStore {
|
||||
"#,
|
||||
params![thread_id, now],
|
||||
)
|
||||
.context("failed to record thread goal continuation")?;
|
||||
.context("failed to record thread goal continuation")?
|
||||
};
|
||||
if changed == 0 {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
@@ -159,6 +159,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed paused goals silently un-freezing their sidebar timer: usage keeps
|
||||
accruing while paused, and the next goal snapshot used to clear the frozen
|
||||
instant. Paused goals now stay frozen until an explicit resume.
|
||||
- Fixed durable `/goal` progress accounting so usage and continuation updates
|
||||
release the shared SQLite connection before re-reading the updated goal,
|
||||
unblocking resumed goal loops and full workspace release tests.
|
||||
- Fixed a scheduled-automation race where deleting an automation while its
|
||||
run was being enqueued left the already-created task running untracked;
|
||||
the run record is now persisted unconditionally.
|
||||
|
||||
@@ -39,4 +39,4 @@ Feature: Core command visible surfaces
|
||||
When the user runs the core command "/rlm 1 inspect command extraction"
|
||||
Then the message window should include "Opening persistent RLM context at depth 1"
|
||||
When the user runs the core command "/fleet help"
|
||||
Then the message window should include "/fleet status shows Fleet worker status"
|
||||
Then the message window should include "/fleet status shows live Fleet worker status"
|
||||
|
||||
Reference in New Issue
Block a user