PR 7: finally good code
You are the OpenCode coding subagent, the sole code writer for this task. Apply the attached Ponytail skill (full). Read it first and report its SHA-256 in your final evidence. You are not alone in this workspace: preserve existing/concurrent changes and never revert others' work. Do not commit, push, merge, install globally, alter live ~/.hai, ~/.hermes, agent profiles, or unrelated repos.
Ownership
Implement only in /home/smlflg/Projekte/CodingAgent/hai-mcp-pr7, branch
feat/coding-worker-lanes. Own code, tests and matching project documentation
for the worker lane slice. Root agent orchestrates and reviews; it does not code.
User requirements (mandatory)
HAI-MCP becomes the common entry point for existing main agents. There are two
worker lanes: coding and sonstiges. Main agent chooses the lane autonomously
and can split mixed tasks; no owner approval for routine lane choice/delegation.
ALL coding via this entry point must delegate to an OpenCode subprocess with
Ponytail actually supplied as instructions. No main-agent coding or alternate
coding harness path, including fixes. Sonstiges is ordinary non-code work; main
can do it itself or use a worker. Distinct technical review must precede coding
acceptance; process exit 0 is not acceptance. Keep commit/push/destructive/global
configuration human gates. No built-in auto commits/pushes.
Architecture and scope
Read AGENTS.md, GOAL.md, docs/TOOL_CONTRACT.md and all touched code first. Current main is the single-writer contract kernel. Open PR #6 is a separate owner-gate change: do NOT merge or copy it. Reuse existing contracts, session validation, path confinement, storage, locking and audit. Update slice documentation to reflect user-authorized worker execution; retain no direct LLM SDK calls inside server (external bounded OpenCode process performs model calls).
Provide a minimal coherent real implementation, not just proposals or prompts:
- MCP entry to dispatch bounded coding job against a valid lease, criterion, approved project scope; lane metadata explicit, allowed values only.
- Existing main session decides lane without extra owner gate; noncoding path must not silently launch coding. Reject known code mutation requests routed as noncoding. Clearly document that MCP cannot remove an external agent's shell rights, nor semantically classify deceptive prose; do NOT claim OS enforcement. Provide an actionable main-agent client contract for closing direct-write paths.
- Coding launch is hardwired to OpenCode (not agent-supplied executable/shell).
Full Ponytail instructions must be packaged with license attribution and sent
to every builder/fix invocation; record hash/provenance. Do not just accept
ponytail=truesupplied by a caller. No large new framework/dependencies. - Async start returns job ID quickly. Status/results and stop work on that job. Bound duration to lease/mission expiry and stop on revoked/stale contracts, explicit stop, timeout; no automatic retry/provider escalation. Concurrent starts cannot bypass allowed capacity. Failed/missing process after restart must never look active or completed forever. Don't signal stale/reused PIDs.
- Capture stdout/stderr without leaking credentials, exit/result status, actual diff and evidence provenance tied to code snapshot; edits invalidate review. Use subprocess argv, never shell=True or interpolation. Treat agent output as untrusted and don't auto-execute suggested commands. Test commands and writable project scopes must come from authorized task/contract, not generated output.
- Separate review records need a valid different session from builder/requester
as appropriate, matching mission/criterion/contract and exact diff/snapshot.
Reject stale or self-review. No
acceptedmerely for successful process exit. Do not fabricate semantic verification: tests/review are evidence with limits. - Work in an isolated workspace for coding and return changes for inspection; avoid changing source repo automatically. Capture untracked as well as tracked files, avoid including secrets/.git/runtime dirs. If clean Git prerequisite is necessary, enforce and document it honestly. Scope is meaningful, not only a prompt; detect out-of-scope changes and refuse acceptance.
- Respect declared non-goals and all existing gates; old non-worker workflows should remain functional. No dashboard, registry, cron, mass client install.
If above needs a specific simplification, do not silently drop a requirement: report it as unresolved with evidence. Keep solution small but complete.
Verification
Use isolated HAI_HOME and dependency cache under /tmp, never live state. Existing
interpreter /home/smlflg/Projekte/hai-mcp-installed/.venv/bin/python has pytest
and mcp installed; run with PYTHONPATH pointing at this checkout's src so no
installation is needed. Tests must cover actual subprocess boundary with a
deterministic fake opencode executable, not only mocked success dictionaries.
Add focused tests for real lifecycle, coding forcing/Ponytail content, lane choice,
invalid args, no shell injection, expired/revoked leases, capacity, stop/timeout,
subprocess errors, worktree scope escapes/symlinks, untracked diff, and distinct
review snapshot binding. Also expose tools through real MCP schema/stdio test.
Run whole pytest suite once focused tests pass. Existing failures must be reported.
Output final diff summary, exact test command/result, Ponytail hash, unresolved limitations. No live paid worker tests unless root explicitly instructs one.