Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0ef13827b |
+16
-6
@@ -410,12 +410,22 @@ cmd_ask() {
|
|||||||
# --last: append the most recent logged pos command output AFTER the
|
# --last: append the most recent logged pos command output AFTER the
|
||||||
# question, so the model diagnoses the real failure.
|
# question, so the model diagnoses the real failure.
|
||||||
if [ "$LAST_MODE" -eq 1 ]; then
|
if [ "$LAST_MODE" -eq 1 ]; then
|
||||||
local log_file=""
|
local log_file="" pos_log="" captured_log=""
|
||||||
# Priority 1: most recent pos dispatcher log
|
pos_log="$(newest_pos_log 2>/dev/null)" || true
|
||||||
log_file="$(newest_pos_log 2>/dev/null)" || true
|
[ -s "$LAST_CMD_OUTPUT_FILE" ] && captured_log="$LAST_CMD_OUTPUT_FILE"
|
||||||
# Priority 2: captured output from any command
|
# Use whichever source is newer (auto-capture beats stale pos logs)
|
||||||
if [ -z "$log_file" ] && [ -s "$LAST_CMD_OUTPUT_FILE" ]; then
|
if [ -n "$pos_log" ] && [ -n "$captured_log" ]; then
|
||||||
log_file="$LAST_CMD_OUTPUT_FILE"
|
local pos_age=$(( $(date +%s) - $(stat -c %Y "$pos_log") ))
|
||||||
|
local cap_age=$(( $(date +%s) - $(stat -c %Y "$captured_log") ))
|
||||||
|
if [ "$cap_age" -lt "$pos_age" ]; then
|
||||||
|
log_file="$captured_log"
|
||||||
|
else
|
||||||
|
log_file="$pos_log"
|
||||||
|
fi
|
||||||
|
elif [ -n "$captured_log" ]; then
|
||||||
|
log_file="$captured_log"
|
||||||
|
else
|
||||||
|
log_file="$pos_log"
|
||||||
fi
|
fi
|
||||||
[ -n "$log_file" ] || err "No recent output found — run 'pos ai gemini capture <cmd>' first, or pipe: cmd 2>&1 | pos ai gemini ask \"what happened\""
|
[ -n "$log_file" ] || err "No recent output found — run 'pos ai gemini capture <cmd>' first, or pipe: cmd 2>&1 | pos ai gemini ask \"what happened\""
|
||||||
last_log_annotate "$log_file"
|
last_log_annotate "$log_file"
|
||||||
|
|||||||
+16
-6
@@ -412,12 +412,22 @@ cmd_ask() {
|
|||||||
# --last: append the most recent logged pos command output AFTER the
|
# --last: append the most recent logged pos command output AFTER the
|
||||||
# question, so the model diagnoses the real failure.
|
# question, so the model diagnoses the real failure.
|
||||||
if [ "$LAST_MODE" -eq 1 ]; then
|
if [ "$LAST_MODE" -eq 1 ]; then
|
||||||
local log_file=""
|
local log_file="" pos_log="" captured_log=""
|
||||||
# Priority 1: most recent pos dispatcher log
|
pos_log="$(newest_pos_log 2>/dev/null)" || true
|
||||||
log_file="$(newest_pos_log 2>/dev/null)" || true
|
[ -s "$LAST_CMD_OUTPUT_FILE" ] && captured_log="$LAST_CMD_OUTPUT_FILE"
|
||||||
# Priority 2: captured output from any command
|
# Use whichever source is newer (auto-capture beats stale pos logs)
|
||||||
if [ -z "$log_file" ] && [ -s "$LAST_CMD_OUTPUT_FILE" ]; then
|
if [ -n "$pos_log" ] && [ -n "$captured_log" ]; then
|
||||||
log_file="$LAST_CMD_OUTPUT_FILE"
|
local pos_age=$(( $(date +%s) - $(stat -c %Y "$pos_log") ))
|
||||||
|
local cap_age=$(( $(date +%s) - $(stat -c %Y "$captured_log") ))
|
||||||
|
if [ "$cap_age" -lt "$pos_age" ]; then
|
||||||
|
log_file="$captured_log"
|
||||||
|
else
|
||||||
|
log_file="$pos_log"
|
||||||
|
fi
|
||||||
|
elif [ -n "$captured_log" ]; then
|
||||||
|
log_file="$captured_log"
|
||||||
|
else
|
||||||
|
log_file="$pos_log"
|
||||||
fi
|
fi
|
||||||
[ -n "$log_file" ] || err "No recent output found — run 'pos ai openrouter capture <cmd>' first, or pipe: cmd 2>&1 | pos ai openrouter ask \"what happened\""
|
[ -n "$log_file" ] || err "No recent output found — run 'pos ai openrouter capture <cmd>' first, or pipe: cmd 2>&1 | pos ai openrouter ask \"what happened\""
|
||||||
last_log_annotate "$log_file"
|
last_log_annotate "$log_file"
|
||||||
|
|||||||
Reference in New Issue
Block a user