mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
feat(pool): 引入 pro_first 调度预设、Pool 候选持久化跳过与诊断信息优化
- 新增 pro_first 调度预设(Pro 优先),更新 plus_first 仅针对 Plus 计划,移除 free_team_first - Pool 内部候选(pool_key_index 不为空)跳过 DB 持久化(available/skipped/unused 均适用) - LRU 排序新增 catalog_lru_score 回退:runtime 无记录时使用 last_used_at_unix_secs - 执行路径 miss 诊断消息细化为中文,按 reason 分类输出可读说明 - build_local_request_candidate_status_record 补充 extra_data 和 created_at_unix_ms 字段 - OpenAI CLI 计划构建流程补充候选评估进度跟踪与 terminal reason 设置 - 前端 PoolSchedulingDialog 增加 pro_first 预设展示,修复 LRU 默认预设检测逻辑
This commit is contained in:
@@ -13,6 +13,7 @@ use crate::control::GatewayControlDecision;
|
||||
use crate::execution_runtime::{execute_execution_runtime_stream, execute_execution_runtime_sync};
|
||||
use crate::executor::{build_local_execution_exhaustion, LocalExecutionRequestOutcome};
|
||||
use crate::log_ids::short_request_id;
|
||||
use crate::orchestration::local_execution_candidate_metadata_from_report_context;
|
||||
use crate::request_candidate_runtime::{
|
||||
record_local_request_candidate_status, RequestCandidateRuntimeWriter,
|
||||
};
|
||||
@@ -246,10 +247,14 @@ where
|
||||
T: LocalPlanAndReport,
|
||||
{
|
||||
for plan_and_report in remaining {
|
||||
let report_context = plan_and_report.report_context();
|
||||
if should_skip_unused_persistence(report_context.as_ref()) {
|
||||
continue;
|
||||
}
|
||||
record_local_request_candidate_status(
|
||||
state,
|
||||
plan_and_report.plan(),
|
||||
plan_and_report.report_context().as_ref(),
|
||||
report_context.as_ref(),
|
||||
SchedulerRequestCandidateStatusUpdate {
|
||||
status: RequestCandidateStatus::Unused,
|
||||
status_code: None,
|
||||
@@ -264,6 +269,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn should_skip_unused_persistence(report_context: Option<&serde_json::Value>) -> bool {
|
||||
let metadata = local_execution_candidate_metadata_from_report_context(report_context);
|
||||
metadata.candidate_group_id.is_some() && metadata.pool_key_index.is_some()
|
||||
}
|
||||
|
||||
fn resolve_stream_candidate_watchdog_timeout(plan: &aether_contracts::ExecutionPlan) -> Duration {
|
||||
let timeout_ms = plan
|
||||
.timeouts
|
||||
@@ -352,10 +362,14 @@ pub(crate) async fn mark_unused_local_candidate_items<T, FPlan, FContext>(
|
||||
FContext: Fn(&T) -> Option<&serde_json::Value>,
|
||||
{
|
||||
for item in remaining {
|
||||
let report_context = report_context(&item);
|
||||
if should_skip_unused_persistence(report_context) {
|
||||
continue;
|
||||
}
|
||||
record_local_request_candidate_status(
|
||||
state,
|
||||
plan(&item),
|
||||
report_context(&item),
|
||||
report_context,
|
||||
SchedulerRequestCandidateStatusUpdate {
|
||||
status: RequestCandidateStatus::Unused,
|
||||
status_code: None,
|
||||
@@ -464,6 +478,20 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unused_persistence_skips_pool_internal_candidates() {
|
||||
assert!(should_skip_unused_persistence(Some(&json!({
|
||||
"candidate_group_id": "pool-group",
|
||||
"pool_key_index": 1,
|
||||
}))));
|
||||
assert!(!should_skip_unused_persistence(Some(&json!({
|
||||
"candidate_group_id": "pool-group",
|
||||
}))));
|
||||
assert!(!should_skip_unused_persistence(Some(&json!({
|
||||
"candidate_index": 1,
|
||||
}))));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn stream_candidate_watchdog_marks_failed_candidate_and_continues() {
|
||||
let writer = Arc::new(TestRequestCandidateWriter::default());
|
||||
|
||||
Reference in New Issue
Block a user