Add federation worker and canonical handoffs

This commit is contained in:
kami
2026-07-28 16:17:18 +04:00
parent 58793a5aa3
commit 2cecbc4015
22 changed files with 1429 additions and 108 deletions
+13 -3
View File
@@ -160,6 +160,10 @@ type Session struct {
// its §6.1 handoff (HandoffFile) — avoids re-sending the same prompt
// every tick while Release keeps waiting for the file to appear.
HandoffRequested bool `json:"handoff_requested,omitempty"`
// HandoffReason is selected by the coordinator when it asks for the
// semantic report. The checkout worker, rather than the harness, copies
// it into the canonical handoff it seals at release time.
HandoffReason string `json:"handoff_reason,omitempty"`
// ConventionsHash is continuity.ConventionsHash of the project's shared
// *.md docs (AGENTS.md/CLAUDE.md/VOCAB.md) at the time this session was
// last notified of (or started with) their content — §6.3's staleness
@@ -455,10 +459,16 @@ func agentName(harness, taskID string) string {
id = "session"
}
name := prefix + "-" + id
if len(name) > 32 {
name = strings.TrimRight(name[:32], "-_")
if len(name) <= 32 {
return name
}
return name
// Keeping only the leading task-id characters made distinct long task
// IDs collide in herdr's machine-global name namespace. Reserve a stable
// digest suffix so truncation remains bounded *and* task-specific.
sum := sha256.Sum256([]byte(taskID))
const suffixLen = 8
keep := 32 - len(prefix) - 1 - 1 - suffixLen // prefix + "-" + stem + "-" + digest
return prefix + "-" + strings.TrimRight(id[:keep], "-_") + "-" + fmt.Sprintf("%x", sum[:])[:suffixLen]
}
// harnessStartArgs stays empty for Claude: --dangerously-skip-permissions