mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
fix(assistant): a change left waiting past its day no longer holds the next one back
The open changes of a thread are now the ones still inside their decision window. A call older than a day already reads as expired in the thread and can no longer be decided, but it stayed approval_requested until the nightly sweep, so "+ Tour", "+ Day" and "Plan this" answered decide_first with nothing left to decide, and a decision had to name the expired call too. listOpen takes the window's start, and every caller passes the same cutoff.
This commit is contained in:
@@ -145,13 +145,18 @@ export class AssistantToolCallsRepository extends TrekRepository<AssistantToolCa
|
||||
.execute();
|
||||
}
|
||||
|
||||
/** The calls of a thread still waiting for a decision. */
|
||||
async listOpen(threadId: number): Promise<AssistantToolCallRow[]> {
|
||||
/**
|
||||
* The calls of a thread still waiting for a decision, proposed at or after
|
||||
* `notBefore`: an older one has expired, as the thread shows it and as
|
||||
* `claimDecision` refuses it, even before the nightly sweep marks it so.
|
||||
*/
|
||||
async listOpen(threadId: number, notBefore: string): Promise<AssistantToolCallRow[]> {
|
||||
return this.db()
|
||||
.selectFrom('assistant_tool_calls')
|
||||
.select(COLUMNS)
|
||||
.where('thread_id', '=', threadId)
|
||||
.where('state', '=', 'approval_requested')
|
||||
.where('created_at', '>=', notBefore)
|
||||
.orderBy('created_at')
|
||||
.orderBy('id')
|
||||
.execute();
|
||||
|
||||
Reference in New Issue
Block a user