Skip to content

fix(compile): salvage partial output on timeout and iteration limits - #3948

Merged
yeshion23333 merged 16 commits into
mainfrom
fix/compile-output-salvage
Aug 12, 2026
Merged

fix(compile): salvage partial output on timeout and iteration limits#3948
yeshion23333 merged 16 commits into
mainfrom
fix/compile-output-salvage

Conversation

@fujiajie666

Copy link
Copy Markdown
Collaborator

Description

This PR prevents long-running Compile tasks from losing useful work when they reach the server runtime deadline or exhaust the AgentLoop iteration limit.

For Resource targets, eligible workspace files are safely salvaged before cleanup, recoverable Markdown links are repaired, and partial results are committed with explicit warnings. The PR also exposes a configurable server-side runtime timeout, expands Compile capacity, and hardens related link, SDK timeout, and semantic refresh behavior.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Added runtime_timeout_seconds to the Compile API and ov compile --runtime-timeout to the Rust CLI.
  • Salvage eligible Resource workspace output when a Compile task reaches its runtime deadline or the 50-iteration AgentLoop limit.
    • Enforce path safety, case-insensitive deduplication, output count, and total size limits.
    • Exclude internal staging and Skill files.
    • Repair recoverable relative Markdown links and remove unresolved links.
    • Use conditional batch writes to safely create or update existing files.
    • Return a completed result with a salvaged stage and explicit partial-output warnings.
  • Expanded Compile capacity:
    • Concurrent tasks: 2 → 10
    • Accepted tasks: 16 → 40
    • Per-principal accepted tasks: 4 → 10
    • Queue wait: 5 → 60 minutes
    • Default runtime: 30 → 40 minutes
    • Output pages/files: 128 each, with 256 combined operations
    • Batch-write limit: 128 → 256 operations
  • Preserved existing Markdown links when they already point to the requested Wiki target.
  • Extended the Python SDK read timeout for blocking batch writes and avoided invalid root semantic refresh work.
  • Updated the Compile design and English/Chinese API documentation.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Validation performed:

  • Targeted Python tests: 148 passed
  • Rust CLI Compile tests: 5 passed
  • Ruff checks: passed
  • cargo fmt --check: passed
  • git diff --check: passed

A broader run of the affected Python test files reported 231 passed, 1 failed. The remaining failure is test_glob_normalizes_scope_uri, whose expected request body does not include the existing node_limit: 256 field; neither the glob implementation nor this test is changed by this PR.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A

Additional Notes

Salvaged output is intentionally marked as partial because it has not passed the normal Wiki bundle validation flow. Salvage currently applies only to Resource targets; other target types retain the existing failure behavior.

@yeshion23333 yeshion23333 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes for two blocking correctness issues: the configured grace defaults currently fail this PR's own contract test, and the salvage link matcher leaves some valid unresolved Markdown links untouched.

Comment thread bot/vikingbot/compile/models.py
Comment thread bot/vikingbot/compile/service.py Outdated

@yeshion23333 yeshion23333 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One blocking Markdown path-normalization issue remains in the salvage repair path.

Comment thread bot/vikingbot/compile/service.py Outdated

@yeshion23333 yeshion23333 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed the latest changes. All previously reported blocking issues are resolved, and the targeted regression tests pass.

@yeshion23333
yeshion23333 merged commit 3577f77 into main Aug 12, 2026
14 checks passed
@yeshion23333
yeshion23333 deleted the fix/compile-output-salvage branch August 12, 2026 10:51
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants