-
Notifications
You must be signed in to change notification settings - Fork 38
dev v1.16.0 #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
dev v1.16.0 #51
Changes from 2 commits
29a528f
d3ded24
7282f6e
50e8bbb
f34d45f
87687a2
9888044
4c48209
786ed32
f2a12c6
7b91c47
3c85332
5c123c2
03ac7d0
5a08329
2cba950
3eed7d6
0edbe3f
13a47fb
9b961a8
cfc46d6
4303249
4deb1db
0844648
dbb88bc
9ed3e1a
03e159c
1862329
fe1832d
a8f85e8
611a437
2a0faf6
d122c82
9cf2544
febbc00
17fabf7
2ab5361
4326860
016caca
883e3f5
916fc50
515f90a
95a6b7b
bd506f2
4561bc4
338b4dd
3374acb
a1f3614
c045dff
707097c
79714b7
228d6aa
28813b6
690fb27
027bf0b
3bef3ef
722eb25
e61b570
7c4356c
c4389bb
50ed1bc
fc8a027
5c2f07f
41a02e8
84ebaee
67fa1ae
a9078aa
421ae97
0f025cb
9730744
3adf8ef
38691dd
6a1d931
69587a7
0535919
60e2635
7fb3038
7538f74
9c80698
74671f7
39f09c4
3711e5f
b955a69
fdd8670
850a444
3dcb4dd
0e2c6a0
b10fbf1
cf17140
98d86c0
68bde28
47ee97d
a4fbccd
22e52bd
0ca864d
cd367ee
d09a282
5990827
3a0cd7c
84ffc93
e18d013
e3e38de
911c5da
7e6442b
a49ed09
2269e0a
c6d8d19
1adeca4
695766a
ad9fe53
0e6a5b3
04116b9
3e891f3
179a87c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "description": "Humanize Codex Hooks - Native Stop hooks for RLCR and PR loops", | ||
| "hooks": { | ||
| "Stop": [ | ||
| { | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "{{HUMANIZE_RUNTIME_ROOT}}/hooks/loop-codex-stop-hook.sh", | ||
| "timeout": 7200, | ||
| "statusMessage": "humanize RLCR stop hook" | ||
| }, | ||
| { | ||
| "type": "command", | ||
| "command": "{{HUMANIZE_RUNTIME_ROOT}}/hooks/pr-loop-stop-hook.sh", | ||
| "timeout": 7200, | ||
| "statusMessage": "humanize PR stop hook" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -980,6 +980,9 @@ mkdir -p "$CACHE_DIR" | |
|
|
||
| # portable-timeout.sh already sourced above | ||
|
|
||
| # Disable native hooks for nested Codex reviewer calls to prevent Stop-hook recursion. | ||
| CODEX_DISABLE_HOOKS_ARGS=(--disable codex_hooks) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new flag is unconditionally added to nested Codex invocations, but the hook only validates that Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shinezyy can you take a look |
||
|
|
||
| # Build command arguments for summary review (codex exec) | ||
| CODEX_EXEC_ARGS=("-m" "$CODEX_EXEC_MODEL") | ||
| if [[ -n "$CODEX_EXEC_EFFORT" ]]; then | ||
|
|
@@ -1056,14 +1059,14 @@ Provider: codex | |
| echo "# Review base ($review_base_type): $review_base" | ||
| echo "# Timeout: $CODEX_TIMEOUT seconds" | ||
| echo "" | ||
| echo "codex review --base $review_base ${CODEX_REVIEW_ARGS[*]}" | ||
| echo "codex ${CODEX_DISABLE_HOOKS_ARGS[*]} review --base $review_base ${CODEX_REVIEW_ARGS[*]}" | ||
| } > "$CODEX_REVIEW_CMD_FILE" | ||
|
|
||
| echo "Code review command saved to: $CODEX_REVIEW_CMD_FILE" >&2 | ||
| echo "Running codex review with timeout ${CODEX_TIMEOUT}s in $PROJECT_ROOT (base: $review_base)..." >&2 | ||
|
|
||
| CODEX_REVIEW_EXIT_CODE=0 | ||
| (cd "$PROJECT_ROOT" && run_with_timeout "$CODEX_TIMEOUT" codex review --base "$review_base" "${CODEX_REVIEW_ARGS[@]}") \ | ||
| (cd "$PROJECT_ROOT" && run_with_timeout "$CODEX_TIMEOUT" codex "${CODEX_DISABLE_HOOKS_ARGS[@]}" review --base "$review_base" "${CODEX_REVIEW_ARGS[@]}") \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| > "$CODEX_REVIEW_LOG_FILE" 2>&1 || CODEX_REVIEW_EXIT_CODE=$? | ||
|
|
||
| echo "Code review exit code: $CODEX_REVIEW_EXIT_CODE" >&2 | ||
|
|
@@ -1387,7 +1390,7 @@ CODEX_PROMPT_CONTENT=$(cat "$REVIEW_PROMPT_FILE") | |
| echo "# Working directory: $PROJECT_ROOT" | ||
| echo "# Timeout: $CODEX_TIMEOUT seconds" | ||
| echo "" | ||
| echo "codex exec ${CODEX_EXEC_ARGS[*]} \"<prompt>\"" | ||
| echo "codex ${CODEX_DISABLE_HOOKS_ARGS[*]} exec ${CODEX_EXEC_ARGS[*]} \"<prompt>\"" | ||
| echo "" | ||
| echo "# Prompt content:" | ||
| echo "$CODEX_PROMPT_CONTENT" | ||
|
|
@@ -1397,7 +1400,7 @@ echo "Codex command saved to: $CODEX_CMD_FILE" >&2 | |
| echo "Running summary review with timeout ${CODEX_TIMEOUT}s..." >&2 | ||
|
|
||
| CODEX_EXIT_CODE=0 | ||
| printf '%s' "$CODEX_PROMPT_CONTENT" | run_with_timeout "$CODEX_TIMEOUT" codex exec "${CODEX_EXEC_ARGS[@]}" - \ | ||
| printf '%s' "$CODEX_PROMPT_CONTENT" | run_with_timeout "$CODEX_TIMEOUT" codex "${CODEX_DISABLE_HOOKS_ARGS[@]}" exec "${CODEX_EXEC_ARGS[@]}" - \ | ||
| > "$CODEX_STDOUT_FILE" 2> "$CODEX_STDERR_FILE" || CODEX_EXIT_CODE=$? | ||
|
|
||
| echo "Codex exit code: $CODEX_EXIT_CODE" >&2 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,10 @@ PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null | |
| MERGED_CONFIG="$(load_merged_config "$PLUGIN_ROOT" "$PROJECT_ROOT")" | ||
| BITLESSON_MODEL="$(get_config_value "$MERGED_CONFIG" "bitlesson_model")" | ||
| BITLESSON_MODEL="${BITLESSON_MODEL:-haiku}" | ||
| CODEX_FALLBACK_MODEL="$(get_config_value "$MERGED_CONFIG" "codex_model")" | ||
| CODEX_FALLBACK_MODEL="${CODEX_FALLBACK_MODEL:-$DEFAULT_CODEX_MODEL}" | ||
| PROVIDER_MODE="$(get_config_value "$MERGED_CONFIG" "provider_mode")" | ||
| PROVIDER_MODE="${PROVIDER_MODE:-auto}" | ||
|
|
||
| # Source portable timeout wrapper | ||
| source "$SCRIPT_DIR/portable-timeout.sh" | ||
|
|
@@ -82,12 +86,34 @@ if [[ -z "$BITLESSON_FILE" ]]; then | |
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -f "$BITLESSON_FILE" ]]; then | ||
| echo "Error: BitLesson file not found: $BITLESSON_FILE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| BITLESSON_CONTENT="$(cat "$BITLESSON_FILE")" | ||
| if [[ -z "$(printf '%s' "$BITLESSON_CONTENT" | tr -d ' \t\n\r')" ]]; then | ||
| echo "Error: BitLesson file is empty (whitespace only): $BITLESSON_FILE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! printf '%s\n' "$BITLESSON_CONTENT" | grep -Eq '^[[:space:]]*##[[:space:]]+Lesson:'; then | ||
| printf 'LESSON_IDS: NONE\n' | ||
| printf 'RATIONALE: The BitLesson file has no recorded lessons yet.\n' | ||
| exit 0 | ||
| fi | ||
|
|
||
| # ======================================== | ||
| # Determine Provider from BITLESSON_MODEL | ||
| # ======================================== | ||
|
|
||
| BITLESSON_PROVIDER="$(detect_provider "$BITLESSON_MODEL")" | ||
|
|
||
| if [[ "$PROVIDER_MODE" == "codex-only" ]] && [[ "$BITLESSON_PROVIDER" == "claude" ]]; then | ||
| BITLESSON_MODEL="$CODEX_FALLBACK_MODEL" | ||
| BITLESSON_PROVIDER="codex" | ||
| fi | ||
|
|
||
| # ======================================== | ||
| # Conditional Dependency Check (with fallback) | ||
| # ======================================== | ||
|
|
@@ -99,17 +125,6 @@ if ! check_provider_dependency "$BITLESSON_PROVIDER" 2>/dev/null; then | |
| check_provider_dependency "$BITLESSON_PROVIDER" | ||
| fi | ||
|
|
||
| if [[ ! -f "$BITLESSON_FILE" ]]; then | ||
| echo "Error: BitLesson file not found: $BITLESSON_FILE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| BITLESSON_CONTENT="$(cat "$BITLESSON_FILE")" | ||
| if [[ -z "$(printf '%s' "$BITLESSON_CONTENT" | tr -d ' \t\n\r')" ]]; then | ||
| echo "Error: BitLesson file is empty (whitespace only): $BITLESSON_FILE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # ======================================== | ||
| # Detect Project Root (for -C) | ||
| # ======================================== | ||
|
|
@@ -148,6 +163,7 @@ $BITLESSON_CONTENT | |
| 1. Match only lessons that are directly relevant to the sub-task scope and failure mode. | ||
| 2. Prefer precision over recall: do not include weakly related lessons. | ||
| 3. If nothing is relevant, return \`NONE\`. | ||
| 4. Use only the information in this prompt. Do not use tools, shell commands, browser access, MCP servers, or repository inspection. | ||
|
|
||
| ## Output Format (Stable) | ||
|
|
||
|
|
@@ -164,21 +180,35 @@ EOF | |
|
|
||
| SELECTOR_TIMEOUT=120 | ||
|
|
||
| CODEX_EXIT_CODE=0 | ||
| if [[ "$BITLESSON_PROVIDER" == "codex" ]]; then | ||
| CODEX_EXEC_ARGS=("-m" "$BITLESSON_MODEL" "-c" "model_reasoning_effort=high") | ||
| run_selector() { | ||
| local provider="$1" | ||
| local model="$2" | ||
|
|
||
| if [[ "$provider" == "codex" ]]; then | ||
| local codex_exec_args=( | ||
| "--disable" "codex_hooks" | ||
| "--skip-git-repo-check" | ||
| "--ephemeral" | ||
| "-s" "read-only" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| "-m" "$model" | ||
| "-c" "model_reasoning_effort=low" | ||
| "-C" "$CODEX_PROJECT_ROOT" | ||
| ) | ||
| printf '%s' "$PROMPT" | run_with_timeout "$SELECTOR_TIMEOUT" codex exec "${codex_exec_args[@]}" - | ||
| return $? | ||
| fi | ||
|
|
||
| # Determine automation flag based on environment variable (same as ask-codex.sh) | ||
| CODEX_AUTO_FLAG="--full-auto" | ||
| if [[ "${HUMANIZE_CODEX_BYPASS_SANDBOX:-}" == "true" ]] || [[ "${HUMANIZE_CODEX_BYPASS_SANDBOX:-}" == "1" ]]; then | ||
| CODEX_AUTO_FLAG="--dangerously-bypass-approvals-and-sandbox" | ||
| if [[ "$provider" == "claude" ]]; then | ||
| printf '%s' "$PROMPT" | run_with_timeout "$SELECTOR_TIMEOUT" claude --print --model "$model" - | ||
| return $? | ||
| fi | ||
| CODEX_EXEC_ARGS+=("$CODEX_AUTO_FLAG" "-C" "$CODEX_PROJECT_ROOT") | ||
|
|
||
| RAW_OUTPUT="$(printf '%s' "$PROMPT" | run_with_timeout "$SELECTOR_TIMEOUT" codex exec "${CODEX_EXEC_ARGS[@]}" -)" || CODEX_EXIT_CODE=$? | ||
| elif [[ "$BITLESSON_PROVIDER" == "claude" ]]; then | ||
| RAW_OUTPUT="$(printf '%s' "$PROMPT" | run_with_timeout "$SELECTOR_TIMEOUT" claude --print --model "$BITLESSON_MODEL" -)" || CODEX_EXIT_CODE=$? | ||
| fi | ||
| echo "Error: Unsupported BitLesson provider '$provider'" >&2 | ||
| return 1 | ||
| } | ||
|
|
||
| CODEX_EXIT_CODE=0 | ||
| RAW_OUTPUT="$(run_selector "$BITLESSON_PROVIDER" "$BITLESSON_MODEL" 2>&1)" || CODEX_EXIT_CODE=$? | ||
|
|
||
| if [[ $CODEX_EXIT_CODE -eq 124 ]]; then | ||
| echo "Error: BitLesson selector timed out after ${SELECTOR_TIMEOUT} seconds" >&2 | ||
|
|
@@ -187,6 +217,7 @@ fi | |
|
|
||
| if [[ $CODEX_EXIT_CODE -ne 0 ]]; then | ||
| echo "Error: BitLesson selector failed (exit code $CODEX_EXIT_CODE)" >&2 | ||
| printf '%s\n' "$RAW_OUTPUT" >&2 | ||
| exit "$CODEX_EXIT_CODE" | ||
| fi | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template emits the hook command as a bare path, so when
{{HUMANIZE_RUNTIME_ROOT}}contains spaces (for example a customCODEX_HOMEpath like/Users/John Doe/.codex), the command is split at runtime and Codex cannot execute the stop hook script. That breaks RLCR/PR exit gating in those installations; the command value should be shell-quoted or otherwise encoded as a single executable path.Useful? React with 👍 / 👎.