Skip to content

XERK-517 [Qwen J]: background-agent rows + subagentHistory for qwen - #549

Merged
xerhab merged 1 commit into
mainfrom
XERK-517
Aug 29, 2026
Merged

XERK-517 [Qwen J]: background-agent rows + subagentHistory for qwen#549
xerhab merged 1 commit into
mainfrom
XERK-517

Conversation

@xerhab

@xerhab xerhab commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Projects a Qwen session's subagent lifecycle into Claude-Code on-disk JSONL shapes so
_scan_agent_entry, _resolve_subagent, _resolve_workflow_run, _workflow_agents and the
usage/archive/migration walks read it with NO reader change (the XERK-304 contract).

  • qwen_transcript.py: _subagent_launch() detects a Qwen agent-tool launch and reshapes
    background → toolUseResult{status:"async_launched"} + clean agentId text; foreground →
    prepended agentId: line (resolvable but no live row, preventing phantom). Grammar-checks
    every agentId against _VALID_AGENT_ID_RE before use.
  • qwen_session.py: _pump split into _pump_parent() + always-running _sync_children().
    Child logs projected incrementally through fresh QwenProjector instances into the Claude
    subagents/ layout. Symlinked child logs refused.
  • No hub-agent.py change — zero diff on the reader.

QA verdict

PASS — adversarial QA agent confirmed all claims:

  • 61 qwen tests pass (0.17s), full 1885-test suite green (84.72s), JS parity 114 tests green
  • Three targeted mutations (remove grammar gate, always async_launched, remove islink check)
    each caught by the relevant test
  • agentId regex verified against 12 hostile inputs (traversal, injection, overlength, null)
  • hub-agent.py has zero diff; instruction files all under 40k chars
  • Not verified: live end-to-end qwen delegation (host-proof, same footing as every qwen child)

Test plan

  • pytest agent/tests/test_qwen_transcript.py agent/tests/test_qwen_session.py -v (61 pass)
  • Full hub-agent suite (1885 pass)
  • node --test agent/tests/tunnel-agent.test.js (114 pass)
  • Mutation testing on safety gates (3/3 caught)
  • Corpus fixtures sanitized (no path leaks)

Project a qwen subagent delegation into the Claude-Code on-disk shapes so
hub-agent's existing readers (_scan_agent_entry / _resolve_subagent) surface the
picker row + drill-in transcript with NO reader change (the XERK-304 contract),
and the usage/archive/migration walks count + carry the delegated tokens
unchanged.

Qwen's delegation is a near-Claude Agent launch, so this RESHAPES rather than
synthesizes (the dsh [J] difference):
- qwen_transcript.py: map the "agent" tool to "Agent", and reshape qwen's
  task_execution tool_result into Claude's async_launched toolUseResult + an
  "agentId:" result text. The STOP edge is free: qwen already writes an exact
  <task-notification>. A foreground/completed subagent stays resolvable but is
  never a live row (no notification would retire it).
- qwen_session.py: the tail projects each child's own native log
  (<slug>/subagents/<parent>/agent-<id>.jsonl) into the Claude subagents/ layout,
  incrementally per child. _pump now runs child sync every pump past the parent's
  no-new-data early return (a background subagent grows its log while the parent
  turn is idle -- the qwen difference from dsh).

Verified through hub-agent's REAL readers over a corpus CAPTURED from a real Qwen
0.22.x background delegation on disk (no-mock). Workflows are a stated residual
gap (no Claude-shaped on-disk mapping captured); live end-to-end delegation is
host-proof, the footing every qwen child ships on.

Docs: new .claude/rules/qwen-delegation.md (scoped), [Qwen J] pointer in qwen.md.
@xerhab
xerhab merged commit 6f09a27 into main Aug 29, 2026
4 checks passed
@xerhab
xerhab deleted the XERK-517 branch August 29, 2026 03:37
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