What the agent does
The agent reads the extension before it logs anything. In a repository like microsoft/vscode-extension-samples, helloworld-sample/package.json declares engines.vscode at ^1.100.0, an empty activationEvents list, main at ./out/extension.js, one contributed command extension.helloWorld, and scripts compile as tsc -p ./, lint as eslint and watch. src/extension.ts calls console.log once on activation and registers the command, whose handler calls showInformationMessage. helloworld-test-sample is the same extension with @vscode/test-electron, mocha and a test script running out/test/runTest.js, whose src/test/suite/extension.test.ts holds one placeholder assertion. Elsewhere in the repository wasm-component-model/src/extension.ts already creates createOutputChannel('Calculator - Log', { log: true }), which is the API the agent adopts, and the root package.json runs tsx .scripts/validate.ts as validate, which .github/workflows/ci.yml executes after npm ci --workspaces=false.
It creates one channel and threads it through. A log.ts module creates vscode.window.createOutputChannel('Hello World', { log: true }), exports the resulting LogOutputChannel, and activate pushes it onto context.subscriptions so it is disposed with the extension. The console.log on activation becomes log.info with the extension version read from context.extension.packageJSON, the command handler is wrapped so it logs info on entry and error with the thrown error if it fails, and a debug line records what the handler decided. A LogOutputChannel respects the user's log level set through the Developer: Set Log Level... command and writes timestamps and levels itself, so the agent writes no formatting code and no level filter of its own.
The channel needs a way to be found. The agent contributes a second command, extension.showLogs, titled Hello World: Show Logs, whose handler calls log.show() so a user reporting a problem can open the Output view on the right channel without hunting through the dropdown. The README's VS Code API list gains window.createOutputChannel and LogOutputChannel beside the two entries it has, since the samples are read as documentation.
Then it proves it runs inside VS Code. In helloworld-test-sample, the agent adds a test to src/test/suite/extension.test.ts that activates the extension through vscode.extensions.getExtension, executes extension.helloWorld and extension.showLogs with vscode.commands.executeCommand, and asserts both resolve and that the exported log has a logLevel. It runs npm run compile, npm run lint and npm test, which downloads VS Code and runs the suite under Electron with xvfb in the sandbox, and then the root npm run validate, before opening the pull request.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add output channel logging to the helloworld-sample and helloworld-test-sample extensions in this repository. Read the root package.json and .github/workflows/ci.yml, helloworld-sample/package.json, src/extension.ts and README.md, helloworld-test-sample/package.json, src/extension.ts, src/test/runTest.ts and src/test/suite/extension.test.ts, and wasm-component-model/src/extension.ts for the existing createOutputChannel usage first. Create a log.ts that exports a LogOutputChannel from window.createOutputChannel with log: true, push it to context.subscriptions, replace console.log with log.info including the extension version, and wrap the helloWorld handler to log info on entry and error with the caught error. Contribute an extension.showLogs command titled Hello World: Show Logs that calls log.show. Update the README API list. In helloworld-test-sample add a test that activates the extension, executes both commands and asserts the exported channel has a logLevel. Run npm run compile, npm run lint and npm test in both samples and npm run validate at the root, then open a pull request that lists the log calls added and the new command.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request that adds src/log.ts to both samples, edits src/extension.ts, package.json and README.md in each, and extends src/test/suite/extension.test.ts in the test sample. The description lists every log call with its level and where it fires, names the new extension.showLogs command, and notes that the channel honours the user's log level so nothing is filtered in code.
The run's record keeps the tsc, ESLint and Mocha output, including the Electron test run that activated the extension and executed both commands, and the root validate result, so a reviewer can see the integration test passed inside a real VS Code rather than in a mock.
Before merging, a reviewer presses F5 on the sample, runs Hello World: Show Logs, confirms the Output view opens on the Hello World channel with the activation line, and switches the log level to Debug to see the handler's debug line appear.
Run it on every Linear issue labelled extension-logging
In the console, add an automation to the Project with this prompt and a linear trigger on linear.issue.labeled, filtered to the extension-logging label and the tools team. When someone labels an issue such as "users report the command does nothing and we have no logs to ask for", the trigger puts the issue after the prompt and the run names the channel and the commands the issue mentions. Only label changes made by a person in your Rush org fire the trigger, and the automation starts at most max_runs_per_hour runs in an hour.
From your own server, the same body goes to POST /o/{org}/sessions with the repository in resources and the issue URL beside it, read through your Linear connection, and a request_id that is a UUID v5 of the issue id, so a retried call returns the run already started rather than opening a second pull request.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
Extension logging is small but the checks are awkward on a laptop: the integration test needs a downloaded VS Code under a display server, the lint config differs per sample, and a console.log left behind goes to the extension host console where no user will find it. The agent runs @vscode/test-electron under xvfb in its own sandbox and reads the Mocha output, so the claim that both commands execute inside VS Code is observed, not assumed.
The commands and their output stay with the run, so the pull request can point at the Electron test run and at the root validate result, and a reviewer only has to press F5 once to see the channel.
Frequently asked questions
Why a LogOutputChannel instead of a plain OutputChannel?
A LogOutputChannel adds trace, debug, info, warn and error, writes timestamps and levels itself, and follows the level a user sets with Developer: Set Log Level.... A plain channel is a text sink the extension would have to format and filter on its own.
Will this work on the VS Code versions the sample supports?
Yes. The sample's engine range starts at ^1.100.0, and createOutputChannel with { log: true } is available throughout that range; the repository's own wasm samples already use it under the same engine field.
Does the test read what was logged?
No, the API does not expose a channel's contents. The test activates the extension, executes both commands and checks the exported channel exists with a logLevel; the log lines themselves are checked by a reviewer in the Output view, which the pull request describes.
Is console.log removed everywhere?
In the two hello world samples, yes. Other samples in the repository are left as they are; the pull request covers helloworld-sample and helloworld-test-sample only, so a reader can apply the same pattern elsewhere.