Skip to content

feat: D1 fix_queue bridge — pull QUEUED items from CodeBeast into queue.json #28

@stackbilt-admin

Description

@stackbilt-admin

Problem

cc-taskrunner reads from queue.json. CodeBeast's autonomous fix pipeline writes QUEUED-tier fix items to D1 (fix_queue table, status='pending', fix_tier='QUEUED'). These two systems are not connected — approved QUEUED fixes have no path into the taskrunner without manual intervention.

What the bridge needs to do

  1. Pull approved items from CodeBeast's D1 fix_queue where fix_tier='QUEUED' and status='pending' (human has reviewed the CodeBeast "AWAITING APPROVAL" comment)
  2. Map to queue.json schema — translate D1 row fields to cc-taskrunner task format
  3. Mark as in-flight — update D1 row to status='in_progress' before running to prevent double-pickup
  4. Write back result — on completion, update status='completed' + pr_url; on failure, status='failed'

D1 → queue.json field mapping

D1 fix_queue field queue.json task field Notes
id id Use as-is
title title
prompt prompt Full fix prompt from holistic analyzer
authority authority auto_safe or operator — already set by CodeBeast
max_turns max_turns Default 20 in CodeBeast
repo repo Stackbilt-dev/tarotscript etc
origin_branch (branch base) Branch to cut fix/codebeast-{id[:8]} from
issue_url (PR body ref) Link back to triggering issue
correlation_id (log tag) Pass through for tracing

Approval gate

CodeBeast already posts an "AWAITING APPROVAL" comment with the Fix ID when a QUEUED item lands. The approval flow is intentionally manual for now (Anthropic policy change 2026-04-05 bills programmatic claude -p at API rates).

The bridge should not auto-pull everything pending. Options:

  • Label-triggered: human adds cc-approve label to the GitHub issue → bridge pulls that specific row
  • Manual pull: CLI command cc-taskrunner pull --fix-id <uuid> fetches and enqueues one item
  • Batch pull with review: cc-taskrunner pull --repo Stackbilt-dev/tarotscript lists pending items interactively

Recommendation: start with the CLI pull command — simplest, no webhook wiring needed.

CodeBeast D1 access

CodeBeast exposes fix_queue data via MCP tool codebeast_list_fix_queue (or equivalent). Alternatively, the bridge can call the D1 REST API directly using CLOUDFLARE_API_TOKEN + database ID 49364b38-1661-4965-a7e8-9abc10feda1a.

Out of scope for this issue

  • LLM provider switching (llm-providers / llm-gateway integration — separate decision)
  • Automated approval (no auto-pull without human sign-off)
  • CLOUD tier items (those execute inside CodeBeast's Workers runtime, never touch cc-taskrunner)

Related

  • CodeBeast fix pipeline: src/services/issue-consumer.ts — sets fix_tier='QUEUED', status='pending'
  • Approval gate commit: b99f072 (codebeast)
  • llm-gateway / llm-providers alternatives: tracked separately once D1 bridge is live

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions