Skip to content

feat(daemon): hardcode builder isolation rules + crash diagnostics#9

Merged
sethvoltz merged 4 commits intomainfrom
feature/evolve-isolation-crash-diag
May 2, 2026
Merged

feat(daemon): hardcode builder isolation rules + crash diagnostics#9
sethvoltz merged 4 commits intomainfrom
feature/evolve-isolation-crash-diag

Conversation

@sethvoltz
Copy link
Copy Markdown
Owner

Summary

  • Builder Isolation Rules (prime.ts): Promotes the three workspace-containment constraints from memory-only entries to a hardcoded section in buildOrchestratorSystemPrompt, placed before "How to delegate". Eliminates reliance on memory state for a critical safety invariant.
  • Crash diagnostics (crash-store.ts, lifecycle.ts): New crash-store.ts module stores { exitCode, stderrTail } per agent. The spawnAgentLoop .catch() handler captures the numeric exit code and last 10 lines of the error stack and stores them there. Entry is cleared on destroyAgentByName.
  • Health monitor wiring (agent-health.ts): HealthIssue gains optional exitCode and stderrTail fields. runHealthCheck populates them via getCrashInfo() on crash detection. notifyOrchestrator appends them to the mail body; the agent_health_crashed log event includes them. crash-store.ts is imported directly (not via lifecycle.ts) to avoid the existing circular import.

Evolve proposals implemented

  • friction-correction-repeating-on-orchest-wmzf — builder isolation rules hardcoded in orchestrator prompt
  • agent-health-crashed-repeating-on-builde-535t — crash diagnostics on agent exit

Test plan

  • pnpm test — all 319 tests pass (16 daemon, 14 CLI, 4 shared, 2 memory, dashboard)
  • pnpm --filter @friday/daemon exec tsc --noEmit — clean
  • pnpm --filter @friday/cli exec tsc --noEmit — clean
  • pnpm --filter @friday/shared build — clean
  • prime.test.ts verifies Builder Isolation Rules block present and ordered before "How to delegate"
  • agent-health.test.ts verifies exitCode/stderrTail appear in issue, mail body, and log when crash info is present; verifies clean absence when no crash info

🤖 Generated with Claude Code

sethvoltz and others added 4 commits April 29, 2026 09:01
… prompt

Promotes the three isolation constraints from memory-only entries to a
permanent section in prime.ts so they are always present regardless of
memory state. Section is placed before "How to delegate" and verified
by a new assertion in prime.test.ts.

Implements evolve proposal: friction-correction-repeating-on-orchest-wmzf

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds lastCrashInfo map and getCrashInfo() export to lifecycle.ts.
The spawnAgentLoop .catch() handler now stores exit code (numeric only,
string codes coerced to null) and the last 10 lines of the error
stack/message before logging. The entry is cleared when the agent
is destroyed.

Implements evolve proposal: agent-health-crashed-repeating-on-builde-535t

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ayload

Extracts crash state into crash-store.ts (avoids circular import between
lifecycle.ts and agent-health.ts). HealthIssue now carries optional
exitCode and stderrTail fields. runHealthCheck calls getCrashInfo() on
crash detection and attaches the fields; notifyOrchestrator appends them
to the mail body; the agent_health_crashed log event includes them.
Tests verify both the populated and absent-info cases.

Implements evolve proposal: agent-health-crashed-repeating-on-builde-535t

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- lifecycle.ts: discard old async-loop code (replaced by fork supervisor in
  main); keep both clearCrashInfo() and clearFileTracking() in
  destroyAgentByName; wire crash capture into forkAgentProcess with piped
  stderr (stdio inherit/inherit/pipe/ipc) and rolling 10-line buffer; store
  exitCode+stderrTail via setCrashInfo on unexpected exit
- prime.test.ts: keep both isolation rules assertions (ours) and memory
  assertions (main) in the orchestrator test
- agent-health.ts: take main's updated crash message text, keep exitCode/
  stderrTail field spread and enhanced log call
- agent-health.test.ts: restructure crash diag tests into dedicated describe
  block to match main's new test layout; keep 3-condition IPC stall detection
  tests from main

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sethvoltz sethvoltz merged commit 5c772c0 into main May 2, 2026
2 checks passed
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