#168 activity_writer: tolerate Codex notify's appended arg (parse_known_args)#169
Merged
Merged
Conversation
…wn_args) Codex invokes its `notify` program with the event JSON appended as a trailing argv. activity_writer.main() used strict parse_args, which rejected it (exit 2 → nothing written), so the documented Codex notify config recorded no state. Switch to parse_known_args so the shim ignores extra args and never breaks the host's notify/hook chain. Add a regression test for the appended-arg case; note it in the guide. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
Review trail (/afk — Claude-driven)
CI green. Leave-open (owner merges). |
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.
Closes #168.
Bug
The documented Codex integration wires
notifytoactivity_writer.py --tool codex --path ... --state idle. Codex invokes itsnotifyprogram with its event JSON appended as a trailing argv, whichmain()'s strictargparse.parse_argsrejected (error: unrecognized arguments: {...}→ exit 2, nothing written). So following the guide, Codex activity was never recorded —dev_activitysaw Codex via process-presence only.Fix
main()now usesparse_known_args— a fire-and-forget hook/notify shim must tolerate extra args and never break the host's chain. Trade-off (a mistyped flag is silently ignored) is acceptable and documented in a comment.Changes
activity_writer.py:parse_args→parse_known_args(+ rationale comment).tests/test_activity.py: regression test —main([... , '{"type":"agent-turn-complete"}'])returns 0 and writes the file.docs/guides/dev-agent-activity.md: note that the writer ignores Codex's appended payload.Tests
uv run --locked pytestgreen;uv lock --check,ruff,ruff format --check,mypyall clean.Review trail (/afk)
Claude implement + TDD. External gates run automatically: Codex 外门 then Kimi 终审. Leave-open (owner merges).