-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: bug-PR merge train batch 4 (#5824 adaptive thinking display, #5750 Linux updater scope) #5908
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
3fe2e37
fix(anthropic): ask adaptive-thinking models for summarized thinking
lidge-jun b97a392
fix(update): launch the Linux dashboard update worker outside the ser…
lidge-jun 02925c5
docs(adapters): state the adaptive thinking display in every locale
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { spawnSync } from "node:child_process"; | ||
|
|
||
| /** | ||
| * How to launch the dashboard update worker on POSIX. | ||
| * | ||
| * A worker spawned from the systemd user service stays in that service's cgroup even when | ||
| * detached, and the generated unit keeps the default `KillMode=control-group`. The updater then | ||
| * stops `opencodex-proxy.service` and systemd kills the worker with it, leaving the proxy offline | ||
| * on the old package (#5750). `systemd-run --user --scope` moves the worker into its own | ||
| * transient scope first; `--scope` execs the command in place, so the returned PID is still the | ||
| * worker's. Outside a systemd-started process (`INVOCATION_ID` unset), or when `systemd-run` is | ||
| * missing, the plain detached spawn is unchanged. | ||
| */ | ||
| export const SYSTEMD_SCOPE_ARGS = ["--user", "--scope", "--quiet", "--collect", "--"] as const; | ||
|
|
||
| export interface WorkerLaunchContext { | ||
| platform?: NodeJS.Platform; | ||
| env?: NodeJS.ProcessEnv; | ||
| hasSystemdRun?: () => boolean; | ||
| } | ||
|
|
||
| let systemdRunProbe: boolean | undefined; | ||
|
|
||
| function probeSystemdRun(): boolean { | ||
| if (systemdRunProbe === undefined) { | ||
| // Run a real no-op scope rather than `--version`: a present binary without a reachable user | ||
| // bus would otherwise pass the probe and then fail to start the worker at all. | ||
| const probe = spawnSync("systemd-run", [...SYSTEMD_SCOPE_ARGS, "true"], { stdio: "ignore", timeout: 5_000 }); | ||
| systemdRunProbe = !probe.error && probe.status === 0; | ||
| } | ||
| return systemdRunProbe; | ||
| } | ||
|
|
||
| export function guiUpdateWorkerCommand( | ||
| execPath: string, | ||
| args: readonly string[], | ||
| context: WorkerLaunchContext = {}, | ||
| ): { command: string; argv: string[] } { | ||
| const platform = context.platform ?? process.platform; | ||
| const env = context.env ?? process.env; | ||
| const underSystemd = platform === "linux" && Boolean(env.INVOCATION_ID); | ||
| if (underSystemd && (context.hasSystemdRun ?? probeSystemdRun)()) { | ||
| return { command: "systemd-run", argv: [...SYSTEMD_SCOPE_ARGS, execPath, ...args] }; | ||
| } | ||
| return { command: execPath, argv: [...args] }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { describe, expect, test } from "bun:test"; | ||
| import { guiUpdateWorkerCommand, SYSTEMD_SCOPE_ARGS } from "../../src/update/worker-launch"; | ||
|
|
||
| // #5750: a worker spawned by the systemd user service must leave the service cgroup before the | ||
| // updater stops that service, or systemd kills it along with the proxy. | ||
| describe("dashboard update worker launch", () => { | ||
| const args = ["/opt/ocx/src/cli/index.ts", "__gui-update-worker", "job-1", "stable", "restart"]; | ||
|
|
||
| test("a systemd-started Linux proxy launches the worker in its own scope", () => { | ||
| const launch = guiUpdateWorkerCommand("/usr/bin/bun", args, { | ||
| platform: "linux", env: { INVOCATION_ID: "abc" }, hasSystemdRun: () => true, | ||
| }); | ||
| expect(launch).toEqual({ command: "systemd-run", argv: [...SYSTEMD_SCOPE_ARGS, "/usr/bin/bun", ...args] }); | ||
| }); | ||
|
|
||
| test("without systemd-run, outside systemd, or off Linux the spawn is unchanged", () => { | ||
| const plain = { command: "/usr/bin/bun", argv: args }; | ||
| expect(guiUpdateWorkerCommand("/usr/bin/bun", args, { | ||
| platform: "linux", env: { INVOCATION_ID: "abc" }, hasSystemdRun: () => false, | ||
| })).toEqual(plain); | ||
| let probed = false; | ||
| expect(guiUpdateWorkerCommand("/usr/bin/bun", args, { | ||
| platform: "linux", env: {}, hasSystemdRun: () => { probed = true; return true; }, | ||
| })).toEqual(plain); | ||
| expect(probed).toBe(false); | ||
| expect(guiUpdateWorkerCommand("/usr/bin/bun", args, { | ||
| platform: "darwin", env: { INVOCATION_ID: "abc" }, hasSystemdRun: () => true, | ||
| })).toEqual(plain); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 256
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 25243
Synchronize the translated Anthropic adapter pages.
The Japanese, Korean, Russian, and Simplified Chinese pages document extended thinking but omit the adaptive-thinking display behavior described in the English page. Add the corresponding guidance for
thinking.display: "summarized"and thereasoning.summary: "none"exception to each translated page.🤖 Prompt for AI Agents
Source: Path instructions