fix: merged-PR push check + worklog revamp#12
Merged
George-iam merged 2 commits intomainfrom Apr 6, 2026
Merged
Conversation
The checkGit merged-PR check used require("node:child_process") inside
the function body, but safety.ts is ESM. require is undefined in ESM,
causing ReferenceError caught by catch {} - the check silently passed.
Two fixes:
1. Replaced require() with top-level ESM imports (execSync, existsSync,
readdirSync, dirname)
2. Parse branch name from the push command itself (git push origin <branch>)
instead of only relying on git branch --show-current which fails
when CWD is a workspace root (not a git repo)
Replaced low-value events with actionable ones: - safety_block: logged in pre-tool-use when a tool call is denied (audit trail) - audit_complete: logged with cost, memories/decisions/safety counts - decision_saved/superseded: logged when decisions are created or replaced - session_end: trimmed to filesCount instead of full filesChanged array Removed dead event types: agent_turn, check_result. New CLI command: axme-code stats [path] Shows total sessions, audit cost, safety blocks, recent errors. New worklogStats() function for programmatic access.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two changes:
1. Fix: merged-PR push check was silently failing (ESM require bug)
checkGithad a merged-PR check that usedrequire("node:child_process")inside the function body. Since safety.ts is ESM,requireis undefined - thecatch {}silently swallowed the ReferenceError and the check never ran.Additionally, the check relied on
git branch --show-currentwhich fails when CWD is a workspace root (not a git repo).Fixes:
require()with top-level ESM importsgit push origin <branch>) as primary sourcegit branch --show-currentwith workspace subdirectory scanVerified live:
git push origin feat/narrative-worklog-20260406(has merged PR#10) now correctly returns BLOCKED.2. Worklog.jsonl revamp - actionable events
Replaced low-value events with actionable ones:
safety_block: logged in pre-tool-use when a tool call is deniedaudit_complete: logged with cost and extraction countsdecision_saved/decision_superseded: logged when decisions are created or replacedsession_end: trimmed tofilesCountinstead of fullfilesChangedarray dumpNew CLI:
axme-code stats [path]- sessions, audit cost, safety blocks, errors.Test plan
axme-code statsworks on real workspace