From 7043e08353e2fb3a229f068e322d528c57d583f8 Mon Sep 17 00:00:00 2001 From: claude code agent 227 Date: Mon, 29 Jun 2026 15:38:55 +0300 Subject: [PATCH] docs(ai-chat): align requestStop JSDoc with abort-first order (F17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The method docstring still described the old write-then-abort order and presented the stop_requested_at stamp as guaranteed. Reword to: abort first (the only thing that actually stops the run), then best-effort stamp that may be skipped on a DB error or lost to the finalize race — acceptable since the row still settles as 'aborted'. Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/server/src/core/ai-chat/ai-chat-run.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/server/src/core/ai-chat/ai-chat-run.service.ts b/apps/server/src/core/ai-chat/ai-chat-run.service.ts index d8ddbd65..5d11b202 100644 --- a/apps/server/src/core/ai-chat/ai-chat-run.service.ts +++ b/apps/server/src/core/ai-chat/ai-chat-run.service.ts @@ -378,8 +378,11 @@ export class AiChatRunService implements OnModuleInit { /** * Request an EXPLICIT stop of a run (the user pressed Stop). This is the ONLY * thing that aborts a run — distinct from a browser disconnect, which leaves - * the run going. Records `stop_requested_at` on the row (only while active) and - * aborts the in-process controller if this replica owns the run. Returns true + * the run going. Aborts the in-process controller FIRST (the only thing that + * actually stops the run, if this replica owns it), then makes a best-effort + * attempt to stamp `stop_requested_at` — that audit write stamps only while the + * row is active and may be skipped on a DB error or lost to the finalize race, + * which is acceptable since the row still settles as 'aborted'. Returns true * when a stop took effect (row marked and/or controller aborted), false when * there was nothing active to stop. */