Skip to content

fix: prevent catch-up agent crashes with surgical git-based checks#3

Merged
dean0x merged 1 commit intomainfrom
fix/catch-up-agent-crashes
Oct 17, 2025
Merged

fix: prevent catch-up agent crashes with surgical git-based checks#3
dean0x merged 1 commit intomainfrom
fix/catch-up-agent-crashes

Conversation

@dean0x
Copy link
Copy Markdown
Owner

@dean0x dean0x commented Oct 17, 2025

Summary

Fixes catch-up agent that was causing Claude Code instance crashes by replacing dangerous operations with surgical git-based checks.

Problem

The catch-up agent was crashing Claude Code sessions due to:

  • Running full test suites automatically (token overflow, timeouts)
  • Running full build commands (no timeout controls, could hang)
  • Scanning entire codebase with 18 file extensions (massive I/O)
  • Reading up to 5 status documents (potentially 5K+ tokens each)

Solution

Replaced dangerous operations with surgical, git-based checks:

  1. Removed automatic test/build execution - Now only detects and reports commands, doesn't run them
  2. Replaced filesystem scans with git diff - Uses git diff --name-only HEAD~1 instead of full codebase scan
  3. Scoped TODO/FIXME search - Only checks recently modified files
  4. Code cleanup - Removed excessive safety comments for cleaner implementation

Changes

  • src/claude/agents/devflow/catch-up.md: 9 insertions, 39 deletions
    • Removed full test suite execution (lines 95-103)
    • Removed full build execution (lines 105-110)
    • Replaced massive grep with targeted git check (lines 120-127)
    • Cleaned up excessive comments

Testing

  • Validated agent no longer attempts dangerous operations
  • Verified git-based checks work correctly
  • Confirmed surgical approach follows project guidelines

Impact

The agent retains its validation philosophy but now executes safely without risking Claude Code crashes.

🤖 Generated with Claude Code

Replace dangerous full-project scans with targeted git diff checks:
- Remove automatic test suite and build execution
- Replace filesystem scans with git diff --name-only HEAD~1
- Scope TODO/FIXME search to recently modified files only
- Keep status document limit at 5 per user preference
- Remove excessive safety comments for cleaner code

This prevents Claude Code crashes caused by scanning massive
codebases or triggering expensive build/test operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dean0x dean0x merged commit 04a395a into main Oct 17, 2025
@dean0x dean0x deleted the fix/catch-up-agent-crashes branch October 17, 2025 20:41
dean0x pushed a commit that referenced this pull request Mar 25, 2026
- Replace per-line subprocess spawning in extract_batch_messages with
  single-pass jq/node processing (issue #1)
- Decompose process_observations into validate_observation,
  calculate_confidence, and check_temporal_spread helpers (issue #2)
- Fix duplicate temporal spread calculation by computing epoch once
  in check_temporal_spread (issue #3)
- Escape double quotes in ART_DESC for YAML frontmatter safety (issue #4)
- Strengthen ART_NAME sanitization with strict kebab-case allowlist (issue #5)
- Replace per-line subprocess in apply_temporal_decay with single-pass
  jq operation and node fallback (issue #6)
- Replace per-line subprocess in create_artifacts status update with
  single-pass jq/node operation (issue #7)
- Remove dead increment_daily_counter function (issue #8)
- Extract write_command_artifact and write_skill_artifact helpers
  from create_artifacts (issue #9)
- Change flat 30k char truncation to per-session 8k char cap for
  proportional session contribution (issue #10)
- Add section comment markers to build_sonnet_prompt heredoc for
  navigability (issue #11)
dean0x pushed a commit that referenced this pull request Apr 13, 2026
Addresses 9 issues found in the r1-init-migrations review batch:

- #1: Move runMigrations block before installViaFileCopy so V1→V2 shadow
  renames complete before the installer looks for V2-named directories
- #2: Extend Migration.run to return MigrationRunResult { infos, warnings };
  both registry entries now surface migrated counts and conflict warnings to
  init.ts, which logs them via p.log.info / p.log.warn after the migration loop
- #3 (ISP): Split MigrationContext into GlobalMigrationContext | PerProjectMigrationContext
  discriminated union; drop unused claudeDir field; empty-string sentinels removed
- #4: Cap per-project Promise.allSettled concurrency at 16 via pooled() helper to
  avoid EMFILE on machines with 50-200 projects
- #5: Accumulate newlyApplied in memory and write state once at end of
  runMigrations — eliminates O(N²) writeAppliedMigrations calls per run
- #6: Use { flag: 'wx' } exclusive-create on .tmp file with unlink+retry on
  EEXIST to prevent TOCTOU symlink writes
- #7: Add exhaustiveness assertion (never) on migration.scope dispatch so future
  union extensions cause a runtime throw instead of silent no-op
- #8 (D37): Document vacuous-truth edge case in runMigrations comment block where
  discoveredProjects=[] marks per-project migration applied without sweeping any project
- #9: Convert applied array to Set<string> before the migration loop for O(1)
  .has() lookups instead of O(N) .includes() per migration

Co-Authored-By: Claude <noreply@anthropic.com>
dean0x pushed a commit that referenced this pull request Apr 16, 2026
Review walkthrough across 4 sessions resolved all 31 issues from the
2026-04-15_1022 code review (19 fixed, 5 rejected, 1 deferred, 6
pre-resolved).

Blocking fixes (sessions 1-2):
- CHANGELOG contradiction rewritten (#1)
- Worktree placeholder unified on "{worktree}" across 11 sites (#3)
- /debug migrated to index pattern (#4)
- KNOWLEDGE_CONTEXT quoting standardized, no inline fallback (#6)
- apply-knowledge skill defers to footer for paths (#7)
- Simplifier dropped from knowledge consumers; 4 agents canonicalized (#8)
- lstat+isFile guard on legacy-knowledge-purge unlink (#9)

Architecture + consistency fixes (session 2):
- Bare-form CLI removed, dispatch simplified to index-only (#10)
- code-review-teams template+table extraction (#12)
- Designer Apply Knowledge H2 added (#13)
- Teams phase numbering aligned (#14)
- loadKnowledgeContext + full subcommand removed entirely (#16)

Complexity + performance + testing + docs fixes (sessions 3-4):
- D-A filter extracted to isDeprecatedOrSuperseded predicate (#18)
- formatAdrLine/formatPfLine merged into formatEntryLine (#19)
- Shared test fixtures extracted to tests/knowledge/fixtures.ts (#21)
- Token claim "~250 tokens" dropped from 12 sites (#22)
- tmpdir cleanup added to test fixtures (#25)
- self-learning.md example and footer paths corrected (#28, #29)

28 files changed, 333 insertions, 524 deletions. 1021/1021 tests passing.
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.

1 participant