Skip to content
Merged
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
2 changes: 1 addition & 1 deletion part11-gateway-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if ! curl -s http://localhost:8642/health > /dev/null 2>&1; then
fi

# Disk space OK?
USAGE=$(df -h ~/.hermes | awk 'NR==2 {print $5}' | tr -d '%')
USAGE=$(df -Ph ~/.hermes | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$USAGE" -gt 90 ]; then
echo "WARNING: Disk usage at ${USAGE}%"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion part6-context-compression.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ try:
compressed_context = summary
except Exception as e:
logger.warning(f"Context compression failed: {e}, preserving original context")
return original_context # Don't compress, don't lose data
compressed_context = messages_to_compress # Don't compress, don't lose data

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Recommended fix introduces type mismatch: compressed_context set to raw message list instead of string

The recommended "FIXED" code example now assigns compressed_context = messages_to_compress in the error handler, but messages_to_compress is a list of messages (the input to summarize_messages()), while the success path sets compressed_context = summary (a string). The broken version also used a string: compressed_context = "". This means any downstream code consuming compressed_context would expect a string but receive a list, causing a type error.

Additionally, messages_to_compress is only the subset of messages selected for compression, not the full original_context. The previous version (return original_context) correctly preserved the entire context and aborted the function immediately. The new version continues execution with an inconsistent type and incomplete context.

A user following this documentation advice would introduce a bug into their compression handler.

Suggested change
compressed_context = messages_to_compress # Don't compress, don't lose data
return original_context # Don't compress, don't lose data
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

```

**The rule:** If compression can't succeed, keep the uncompressed context. A slower response is better than a wrong one.
Expand Down
Loading