Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ with:
warp_api_key: ${{ secrets.WARP_API_KEY }}
```

## Debug Logging

By default, the action enables Oz debug logging (`--debug`) only when GitHub requests it — for
example, when you
[re-run a job with step debug logging enabled](https://docs.github.com/en/actions/managing-workflow-runs/enabling-debug-logging).
Set the `debug` input to `true` to always enable debug logging, regardless of whether step debug
logging is on:

```yaml
- name: Run Oz with debug logging
uses: warpdotdev/oz-agent-action@v1
with:
prompt: Review the code changes on this branch
debug: true
warp_api_key: ${{ secrets.WARP_API_KEY }}
```

When `debug: true`, Oz logs are emitted on stderr even if the workflow run was not started with step
debug logging. When `debug` is `false` (the default), the existing behavior is preserved: debug
logging activates only when GitHub's step-debug signal is on.

## Helpful Tips

- Inject relevant context from the GitHub event and previous steps into your Oz prompt via
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ inputs:
local runs.'
required: false
default: 'false'
debug:
description:
"Always enable debug logging (`--debug`), independent of GitHub's step debug option."
required: false
default: 'false'
oz_channel:
description: Oz release channel to use
required: true
Expand Down
7 changes: 5 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43566,6 +43566,7 @@ async function runAgent(options = {}) {
}
const cloud = getBooleanInput('cloud');
const computerUse = getBooleanInput('computer_use');
const debug = getBooleanInput('debug');
const args = ['agent', cloud ? 'run-cloud' : 'run'];
const host = getInput('host');
if (host) {
Expand Down Expand Up @@ -43654,8 +43655,10 @@ async function runAgent(options = {}) {
}
}
}
// In debug mode, show Oz logs on stderr.
if (isDebug()) {
// Enable Oz debug logging when the explicit `debug` input is set, or when GitHub
// requests step-debug logging (e.g. re-run with step debug logging enabled).
// In debug mode, Oz logs are shown on stderr.
if (debug || isDebug()) {
args.push('--debug');
}
let stdout = '';
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

44 changes: 30 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function setDefaultInputs(): void {
coreInputs.set('oz_version', 'latest')
coreInputs.set('cloud', 'false')
coreInputs.set('computer_use', 'false')
coreInputs.set('debug', 'false')
coreInputs.set('host', '')
coreInputs.set('environment', '')
}
Expand Down Expand Up @@ -414,6 +415,66 @@ describe('runAgent', () => {
expect(callArgs).not.toContain('--sandboxed')
expect(coreMocks.warning).not.toHaveBeenCalled()
})

it('omits --debug when debug is false and GitHub step-debug is off', async () => {
coreInputs.set('debug', 'false')
coreMocks.isDebug.mockReturnValue(false)
execMocks.getExecOutput.mockResolvedValue({
exitCode: 0,
stdout: 'Run ID: local-run\n',
stderr: ''
})

await index.runAgent({ skipInstall: true })

const callArgs = execMocks.getExecOutput.mock.calls[0][1] as string[]
expect(callArgs).not.toContain('--debug')
})

it('adds --debug when the debug input is true even without GitHub step-debug', async () => {
coreInputs.set('debug', 'true')
coreMocks.isDebug.mockReturnValue(false)
execMocks.getExecOutput.mockResolvedValue({
exitCode: 0,
stdout: 'Run ID: local-run\n',
stderr: ''
})

await index.runAgent({ skipInstall: true })

const callArgs = execMocks.getExecOutput.mock.calls[0][1] as string[]
expect(callArgs).toContain('--debug')
})

it('still adds --debug from GitHub step-debug when the debug input is false', async () => {
coreInputs.set('debug', 'false')
coreMocks.isDebug.mockReturnValue(true)
execMocks.getExecOutput.mockResolvedValue({
exitCode: 0,
stdout: 'Run ID: local-run\n',
stderr: ''
})

await index.runAgent({ skipInstall: true })

const callArgs = execMocks.getExecOutput.mock.calls[0][1] as string[]
expect(callArgs).toContain('--debug')
})

it('adds --debug exactly once when both debug input and GitHub step-debug are on', async () => {
coreInputs.set('debug', 'true')
coreMocks.isDebug.mockReturnValue(true)
execMocks.getExecOutput.mockResolvedValue({
exitCode: 0,
stdout: 'Run ID: local-run\n',
stderr: ''
})

await index.runAgent({ skipInstall: true })

const callArgs = execMocks.getExecOutput.mock.calls[0][1] as string[]
expect(callArgs.filter((arg) => arg === '--debug')).toHaveLength(1)
})
})

describe('reportShutdown', () => {
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export async function runAgent(options: RunAgentOptions = {}): Promise<void> {

const cloud = core.getBooleanInput('cloud')
const computerUse = core.getBooleanInput('computer_use')
const debug = core.getBooleanInput('debug')
const args = ['agent', cloud ? 'run-cloud' : 'run']
const host = core.getInput('host')
if (host) {
Expand Down Expand Up @@ -215,8 +216,10 @@ export async function runAgent(options: RunAgentOptions = {}): Promise<void> {
}
}

// In debug mode, show Oz logs on stderr.
if (core.isDebug()) {
// Enable Oz debug logging when the explicit `debug` input is set, or when GitHub
// requests step-debug logging (e.g. re-run with step debug logging enabled).
// In debug mode, Oz logs are shown on stderr.
if (debug || core.isDebug()) {
args.push('--debug')
}

Expand Down