-
Notifications
You must be signed in to change notification settings - Fork 975
fix(service): report the wait that was actually spent, not the budget (rebase of #3138) #3186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -740,14 +740,22 @@ export async function reportServiceServing( | |
| deps: Parameters<typeof confirmServiceServing>[0] = {}, | ||
| ): Promise<void> { | ||
| const healthBudgetMs = deps.timeoutMs ?? serviceInstallHealthMs(); | ||
| // Timed here rather than reported from the budget. confirmServiceServing knocks once | ||
| // more after a grace sleep whenever it waited at all, so the real wait is the budget | ||
| // plus that grace — and printing the budget states a number the run did not spend. | ||
| // What the reader is deciding is whether the service was still coming up, which is a | ||
| // judgement about elapsed time (#3009). | ||
| const now = deps.now ?? Date.now; | ||
| const startedAt = now(); | ||
| const serving = await confirmServiceServing({ ...deps, timeoutMs: healthBudgetMs }); | ||
| const waitedMs = Math.max(0, now() - startedAt); | ||
| if (serving.ok) { | ||
| console.log(`✅ opencodex service ${verb} and serving on port ${serving.port}.`); | ||
| return; | ||
| } | ||
| console.error( | ||
| `⚠️ Service ${verb}, but no proxy answered on port ${serving.port} within ` | ||
| + `${Math.trunc(healthBudgetMs / 1000)}s.\n` | ||
| `⚠️ Service ${verb}, but no proxy answered on port ${serving.port} after ` | ||
| + `${Math.round(waitedMs / 1000)}s.\n` | ||
|
Comment on lines
756
to
+758
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A normal non-Windows failure now renders AGENTS.md reference: AGENTS.md:L343-L344 Useful? React with 👍 / 👎. |
||
| + ` The manager registered the job; that is not the same as serving.\n` | ||
| + ` Log: ${serviceLogPath()}\n` | ||
| + ` Meanwhile: ocx start (serves in the foreground)`, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the system clock is corrected while the 20–45s probe runs, such as after resume or initial time synchronization,
Date.now()can jump. The warning then reports the clock correction rather than elapsed time—a forward jump can produce “after 3600s” almost immediately, while a backward jump can hide an hour actually spent—defeating the purpose of this fix. Measure the displayed duration with a monotonic clock such asperformance.now(), while retaining an injectable clock for tests.Useful? React with 👍 / 👎.