Skip to content

WIP: feat(tower): limit TowerStatus max entries - #4427

Open
tpoisonooo wants to merge 3 commits into
mainfrom
add-artifact-worker
Open

tpoisonooo wants to merge 3 commits into
mainfrom
add-artifact-worker

Conversation

@tpoisonooo

@tpoisonooo tpoisonooo commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

  • 引入 artifacts worker,特点是“业务语义上是 read-only”,实际发生了写操作。 survey worker 是文件 read-only
    • 实用意义:训练期间想渲染中间结果,每次都因为 artifacts 有新增而 review,没必要
  • 当 tower worker 很多(500 个)时,LLM 执行 TowerStatus 结果几千行,改成默认末尾 20 个,允许 LLM 配查询参数。
    • 人类执行TowerStatus仍然是全量结果,这只是 for LLM
  • 恢复 worker 允许换模型接着干,而不是重开个 worker 复用 worktree 这种缝合形式
    • 用于上游 LLM API 异常情况

Bug Reproduction Steps

Root Cause

Code Changes

Behavior Changes and Affected Users

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa3927d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T12:10:11.531961Z fa3927d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@fa3927d
npx https://pkg.pr.new/@moonshot-ai/kimi-code@fa3927d

commit: fa3927d

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +360 to +361
await targetProfile.setModel(binding.model);
if (binding.thinking !== undefined) targetProfile.setThinking(binding.thinking);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve the selected model's default effort on resume

When a stopped subagent is resumed onto a pool alias and [secondary_model].default_effort is unset, binding.thinking is undefined, so this branch changes only the model and preserves the resumed agent's previous effort. For users relying on per-model variants, such as moving a high-effort agent to an alias whose model entry defaults to max, this silently ignores the selected alias's documented default; fresh spawns correctly call resolveSubagentThinking(...) to apply the model-entry/global fallback chain. Resolve the target model and apply that same effort resolution before running the resumed agent.

AGENTS.md reference: AGENTS.md:L130-L132

Useful? React with 👍 / 👎.

Comment on lines +190 to +193
if (
mission.kind === 'artifact' &&
(selectedReview.reviewer !== 'tower' || selectedReview.mission !== mission.id)
) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind artifact acceptance reports to the accepted branch tip

When an artifact branch advances after TowerComplete creates its acceptance request—for example, a resumed worker commits another deliverable before the human responds—the request still lists the old paths, but TowerReview stamps the branch's current tip and this check accepts it solely from the reviewer and mission identity. The human can therefore approve the stale report while the subsequent exact-tip review silently authorizes additional, never-presented files for merge. Persist the completion tip/path manifest and require tower acceptance to reference that same tip, or regenerate and present the current manifest before recording acceptance.

AGENTS.md reference: AGENTS.md:L130-L132

Useful? React with 👍 / 👎.

Comment on lines +1712 to +1715
const base = await this.diffBase(state, beforeMission);
const changed = await diffNameOnly(this.repoRoot, base, beforeMission.branch);
const missing = changed.filter((path) => !report.includes(path));
if (missing.length > 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match artifact paths as complete report entries

For an unchanged artifact branch, substring matching can still let a committed path disappear from the human-facing manifest: if the diff contains both reports/result and reports/result.csv, a report that names only reports/result.csv satisfies report.includes("reports/result"). TowerComplete then succeeds and the omitted file can be accepted and merged without ever being listed. Parse a structured path list or compare delimited, normalized entries exactly rather than searching the free-form report text.

AGENTS.md reference: AGENTS.md:L130-L132

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa3927d454

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +190 to +193
if (
mission.kind === 'artifact' &&
(selectedReview.reviewer !== 'tower' || selectedReview.mission !== mission.id)
) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Block artifact acceptance in automatic runs

When Tower runs in auto/noninteractive mode, any tower-authored clean/merge review is treated as human acceptance even though TowerReview records no user response and the gate checks only reviewer and mission identity. This contradicts tower-mode-full-reminder.md, which requires such runs to leave the artifact waiting, and allows an automatic or mistaken tool call to silently authorize the artifact merge. Reject artifact acceptance while interaction is unavailable, or require a verifiable user-consent record before this gate passes.

AGENTS.md reference: AGENTS.md:L130-L132

Useful? React with 👍 / 👎.

Comment on lines +360 to +361
await targetProfile.setModel(binding.model);
if (binding.thinking !== undefined) targetProfile.setThinking(binding.thinking);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Roll back rebinding when background registration fails

When a background resume specifies model while max_running_tasks is already exhausted, launch() permanently applies this model/thinking change before registerTask() rejects the call. The registration failure path only aborts the attempted run, so the tool returns Too many background tasks are already running while the stopped agent silently remains rebound; retrying later without model then uses a model the failed call was never supposed to commit. Reserve the task slot before rebinding, or restore the previous binding when registration fails.

Useful? React with 👍 / 👎.

| 'abandoned';

export type TowerMissionKind = 'build' | 'survey';
export type TowerMissionKind = 'build' | 'survey' | 'artifact';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface artifact kind in persisted mission views

After adding artifact as a third mission kind, the views used to inspect existing missions still render artifacts exactly like builds: renderMissions() in statusTool.ts only marks surveys, and renderMissionsIndex()/renderMissionFile() in store.ts likewise omit the kind except for surveys. Consequently /tower status and TowerMission(id) cannot tell a human or resumed coordinator that a planned or active mission requires human acceptance rather than independent review; only the one-time TowerPlan result exposes it. Add a kind column or an artifact marker to each persisted/status view.

Useful? React with 👍 / 👎.

@tpoisonooo tpoisonooo changed the title feat(tower): limit TowerStatus max entries WIP: feat(tower): limit TowerStatus max entries Oct 29, 2026

This branch has not been deployed

No deployments
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