Make Freeze wait for in-flight Supply run title writes (Feature 17)
The archive_title single-flight in the harness ended before a title job stored its title, so a freeze in that gap ran a second model call and, when it failed, froze the list untitled while the job's title was then rejected. A title job now holds the service's titling lock shared from reading the list to storing its title, and Freeze holds it exclusively from reading the list to freezing it: a freeze waits for in-flight titles to be stored or fail, and no title job calls the model while a freeze runs. Adds controlled tests for both start orders, each paused after archive_title returns and before its title is stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,9 @@ type env struct {
|
||||
model *llm.Fake
|
||||
// beforeTitle, when set, runs as archive_title is asked for a title.
|
||||
beforeTitle func()
|
||||
// afterTitle, when set, runs once archive_title has returned, before
|
||||
// its title is stored.
|
||||
afterTitle func()
|
||||
// beforeModel, when set, runs as the model is sent a request.
|
||||
beforeModel func(llm.Request)
|
||||
// log holds what the service logged.
|
||||
@@ -108,7 +111,11 @@ func newEnv(t *testing.T) *env {
|
||||
if e.beforeTitle != nil {
|
||||
e.beforeTitle()
|
||||
}
|
||||
return skills.TitleArchive(ctx, cfg, scope, in)
|
||||
out, err := skills.TitleArchive(ctx, cfg, scope, in)
|
||||
if e.afterTitle != nil {
|
||||
e.afterTitle()
|
||||
}
|
||||
return out, err
|
||||
}
|
||||
logger := slog.New(slog.NewTextHandler(e.log, nil))
|
||||
e.runner, err = jobs.NewRunner(st, logger, 2)
|
||||
|
||||
Reference in New Issue
Block a user