-
-
Notifications
You must be signed in to change notification settings - Fork 282
feat: add Codex-style tool mode #26
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
+2,001
−27
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
8a8fea9
feat(config): add codex tool mode
Waishnav 908c9a0
feat(tools): add workspace-confined patch engine
Waishnav a0e6caa
feat(tools): expose apply_patch in codex mode
Waishnav 60c43dc
feat(exec): add resumable process session manager
Waishnav a4aa58a
feat(exec): expose exec_command and write_stdin
Waishnav e3938ca
feat(exec): support optional PTY sessions
Waishnav 4fc552d
fix(exec): terminate spawned process groups
Waishnav 6d54923
docs: document codex mode QA and rollout
Waishnav e70e9bc
fix(config): keep codex tool names stable
Waishnav b9c0933
feat(ui): add codex tool card payloads
Waishnav 0164595
feat(ui): render codex tool cards
Waishnav ee1dd50
fix(exec): wait for interrupted process exit
Waishnav d6bff09
fix(exec): wait after process interactions
Waishnav ab72d84
refactor(exec): isolate platform shell selection
Waishnav 4d5a37c
fix(exec): terminate process trees on Windows
Waishnav d02ac26
fix(patch): replace existing files on Windows
Waishnav fa62642
test(tools): account for cross-platform semantics
Waishnav 557d813
fix(exec): quote Windows commands consistently
Waishnav fbd45d1
fix(deps): use portable node-pty prebuilds
Waishnav 7eaf319
test(exec): remove timing-only output assertion
Waishnav fb1a8d9
test(exec): decouple interrupt from output timing
Waishnav 4a672e9
fix(exec): delegate pipe shell quoting to Node
Waishnav 75c2ff6
fix(exec): pass raw commands to Windows PTYs
Waishnav e3c59e9
test(exec): quote Windows executable paths natively
Waishnav f900ade
fix(exec): preserve Windows PTY command lines
Waishnav 5bd5af7
test(exec): clean up PTYs after assertions
Waishnav db8f995
test(exec): avoid PTY line discipline assumptions
Waishnav afdd4f6
test(exec): use native Windows PTY smoke command
Waishnav 4620f86
fix(exec): pass raw Windows PTY commands
Waishnav 402e94c
fix(deps): update Windows PTY handle fixes
Waishnav e49cb56
fix(exec): run Windows PTYs through temp scripts
Waishnav 814e1d4
fix(exec): guard Windows PTY listener setup
Waishnav c1caac5
fix(deps): repair stable node-pty on macOS
Waishnav 3109b22
fix(exec): delay Windows PTY command startup
Waishnav 3988be8
fix(exec): omit PTY signals on Windows
Waishnav 4f1feee
test(exec): allow hosted Windows PTY startup
Waishnav 64319c6
fix(exec): exit Windows PTY scripts explicitly
Waishnav 14ed5f2
fix(deps): combine PTY platform repairs
Waishnav 58f014b
fix(exec): use native Windows PTY command lines
Waishnav be986c5
fix(exec): start Windows PTYs after listeners
Waishnav e7cd9fe
fix(exec): fall back from Windows native PTYs
Waishnav 3fd16f1
fix(deps): retain stable Unix PTY support
Waishnav 17fa037
fix(deps): normalize optional pty lock entry
Waishnav 7dfe985
feat: preserve head and tail process output
Waishnav 474aeb8
feat: normalize codex command sessions
Waishnav 7510c54
feat: use numeric process session ids
Waishnav b43d85f
feat: align apply patch semantics with codex
Waishnav 960fd78
docs: clarify codex patch semantics
Waishnav 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Codex Tool Mode Manual QA | ||
|
|
||
| Run these checks against a disposable Git repository inside an allowed DevSpace | ||
| root. Keep the DevSpace server logs visible during the test. | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Build the current branch with `npm ci && npm run build`. | ||
| 2. Start DevSpace with `DEVSPACE_TOOL_MODE=codex devspace serve`. | ||
| 3. Connect or refresh the DevSpace connector in ChatGPT. | ||
| 4. Open the disposable repository with `open_workspace`. | ||
| 5. Confirm the core tools are `open_workspace`, `read`, `apply_patch`, | ||
| `exec_command`, and `write_stdin`. | ||
| 6. Confirm `write`, `edit`, `bash`, `grep`, `glob`, and `ls` are absent. | ||
| 7. If `DEVSPACE_WIDGETS=changes`, also expect `show_changes`. | ||
|
|
||
| ## Apply Patch | ||
|
|
||
| 1. Add a text file containing multiple lines and a blank line. | ||
| 2. Update two separate regions of that file in one patch. | ||
| 3. Create a nested file, rename it, and then delete it. | ||
| 4. Patch an existing CRLF file and verify it remains CRLF. | ||
| 5. Verify executable permissions survive an update and a move. | ||
| 6. Try to add `../outside.txt`; confirm the tool rejects the path. | ||
| 7. Patch through a symlink targeting an external directory; confirm rejection. | ||
| 8. Submit a hunk whose context is absent; confirm no file from that patch changes. | ||
| 9. With changes widgets enabled, inspect the aggregate diff. | ||
|
|
||
| ## Foreground Commands | ||
|
|
||
| 1. Run `pwd` and confirm it reports the opened workspace. | ||
| 2. Run a command in a relative `workingDirectory` and confirm the directory. | ||
| 3. Write to stdout and stderr; confirm both appear. | ||
| 4. Exit nonzero; confirm `running=false` and the exit code. | ||
| 5. Use a small output budget on a noisy command; confirm truncation is reported. | ||
|
|
||
| ## Background Sessions | ||
|
|
||
| 1. Start a delayed command with a short yield time. | ||
| 2. Confirm `exec_command` returns `running=true` and a `sessionId`. | ||
| 3. Poll with empty `chars`; confirm output is not duplicated. | ||
| 4. Poll until completion; confirm the final exit code and no `sessionId`. | ||
| 5. Poll the completed session again; confirm it is unknown. | ||
| 6. Reconnect MCP without restarting DevSpace and confirm polling still works. | ||
| 7. Restart DevSpace and confirm old process session IDs are invalid. | ||
|
|
||
| ## Input, Interrupt, And PTY | ||
|
|
||
| 1. Start a program that reads stdin without a PTY and send it a line. | ||
| 2. Start a long-running process and send `\u0003`; confirm it stops. | ||
| 3. Start an interactive program with `tty=true`; confirm it detects a TTY. | ||
| 4. Resize a PTY from 80x24 to 120x30 and verify the observed dimensions. | ||
| 5. Omit optional dependencies; normal commands must work and `tty=true` must | ||
| return the explicit `node-pty` error. | ||
|
Waishnav marked this conversation as resolved.
|
||
|
|
||
| ## Cleanup | ||
|
|
||
| 1. Start a non-PTY command that creates a long-running child process. | ||
| 2. Stop DevSpace with SIGINT and verify both shell and child exit. | ||
| 3. Repeat with a PTY command. | ||
| 4. Confirm no process remains after server exit. | ||
| 5. Repeat session cycles and check that memory use does not steadily increase. | ||
|
|
||
| ## Existing Mode Regression | ||
|
|
||
| 1. Start without `DEVSPACE_TOOL_MODE`; confirm `minimal` remains the default. | ||
| 2. Minimal must expose `read`, `write`, `edit`, and `bash`, but not Codex tools | ||
| or dedicated search tools. | ||
| 3. `DEVSPACE_TOOL_MODE=full` must add `grep`, `glob`, and `ls`. | ||
| 4. With no explicit mode, `DEVSPACE_MINIMAL_TOOLS=1` maps to minimal and `0` | ||
| maps to full. | ||
| 5. Set `DEVSPACE_TOOL_MODE=codex` with `DEVSPACE_MINIMAL_TOOLS=0`; confirm the | ||
| explicit Codex mode wins. | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
| import { chmod } from "node:fs/promises"; | ||
| import { dirname, resolve } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| if (process.platform === "darwin") { | ||
| const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); | ||
| for (const architecture of ["arm64", "x64"]) { | ||
| const helper = resolve( | ||
| projectRoot, | ||
| "node_modules", | ||
| "node-pty", | ||
| "prebuilds", | ||
| `darwin-${architecture}`, | ||
| "spawn-helper", | ||
| ); | ||
| try { | ||
| await chmod(helper, 0o755); | ||
| } catch (error) { | ||
| if (error.code !== "ENOENT") throw error; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.