Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
values now always override the runtime configuration, which overrides the
process environment, whatever case each one uses. Unix hosts keep
case-sensitive names.
- Use the shell exit status in GitHub Action outputs when a signal stops the CLI.
- Count Codex input tokens once. Codex reports cached tokens as part of
`input_tokens`, and skill-up added them again, so a run with a high cache
hit rate showed close to twice its real input. Codex `input_tokens` in
Expand Down
3 changes: 3 additions & 0 deletions action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ def main():
flush=True)
result = subprocess.run(argv, env=run_env, cwd=target_dir)
exit_code = result.returncode
if exit_code < 0:
# Python represents signal termination as -N; shells report 128 + N.
exit_code = 128 - exit_code
try:
with open(os.path.join(output_dir, "skill-up-exit-code"), "w") as f:
f.write(str(exit_code))
Expand Down
20 changes: 20 additions & 0 deletions action/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@


class ActionConfigurationContractTest(unittest.TestCase):
def test_main_reports_shell_status_after_signal(self):
inputs = ACTION.parse_inputs([])
with tempfile.TemporaryDirectory() as workspace:
output = pathlib.Path(workspace) / "outputs"
with (
mock.patch.object(ACTION, "parse_inputs", return_value=inputs),
mock.patch.object(ACTION.shutil, "which", return_value="/bin/skill-up"),
mock.patch.object(ACTION, "_run"),
mock.patch.object(ACTION, "get_skill_up_version", return_value=None),
mock.patch.object(ACTION, "command_supports_explicit_provider", return_value=False),
mock.patch.object(ACTION.subprocess, "run", return_value=SimpleNamespace(returncode=-15)),
mock.patch.dict(ACTION.os.environ, {"GITHUB_WORKSPACE": workspace, "GITHUB_OUTPUT": str(output)}, clear=True),
self.assertRaises(SystemExit) as exit_context,
):
ACTION.main()
self.assertEqual(exit_context.exception.code, 143)
self.assertIn("exit-code=143", output.read_text().splitlines())
marker = pathlib.Path(workspace) / "skill-up-workspace" / "skill-up-exit-code"
self.assertEqual(marker.read_text(), "143")

def test_main_composes_opencode_argv_and_environment(self):
inputs = SimpleNamespace(
engine="opencode",
Expand Down
Loading