Skip to content

feat(agentloop): sub-agent delegation (issue #153, v0 sequential) - #230

Merged
Delqhi merged 1 commit into
mainfrom
feat/issue-153-subagent
Jun 16, 2026
Merged

feat(agentloop): sub-agent delegation (issue #153, v0 sequential)#230
Delqhi merged 1 commit into
mainfrom
feat/issue-153-subagent

Conversation

@Delqhi

@Delqhi Delqhi commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Implements issue #153 (Loop Engineering Lücke 4). Loop.SpawnSubagent runs a subtask in an isolated session, returns a SubagentResult with summary + control fields only (never the full history).

What ships

  • cmd/sin-code/internal/agentloop/subagent.go (new) — 130 LOC
    • SubagentRequest, SubagentResult, Loop.SpawnSubagent
    • Per-subagent budget overrides (MaxTurns, MaxTokens)
    • Inherits parent's wiring (Gate, Completion, hooks, lessons, ledger)
    • Does NOT inherit RunOverride
  • cmd/sin-code/internal/agentloop/subagent_test.go (new) — 6 race-clean tests

v0 vs v1

v0 (this PR): sequential delegation. One sub-agent at a time.
The issue body says: "Empfohlene Reihenfolge: erst sequentielle Delegation (unten), Parallelität als Follow-up."

v1 (follow-up): parallel delegation. The signature is already designed for it — one SpawnSubagent call per sub-agent, no shared state. v1 spawns N goroutines.

Acceptance criteria

  • spawn_subagent method exists on Loop
  • Sub-agent's session is isolated from parent's
  • Only summary returned to parent (never full history)
  • Per-subagent MaxTurns / MaxTokens honored
  • v0 ships sequential; parallelism is v1

Hard mandates

  • M2: no new deps
  • M3: sub-agent's verify-gate re-verified (defense in depth)
  • M7: 6/6 tests pass under go test -race -count=1

Closes #153

What ships:
  - cmd/sin-code/internal/agentloop/subagent.go (new)
    - SubagentRequest: Goal + optional MaxTurns/MaxTokens overrides.
    - SubagentResult: Summary + Verified + Turns + OpenCriteria
      (never the full message history — the parent's context stays small).
    - Loop.SpawnSubagent(ctx, *session.Store, req): forks a fresh
      session, builds a child Loop that shares the parent's wiring
      (Gate, Completion, hooks, lessons, ledger), inherits the
      parent's budgets unless overridden, runs child.Run, returns
      a result. Does NOT inherit RunOverride.
  - cmd/sin-code/internal/agentloop/subagent_test.go: 6 tests
    (nil-parent, nil-store, empty-goal, basic-success, budget-fallback,
    budget-override).

Acceptance criteria (from #153):
  - [x] spawn_subagent tool exists (the SpawnSubagent method).
  - [x] The sub-agent's session is isolated from the parent's.
  - [x] Only the summary is returned to the parent (never the
        full history).
  - [x] Per-subagent MaxTurns / MaxTokens are honored.
  - [x] v0 ships sequential delegation; parallelism is a follow-up.

Hard mandates honored:
  - M2: no new deps.
  - M3: the sub-agent's verify-gate is the same as the parent's
    (re-verified, defense in depth).
  - M7: 6/6 tests pass under go test -race -count=1.

Refs: #153
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sin-code Ready Ready Preview, Comment, Open in v0 Jun 16, 2026 8:44pm

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-young-hobby-team-24h").

Learn More: https://vercel.com/manheiler-8784s-projects?upgradeToPro=build-rate-limit

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-young-hobby-team-24h").

Learn More: https://vercel.com/miroblabla-2914s-projects?upgradeToPro=build-rate-limit

@Delqhi
Delqhi merged commit 0611f05 into main Jun 16, 2026
10 of 11 checks passed
@Delqhi
Delqhi deleted the feat/issue-153-subagent branch June 16, 2026 20:44
@github-actions

Copy link
Copy Markdown

🏆 CEO Audit — A+ (100.0/100)

Metric Value
Grade A+
Score 100.0/100
Critical findings 0
High findings 0
Profile QUICK
Min grade gate B

📥 Download full report (Markdown)
📊 Download SARIF (for Code Scanning)

Run ~/.config/opencode/skills/ceo-audit/scripts/audit.sh . --profile=QUICK locally to reproduce.

@github-actions

Copy link
Copy Markdown

🏆 CEO Audit — A+ (100.0/100)

Metric Value
Grade A+
Score 100.0/100
Critical findings 0
High findings 0
Medium findings 0
Profile QUICK
Min grade gate B

📥 Download full report (Markdown)

Run ID: 27646943528 · Commit: ${github.sha}

Run ~/.config/opencode/skills/ceo-audit/scripts/audit.sh . --profile=QUICK locally to reproduce.

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.

Loop: Sub-Agent / Tool-Delegation

1 participant