From 21d997903ac0543f77648513a24d3992c35149fe Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 2 Jul 2025 11:35:57 -0700 Subject: [PATCH] Reduce parent_height from 80 to 40 and add thread debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reduced parent_height parameter from 80 to 40 to limit deep thread nesting - Added debug print/exit to inspect thread prompt structure - Improved thread preview logging to show meaningful content fields - This helps identify the token-inefficient YAML representation issue 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- bsky.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/bsky.py b/bsky.py index b0f0533..8590319 100644 --- a/bsky.py +++ b/bsky.py @@ -216,7 +216,7 @@ def process_mention(void_agent, atproto_client, notification_data): try: thread = atproto_client.app.bsky.feed.get_post_thread({ 'uri': uri, - 'parent_height': 80, + 'parent_height': 40, 'depth': 10 }) except Exception as e: @@ -235,7 +235,28 @@ def process_mention(void_agent, atproto_client, notification_data): try: thread_context = thread_to_yaml_string(thread) logger.info(f"Thread context generated, length: {len(thread_context)} characters") - logger.debug(f"Thread context preview: {thread_context[:500]}...") + + # Create a more informative preview by extracting meaningful content + lines = thread_context.split('\n') + meaningful_lines = [] + + for line in lines: + stripped = line.strip() + if not stripped: + continue + + # Look for lines with actual content (not just structure) + if any(keyword in line for keyword in ['text:', 'handle:', 'display_name:', 'created_at:', 'reply_count:', 'like_count:']): + meaningful_lines.append(line) + if len(meaningful_lines) >= 5: + break + + if meaningful_lines: + preview = '\n'.join(meaningful_lines) + logger.debug(f"Thread content preview:\n{preview}") + else: + # If no content fields found, just show it's a thread structure + logger.debug(f"Thread structure generated ({len(thread_context)} chars)") except Exception as yaml_error: import traceback logger.error(f"Error converting thread to YAML: {yaml_error}") @@ -261,6 +282,9 @@ The YAML above shows the complete conversation thread. The most recent post is t Use the bluesky_reply tool to send a response less than 300 characters.""" + print(prompt) + exit() + # Extract all handles from notification and thread data all_handles = set() all_handles.update(extract_handles_from_data(notification_data)) -- 2.51.2