-
Notifications
You must be signed in to change notification settings - Fork 1k
[Night Shift] Add sendBrokerShutdown timeout and --context flag #293
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
Open
Pgarciapg
wants to merge
5
commits into
openai:main
Choose a base branch
from
Pgarciapg:exec-assistant/2026-05-04
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ae68189
[night-shift] test: add unit tests for args parsing and prompt interp…
Pgarciapg 83e8138
[night-shift] test: add edge case tests for codex rescue/delegation flow
Pgarciapg b1913ae
[night-shift] docs: list internal skills shipped with the plugin in R…
Pgarciapg c5d2b35
[night-shift] fix: add timeout to sendBrokerShutdown function
Pgarciapg 8390500
[night-shift] feat: add --context flag to /codex command
Pgarciapg 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import test from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
|
|
||
| import { parseArgs, splitRawArgumentString } from "../plugins/codex/scripts/lib/args.mjs"; | ||
|
|
||
| // --- parseArgs --- | ||
|
|
||
| test("parseArgs: boolean flag --flag=true sets true, --flag=false sets false", () => { | ||
| const configTrue = parseArgs(["--verbose=true"], { booleanOptions: ["verbose"] }); | ||
| assert.equal(configTrue.options.verbose, true); | ||
|
|
||
| const configFalse = parseArgs(["--verbose=false"], { booleanOptions: ["verbose"] }); | ||
| assert.equal(configFalse.options.verbose, false); | ||
| }); | ||
|
|
||
| test("parseArgs: value option --output consumes next token", () => { | ||
| const { options } = parseArgs(["--output", "/tmp/out.txt"], { valueOptions: ["output"] }); | ||
| assert.equal(options.output, "/tmp/out.txt"); | ||
| }); | ||
|
|
||
| test("parseArgs: inline value --output=path uses inline value", () => { | ||
| const { options } = parseArgs(["--output=/tmp/out.txt"], { valueOptions: ["output"] }); | ||
| assert.equal(options.output, "/tmp/out.txt"); | ||
| }); | ||
|
|
||
| test("parseArgs: short alias -o resolved via aliasMap", () => { | ||
| const { options } = parseArgs(["-o", "/tmp/out.txt"], { | ||
| valueOptions: ["output"], | ||
| aliasMap: { o: "output" }, | ||
| }); | ||
| assert.equal(options.output, "/tmp/out.txt"); | ||
| }); | ||
|
|
||
| test("parseArgs: positionals after -- land in positionals array", () => { | ||
| const { options, positionals } = parseArgs( | ||
| ["--verbose", "--", "--not-a-flag", "file.txt"], | ||
| { booleanOptions: ["verbose"] } | ||
| ); | ||
| assert.equal(options.verbose, true); | ||
| assert.deepEqual(positionals, ["--not-a-flag", "file.txt"]); | ||
| }); | ||
|
|
||
| test("parseArgs: missing value for value option throws Error", () => { | ||
| assert.throws( | ||
| () => parseArgs(["--output"], { valueOptions: ["output"] }), | ||
| { message: "Missing value for --output" } | ||
| ); | ||
| }); | ||
|
|
||
| // --- splitRawArgumentString --- | ||
|
|
||
| test("splitRawArgumentString: space-separated tokens", () => { | ||
| assert.deepEqual(splitRawArgumentString("foo bar baz"), ["foo", "bar", "baz"]); | ||
| }); | ||
|
|
||
| test("splitRawArgumentString: single-quoted string with spaces becomes one token", () => { | ||
| assert.deepEqual(splitRawArgumentString("hello 'foo bar' world"), ["hello", "foo bar", "world"]); | ||
| }); | ||
|
|
||
| test("splitRawArgumentString: double-quoted string with spaces becomes one token", () => { | ||
| assert.deepEqual(splitRawArgumentString('hello "foo bar" world'), ["hello", "foo bar", "world"]); | ||
| }); | ||
|
|
||
| test("splitRawArgumentString: backslash escape preserves next char", () => { | ||
| assert.deepEqual(splitRawArgumentString("foo\\ bar baz"), ["foo bar", "baz"]); | ||
| }); | ||
|
|
||
| test("splitRawArgumentString: trailing backslash appended literally", () => { | ||
| assert.deepEqual(splitRawArgumentString("foo\\"), ["foo\\"]); | ||
| }); |
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,25 @@ | ||
| import test from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
|
|
||
| import { interpolateTemplate } from "../plugins/codex/scripts/lib/prompts.mjs"; | ||
|
|
||
| test("interpolateTemplate: replaces {{KEY}} with provided variable", () => { | ||
| assert.equal(interpolateTemplate("Hello {{NAME}}", { NAME: "World" }), "Hello World"); | ||
| }); | ||
|
|
||
| test("interpolateTemplate: replaces multiple different keys in one pass", () => { | ||
| const result = interpolateTemplate("{{GREETING}}, {{NAME}}!", { GREETING: "Hi", NAME: "Alice" }); | ||
| assert.equal(result, "Hi, Alice!"); | ||
| }); | ||
|
|
||
| test("interpolateTemplate: unknown key is replaced with empty string", () => { | ||
| assert.equal(interpolateTemplate("Hello {{MISSING}}", {}), "Hello "); | ||
| }); | ||
|
|
||
| test("interpolateTemplate: template with no placeholders is returned unchanged", () => { | ||
| assert.equal(interpolateTemplate("no placeholders here", { KEY: "val" }), "no placeholders here"); | ||
| }); | ||
|
|
||
| test("interpolateTemplate: key appearing twice is replaced both times", () => { | ||
| assert.equal(interpolateTemplate("{{X}} and {{X}}", { X: "ok" }), "ok and ok"); | ||
| }); |
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.
--contextis silently dropped fortask --resume/--resume-lastcalls that omit a new prompt. InexecuteTaskRun,fullPromptis only built whenrequest.promptis truthy, so resume runs with onlydefaultPromptnever include the context text. This breaks the documented behavior of passing extra context and affects follow-up rescue flows where users resume a thread and provide constraints via--contextonly.Useful? React with 👍 / 👎.