Skip to content

Main dev - #1417

Merged
ShuhaoZhangTony merged 219 commits into
mainfrom
main-dev
Mar 22, 2026
Merged

Main dev#1417
ShuhaoZhangTony merged 219 commits into
mainfrom
main-dev

Conversation

@ShuhaoZhangTony

Copy link
Copy Markdown
Contributor

No description provided.

ShuhaoZhangTony and others added 9 commits January 23, 2026 00:48
- Replace FileHandler with RotatingFileHandler in CustomLogger
- Configure max file size: 50MB per file
- Configure backup count: 5 files (total ~250MB limit)
- Auto-rotate logs when size limit reached

Resolves #1385 - Prevents pipeline debug logs from growing indefinitely
- 修改 RayTask.put_packet() 为完全阻塞模式
- 移除混合策略和重试机制,避免数据包丢失
- 更新版本号到 0.2.4.11
- 使用公开模式发布到 PyPI
…checks

- feat(cli): add 'sage logs' command for log file management
  - clean: delete old logs with customizable retention period
  - list: display all log files with size and timestamp
  - info: show log directory disk usage statistics

- feat(ci): migrate weekly-report workflow to GitHub-hosted runner
  - use ubuntu-latest instead of self-hosted A6000
  - use DashScope remote API instead of local LLM detection
  - increase timeout from 30m to 45m for network operations
  - use ci_install_wrapper.sh for consistent installation

- fix(install): improve Python version detection robustness
  - handle edge cases in version string parsing
  - add fallback methods for different systems
  - prevent 'line' error in version extraction

- feat(install): add conda base environment check
  - warn users about installing in base environment
  - suggest creating dedicated sage environment
  - provide interactive environment creation option
  - skip interactive prompts in CI/non-TTY contexts

Related: #1396 (code cleanup preparation)
## Summary

This PR fixes CI/CD Lint & Format test failures in the main-dev branch.

## Changes

### 1. Fix test_custom_logger.py (sage-kernel)
- **Issue**: test_file_logging_with_invalid_directory was failing
- **Root cause**: Test was patching logging.FileHandler but code uses
RotatingFileHandler
- **Fix**: Changed patch target to
sage.common.utils.logging.custom_logger.RotatingFileHandler

### 2. Update devnotes_checker.py paths (sage-tools)
- **Issue**: Using incorrect path docs/dev-notes
- **Root cause**: dev-notes has been moved to independent SAGE-Pub
repository
- **Fix**: Updated path to docs-public/docs_src/dev-notes, preserved
original check logic

### 3. Skip devnotes check when SAGE-Pub absent (sage-tools)
- **Issue**: Failing when SAGE-Pub repository not present
- **Fix**: Added check in quality/__init__.py and main.py to skip
gracefully with friendly message
- **Message**: 'dev-notes directory not found, skipping (requires
SAGE-Pub repo)'

### 4. Auto-fix unused imports (sage-kernel)
- Ruff auto-removed unused imports (Full, sleep) from ray_task.py

## Test Results

✅ All pre-commit checks pass (26 checks)
✅ sage-dev quality check passes  
✅ Architecture compliance checks pass
✅ dev-notes check correctly skipped when SAGE-Pub not present

## Related Issues

Fixes CI/CD test failures in main-dev branch.
Copilot AI review requested due to automatic review settings January 24, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

ShuhaoZhangTony and others added 6 commits January 25, 2026 14:15
- Document plugin architecture in copilot-instructions
- Explain entry point mechanism and benefits
- Add implementation examples
- Fix gateway.py: Use 'sagellm_gateway' instead of 'isagellm.gateway' (correct module name)
- Fix gateway.py: Use '--control-plane' flag instead of '--enable-control-plane' (correct CLI parameter)
- Fix ports.py: Restore STUDIO_BACKEND to 8080 (Studio has its own FastAPI backend for auth/flows/operators)
- Update ports.py comment: Clarify Studio's frontend+backend architecture

These changes align with the actual sagellm-gateway implementation and Studio's independent backend.
- remote_environment: increase max_wait_time from 400s to 18000s (5 hours)
- router: change StopSignal to blocking send, remove timeout on data packets
- jobmanager_client: extend default timeout from 60s to 600s (10 minutes)
- base_task: extend drain timeout from 5s to 18000s (5 hours)

Rationale: Support large-scale RAG pipeline experiments with high P99 latency
(e.g., 5000 tasks with potential 150+ second delays per task)
Co-authored-by: ZeroJustMe <619378845@qq.com>
Co-authored-by: iliujunn <iliujun@msn.com>
@codecov

codecov Bot commented Jan 27, 2026

Copy link
Copy Markdown

iliujunn and others added 12 commits January 28, 2026 03:56
- Add complete Workload4 with dual-source semantic join
- Implement VDB retrieval cascades, graph memory, clustering, reranking
- Add comprehensive examples, tests, and documentation
- Fix print/sys.stdout.flush issues in daemon mode
- Remove unrelated workload files (1-3 and generic framework)
- Update .gitignore to track sage-benchmark package
## 问题描述

CI/CD 测试中出现多个失败:
- Examples 测试失败(2个)
- PEP 420 Integration Test 失败
- Codecov/patch 覆盖率不足
- 质量检查工具误报

## 修复内容

### 1. 修复 Examples 测试导入错误
- **basic_agent.py**: 使用正确的 `sage_libs.sage_agentic` 导入路径
- **adaptive_rag_v2.py**: 使用标准 OpenAI client 替代不存在的
LLMClientAdapter,修复所有 API 调用

### 2. 修复 PEP 420 Integration Test
- **recommended.py**: 延迟导入 `requests`,避免在模块导入时就需要该依赖
- 添加 ImportError 处理,当 requests 未安装时自动使用 fallback models

### 3. 优化质量检查工具
- **devnotes_checker.py**: dev-notes 目录不存在时改为警告而非错误
- **main.py**: 区分错误和警告,只有真正的错误才导致检查失败

### 4. 提升代码覆盖率
- 为 `recommended.py` 添加完整的单元测试(6个测试用例)
- 覆盖率从 17.6% 提升到 72%
- 覆盖关键功能:本地/远程 fallback、网络错误处理、超时参数

## 测试结果

✅ 所有 examples 测试通过
✅ PEP 420 Integration Test 通过
✅ 代码覆盖率满足要求
✅ Lint & Format 检查通过
✅ 质量检查通过

## 变更文件

- `packages/sage-common/src/sage/common/model_registry/recommended.py`
- `packages/sage-common/tests/unit/model_registry/test_recommended.py`
(新增)
- `packages/sage-libs/examples/agents/basic_agent.py`
- `packages/sage-libs/examples/rag/adaptive_rag_v2.py`
- `packages/sage-tools/src/sage/tools/cli/commands/dev/main.py`
- `packages/sage-tools/src/sage/tools/dev/tools/devnotes_checker.py`

---------

Co-authored-by: Shuhao Zhang (Tony) <shuhao_zhang@hust.edu.cn>
In remote mode, Python objects are serialized and copied to Ray workers,
so in-memory lists cannot be shared across distributed processes.

Changes:
- HotspotCollectorSink: Add file-based output for remote mode
  - New use_file_output parameter to switch between in-memory and file mode
  - Write results to /tmp/sage_hotspot_results/*.jsonl in remote mode
- hotspot_pipeline_example.py: Add _collect_results_from_files() to read
  results back from worker-written files after pipeline completion
- hotspot.py: Add close() method for potential future use

This fixes the issue where remote mode returned empty results while
local mode worked correctly.
…nrichedEvent export

- services.py: Add search() method to GraphMemoryService for compatibility with GraphMemoryRetriever
- __init__.py: Export GraphEnrichedEvent and VDBResultsWrapper for Ray serialization
- pipeline.py: Add StopSignal-compatible key selector for joined_stream
- aggregation.py: Add VDB results merge join operator
- tag_utils.py: Add TagMapper and TagFilter for dual VDB branches

Fixes: Ray serialization error 'Can't get attribute GraphEnrichedEvent'
Fixes: Service call error 'Service graph_memory does not have method process'
…ctory

Move packages/sage-benchmark/src/sage/benchmark/benchmark_sage/* to benchmark/
- Workload4 pipeline and all distributed workload experiments
- All experiment configurations and test suites
- LaTeX paper sources and figures
- CLI scripts (sage-system-bench)

This consolidates the benchmark code structure, making it more accessible
at the root level while maintaining all functionality.
Complete removal of nested package structure after consolidation to root benchmark/.
All benchmark code has been moved to the root benchmark/ directory in previous commit.
- Fix ruff linting issues (remove unused imports, format code)
- Format YAML and markdown files
- Note: benchmark test files and docs placement will be fixed in separate PR
Fix Issue #1418: 上游算子并行度不为 1 时导致任务丢失

## Problem
When upstream operators have multiple parallel instances (parallelism >= 2),
downstream tasks would lose data because the first completed upstream instance
broadcasts a StopSignal, causing the downstream to close prematurely.

## Solution
Implemented proper multi-instance stop signal coordination:
- Track upstream parallelism
- Wait for ALL upstream instances to send StopSignal
- Only then stop and forward downstream

## Files Changed
- packages/sage-kernel/src/sage/kernel/runtime/context/task_context.py
- packages/sage-kernel/tests/integration/test_parallel_stop_signal_fix.py
- docs-public/docs_src/dev-notes/cross-layer/ISSUE_1418_FIX_SUMMARY.md

Fixes #1418
## Summary
- Fix stop-signal coordination when upstream parallelism >= 2 (Issue
#1418)
- Add upstream tracking in 
- Add pytest-based integration checks for the fix

## Testing
- ============================= test session starts
==============================
platform linux -- Python 3.11.11, pytest-8.4.2, pluggy-1.5.0 --
/home/shuhao/miniconda3/envs/sage/bin/python
cachedir: .pytest_cache
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False
min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10
warmup=False warmup_iterations=100000)
rootdir: /home/shuhao/SAGE/packages/sage-kernel
configfile: pyproject.toml
plugins: timeout-2.4.0, cov-6.0.0, benchmark-5.1.0, dash-3.2.0,
mock-3.14.1, anyio-4.7.0, xdist-3.8.0, asyncio-1.1.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None,
asyncio_default_test_loop_scope=function
collecting ... collected 3 items


packages/sage-kernel/tests/integration/test_parallel_stop_signal_fix.py::test_handle_stop_signal_contains_parallel_tracking
PASSED [ 33%]

packages/sage-kernel/tests/integration/test_parallel_stop_signal_fix.py::test_initialize_upstream_tracking_exists
PASSED [ 66%]

packages/sage-kernel/tests/integration/test_parallel_stop_signal_fix.py::test_state_exclude_contains_tracking_set
PASSED [100%]

============================== 3 passed in 1.87s
===============================

## Issue
- Closes #1418

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ShuhaoZhangTony and others added 6 commits March 4, 2026 10:57
- run 'sage doctor check' after installation completes
- fallback to sage.common import check if sage.cli not available
- add hint line: sage doctor | sage demo hello
…to-activation

Add conda_guide.sh — a full conda environment guidance module ported and
adapted from sagellm's installation flow. Handles all four scenarios:

  1. conda not installed → offer auto-install via official or Tsinghua mirror
  2. conda installed, base env active → prompt to create dedicated env
  3. conda installed, no env active → prompt to create/activate dedicated env
  4. conda installed, non-base env active → OK, proceed

Key additions:
- check_conda_environment(): main entry point, sets _SAGE_CONDA_ENV_CHECKED
  flag to avoid double-prompting when called from both apply_defaults and
  run_environment_prechecks
- guide_install_conda(): interactive menu with [1] official [2] Tsinghua
  mirror [3] manual later (exit 0, non-fatal) [4] skip
- _auto_install_miniforge(): downloads installer, conda init bash, creates
  'sage' env, writes bashrc activation, then exit 0
- _write_conda_activate_to_rc() + setup_bashrc_conda_default(): inject
  'conda activate sage' after conda-init block in ~/.bashrc; also sets
  auto_activate_base: false so new terminals enter 'sage' not 'base'

quickstart.sh changes:
- --setup-conda shortcut: standalone conda guide mode (exit after)
- post-install hook: call setup_bashrc_conda_default to persist env across
  new terminal sessions

argument_parser.sh changes:
- apply_defaults: replaced silent 'use system Python' fallback with
  check_conda_environment() interactive call
- help text: document --setup-conda flag with usage example

environment_prechecks.sh changes:
- source conda_guide.sh
- replace check_conda_base_environment() with check_conda_environment()
- skip re-prompting if _SAGE_CONDA_ENV_CHECKED is already true
…output

Previously, git clone was called with 2>/dev/null, silently swallowing
errors and showing only the generic '❌ <repo> 克隆失败' message. This made
transient network failures (e.g. first-connection timeout to GitHub)
impossible to diagnose.

Changes:
- Replace single silent git clone with a retry loop (up to 3 attempts,
  2s delay between attempts)
- Capture stderr via 2>&1 and surface the actual git error message on each
  failed attempt
- Print the last failure reason alongside the final '克隆失败' message
- Improves diagnostic output for repos like .github and sage-pypi-publisher
  that were silently failing on congested connections

Also: add sagellm-vscode to SAGE.code-workspace folder list
vector_stores backends migrated from isage-middleware to isage-rag;
audit gate doc updated with isage-rag entry and changelog row
ShuhaoZhangTony and others added 22 commits March 7, 2026 23:19
…ld references

sage.dev module (111 Python files merged from isage-dev-tools):
- sage.dev.cli — sage-dev CLI (quality check/fix, project test, package mgmt, etc.)
- sage.dev.agent_training — agent training utilities
- sage.dev.impl, sage.dev.web_ui — dev tooling internals
- Register sage-dev entry point in pyproject.toml [project.scripts]
- Add explicit CLI deps in [dev] extra (typer, rich, gitpython, jinja2 etc.)
- Remove isage-dev-tools dep (code now lives here)
- Move isage-sias to capability-tooluse optional extra; still in full via alias

sageTSDB cleanup:
- Makefile: remove TSDB build step (migrated to intellistream/sageTSDB)
- .github/actions/setup-sage/action.yml: remove sageTSDB submodule check
- tools/git-tools/README.md: remove sageTSDB submodule entry

dependency-audit-gate.md: document isage-sias restructure + isage-dev-tools removal
…d sage-libs/middleware

- folders: remove sage-libs [L2], sage-middleware [L3]
- folders: add sage-tools [zoo], sage-benchmark [benchmark]
- extraPaths: remove stale packages/* and decommissioned repo paths
- launch PYTHONPATH: clean up to match current repo layout
- sync copilot instructions and workflow docs
- update workspace and dependency metadata
- move docs-public content into docs/
- remove obsolete maintenance, cleanup, and script helpers
- Bump isage version 0.3.2 -> 0.3.2.1
- Add 'dist' to root-directory-cleanup-check whitelist
- Fix PermissionError when checking sageFlownet candidate paths
@ShuhaoZhangTony
ShuhaoZhangTony merged commit 633aa07 into main Mar 22, 2026
4 of 8 checks passed
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.

6 participants