Skip to content

artifact注入缺少budget预检和preview_only降级 #34

Closed

Description

@dahai80

问题描述

PRD (artifact-enhance-plan.md FC-4) 要求 artifact 注入前做 budget 预检:>70% 降级为 preview_only,>90% 拒绝注入。

当前 artifactInjection.ts 始终全量注入 artifact 内容,无 budget 检查逻辑。

现有实现

  • artifactInjection.ts: 解析 artifact-ref → 全量注入内容(无 budget 预检)
  • contextCollapse/index.ts: 有 0.7 阈值触发 context collapse(但与 artifact 注入无联动)

缺失

  1. 注入前无 budget 预检(需调用 context.budget RPC)
  2. 注入时无 preview_only 降级模式(需调用 artifact.load RPC with preview_only=true)
  3. 无 section 级按需注入

来源: architecture/validate-fusion-artifacts.md P6

Activity

  1. added
    enhancement
    on Aug 3, 2026
  2. dahai80 commented on Aug 3, 2026

    @dahai80
    OwnerAuthor

    Blocked by upstream dahai80/fusion-mlx#327 (/v1/context/budget API). Cannot implement budget pre-check without the context budget RPC endpoint. FC-2 (LoadArtifactTool) and FC-3 (PatchArtifactTool) are now complete in v0.4.7 — these will be used by FC-4 once the budget API is available.

  3. dahai80 commented on Aug 3, 2026

    @dahai80
    OwnerAuthor

    FC-4 budget pre-check implemented in commit caf2d14. Uses local roughTokenCountEstimation + getContextWindowForModel (no need for upstream context.budget RPC). Three injection modes: full (<70%), preview_only with first 10 lines (70-90%), blocked with ref tag preserved (>90%).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions