Skip to content

fix: address review findings from PR #27 modularization#28

Merged
Hmbown merged 3 commits intomainfrom
fix/pr27-review-findings
Apr 5, 2026
Merged

fix: address review findings from PR #27 modularization#28
Hmbown merged 3 commits intomainfrom
fix/pr27-review-findings

Conversation

@Hmbown
Copy link
Copy Markdown
Owner

@Hmbown Hmbown commented Apr 5, 2026

Summary

Fixes 7 bugs identified by Devin, Copilot, and Gemini reviewers on PR #27:

  • recipe_runtime.py — Parallel map_sub_query errors stored at outputs[0] instead of the failing task's actual index (Devin + Copilot)
  • action_tools.pyrun_tests lost sys.executable -m invocation and default flags (-vv --tb=short --maxfail=20) during extraction (Devin + Copilot)
  • formatting.py_format_payload(output="object") was truncating/sanitizing payloads, breaking the raw-data contract (Devin)
  • node_worker.cjsfindTypeTerminator matched = in => arrow tokens as type terminator; stripTypeAnnotationsFromParams stripped default parameter values alongside type annotations (Devin)
  • workspace_contexts.py_iter_workspace_files could crash on PermissionError; binding_status() int cast on bad metadata could crash (Gemini + Copilot)

Test plan

  • pytest tests/ -q — 563 passed
  • ruff check aleph/ tests/ — clean
  • New test: test_local_server_format_payload_object_returns_raw validates raw object mode
  • Devin review pass

🤖 Generated with Claude Code


Open with Devin

- Fix parallel map_sub_query storing errors at outputs[0] instead of correct index
- Restore sys.executable -m pytest invocation and default flags in run_tests
- Fix _format_payload output="object" mode truncating raw payloads
- Fix TS fallback stripper matching = in => arrow tokens as type terminator
- Fix TS param stripper dropping default values alongside type annotations
- Add PermissionError handling in workspace file walker
- Add defensive int cast in binding_status for corrupted metadata

563 tests pass, ruff clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 5, 2026 18:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a set of post-modularization regressions from PR #27 by fixing runtime correctness issues (async sub-query orchestration, Node type-stripping), restoring expected tool behavior (test runner invocation, payload formatting contracts), and hardening workspace binding/file handling.

Changes:

  • Restore correct behavior for run_tests invocation and _format_payload(..., output="object") raw-data contract (and add coverage).
  • Fix Node worker type-stripping edge cases (=> handling and default parameter preservation).
  • Improve robustness/correctness in recipe parallel map_sub_query error indexing and workspace file/binding metadata handling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_mcp_formatting.py Adds coverage ensuring output="object" returns the raw payload and that sanitized modes redact/truncate.
aleph/mcp/formatting.py Restores “object mode” to return unsanitized payloads; keeps sanitization for json/markdown.
aleph/mcp/action_tools.py Fixes run_tests to use sys.executable -m and restores default pytest flags.
aleph/repl/node_worker.cjs Fixes parsing/stripping logic to avoid treating => as = terminator and to preserve default param values.
aleph/mcp/workspace_contexts.py Adds defensive handling for PermissionError during file iteration and invalid persisted binding metadata.
aleph/mcp/recipe_runtime.py Fixes parallel map_sub_query to record errors at the correct output index.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread aleph/mcp/workspace_contexts.py Outdated
Comment on lines 289 to 293
stat = path.stat()
stale = (
stat.st_size != int(binding.get("size_bytes") or 0)
or stat.st_mtime_ns != int(binding.get("mtime_ns") or 0)
stat.st_size != expected_size
or stat.st_mtime_ns != expected_mtime_ns
)
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

binding_status() calls path.stat() without handling OSError/PermissionError. If a bound file exists but becomes unreadable (permissions, transient FS errors), get_status will crash instead of returning a stale/refreshable status. Consider wrapping path.stat() in try/except OSError and returning a status similar to the other error cases (e.g., stale=True, reason indicating stat failure).

Copilot uses AI. Check for mistakes.
Addresses Copilot review comment — if a bound file exists but becomes
unreadable, return stale=True with a clear reason instead of crashing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several improvements and bug fixes across the codebase. Key changes include updating the test runner to use sys.executable -m for better virtual environment support, fixing a bug in recipe_runtime.py where error messages were incorrectly indexed, and adding robust error handling for file system operations and metadata parsing in workspace_contexts.py. Additionally, the TypeScript type-stripping logic in node_worker.cjs was refined to correctly handle arrow functions within default parameters, and the payload formatting logic now supports returning raw objects without sanitization. I have no feedback to provide as no review comments were submitted.

devin-ai-integration[bot]

This comment was marked as resolved.

--maxfail=20 silently caps test failures, hiding the true count.
Let users pass their own flags via args instead of baking in defaults.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Hmbown Hmbown merged commit cc89f3d into main Apr 5, 2026
4 checks passed
@Hmbown Hmbown deleted the fix/pr27-review-findings branch April 5, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants