Skip to content

Conversation

@larslockefeer
Copy link

Hi there, first of all thanks for making this GitHub action wrapper for Codex available 🙏

For an integration at work, I was looking into options for retrieving the total number of tokens used by the codex execution. After coming up empty while looking into the command line options of the codex CLI, I noticed the output log already captures the total amount of tokens used.

Therefore, I figured the easiest way to achieve what I want is to capture the output to a logfile besides sending it to stdout and then parse the tokens used when the run has finished.

I'm filing this PR mostly to see if there is interest in this approach, I haven't tested my changes yet. Happy to contribute further if this is going into a desirable direction at all. Apologies if this is a waste of your time 😬

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@larslockefeer
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 1, 2025
Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right place to fix this. If this is important, then there should be an optional flag to codex exec that takes a path to a file where the token info should be recorded and we should write it as JSON or some format that can be read programmatically.

Comment on lines +237 to +244
outputLog = await checkOutput([
"sudo",
"-u",
runAsUser,
"cat",
logFile,
]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should sudo be necessary? Also, this will not work on Windows.

@larslockefeer
Copy link
Author

Fair point, this was the simplest workaround I could see but I agree that it may be too pragmatic (and in the current implementation also not robust enough yet). For now I won't have the ability to look into adding this capability to codex itself but maybe I'll try later, thanks 🙏

I'll close this PR because it is irrelevant then.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants