Skip to content

Cursor/fix post merge test drift - #645

Open
zjk1984 wants to merge 290 commits into
Panniantong:mainfrom
zjk1984:cursor/fix-post-merge-test-drift
Open

Cursor/fix post merge test drift#645
zjk1984 wants to merge 290 commits into
Panniantong:mainfrom
zjk1984:cursor/fix-post-merge-test-drift

Conversation

@zjk1984

@zjk1984 zjk1984 commented Aug 23, 2026

Copy link
Copy Markdown

No description provided.

cursor Bot and others added 30 commits July 8, 2026 08:38
feat(ci): GitHub Actions daily-run schedule + secrets setup script
Switch workflow schedules from UTC conversion to native timezone field
with Beijing wall-clock cron times. Resolve job from github.event.schedule
when available; set TZ=Asia/Shanghai on the runner job.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
fix(ci): GitHub Actions daily-run cron in 北京时间 (Asia/Shanghai)
GHA schedule runs failed at save_run_manifest when evaluation
contained dataclass audit/gate objects.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
…-7c18

fix(daily-run): serialize AuditResult in GHA run manifests
Add paper-mode portfolio_manager that applies buy/sell when intraday
T1-T5 fires: max 10 holdings, no per-position cap, sells weakest
holding on macro veto, buys top watchlist candidate with deployable cash.
Persists to portfolio.json and trade_ledger.jsonl; morning job increments
days_held for holding lock.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
feat(daily-run): MSS-driven paper portfolio auto-adjust
- Extend intraday schedule to 12 scans (S1-S2 at 7:00/8:00 Beijing)
- Move morning job to 8:10 to avoid cron conflict with 8:00 scan
- Update GHA workflow, resolve script, MAX_SCANS, and tests

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
Single 8:00 morning job runs Team-First full analysis and records S2
into intraday state without re-running experts. Remove separate 8:00
intraday and 8:10 morning crons.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
feat(schedule): 7:00/8:00 盘前 SN MSS 扫描
Intraday portfolio apply no longer adds/removes watchlist entries.
Morning and close jobs run adjust_watchlist(); close recycles
intraday sells from trade ledger.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
Keep watchlist morning/close-only policy; integrate S2 scan from morning job.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
…y-7c18

feat(daily-run): watchlist adjust only at morning and close
Close job now generates structured feedback on MSS, portfolio,
watchlist, and S_n scan schedule. Results appear in the Feishu
close card under 复盘改进意见.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
feat(daily-run): 收盘复盘输出 MSS/持仓/观察池/S_n 改进意见
…close card

GHA was checking out main which lacks close_improvements (PR #10).
Pin workflow to cursor/daily-run-skill-a3e7; move 复盘改进意见 to
end of Feishu card and always render when enabled.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
fix(daily-run): GHA 检出 daily-run 分支以启用复盘改进意见
Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
merge(daily-run): 将 daily-run 集成分支合并到 main
portfolio.max_holdings now caps deduplicated holdings+watchlist count.
Watchlist trim and buy/sell respect remaining slots under the total cap.
Removed separate watchlist.max_size default of 20.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
fix(daily-run): 最多10只为持仓+观察池合计上限
Add close_code_review: portfolio overlap/上限/cash_ratio repairs,
intraday state checks, manifest review, AST source walkthrough.
Renders 代码走读与 Bug 修复 section in close Feishu card.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
feat(daily-run): 收盘复盘代码走读与 Bug 自动修复
- Cache load_settings by file mtime
- Parallel Xueqiu quotes and Exa close research
- Shared symbols.py helpers; single portfolio load/save on close
- Skip AST source walk by default (walk_on_close)
- Reuse scan lookback/trend in evaluate_trade; portfolio from snapshot
- Precompute MSS once in watchlist trim; tail-read trade ledger

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
perf(daily-run): 优化收盘/盘中执行效率与逻辑复用
Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
chore(portfolio): 新增海能达 002583 持仓
Fork repos have zero GHA schedule runs; add morning S1 backfill when 07:00
missed, fork warning in workflow, and local crontab dispatch helper.

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
fix(daily-run): fork 仓库 07:00 cron 未触发 + 早盘 S1 补录
_today_str() previously used UTC date.today(), causing S1 backfills near
midnight Beijing to append to the prior trading day (e.g. S3 instead of S1).

Co-authored-by: zjk1984 <zjk1984@users.noreply.github.com>
zjk1984 and others added 30 commits August 20, 2026 19:52
When Eastmoney clist and akshare spot fail, aggregate rise/fall/flat from
Xueqiu index detail quotes; partial cards show counts without limit stats.

Co-authored-by: Cursor <cursoragent@cursor.com>
When Eastmoney clist is blocked, enrich Xueqiu/macro breadth with
akshare涨停/跌停/炸板股池 counts and limit-up stocks for sector analysis.

Co-authored-by: Cursor <cursoragent@cursor.com>
…verlay

Parse verify/forecast_review playbook calibration lines (bias/vol_scale
arrows) into harness flat overrides, expose effective values via
forecast_calibration and calibration_overlay, and merge into load_calibration.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document one-question-at-a-time decision trees for open high findings,
add grill-me-bug-fix reference, and hint Phase G in walk markdown output.

Co-authored-by: Cursor <cursoragent@cursor.com>
When AKShare hist fails, fetch ma20/volume_ratio/position_20d from Xueqiu
chart/kline before portfolio cost fallback so watchlist symbols pass
structured_review_complete during morning runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Set llm_narrative.planner to llm for morning/close Feishu cards while
keeping weekly/forecast on deterministic via per-job planner overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>
Give deepseek-v4-flash enough completion budget for reasoning plus JSON
content on morning/close narrative cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
Trade cards reused blocked=true to always say "不允许执行买入", which
mislabeled deep-loss sell blocks (e.g. T3 海能达 hold). Add block_kind
and context-aware markdown messages for buy vs sell blocks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Portfolio-wide 1W/4L was blocking buys on unrelated symbols (e.g. T4
长电科技). Win-rate checks now filter realized_sells by target code;
portfolio loss-streak guard is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reuse symbol sell win-rate stats from pnl_execution_guard during morning/close
adjust_watchlist: remove low-win-rate names, skip recycle/add candidates, and
block re-entry when filling the watchlist.

Co-authored-by: Cursor <cursoragent@cursor.com>
… config

Set pnl_overview.win_rate_min base to 0 and win_rate_min_mode to harness.
Harness raises the guard to 33% (40% on repeat) when pnl_overview emits
卖出胜率偏低, relaxes on pnl_target_hit, and respects fixed mode fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
Set pnl_overview.loss_streak_max base to 0 with loss_streak_max_mode:harness.
Activate guard at 3 consecutive losing sells when 连亏警戒 appears, relax by
1 on pnl_target_hit, and use bootstrap detection floors in pnl_overview evidence
so phrases still emit before harness thresholds turn on.

Co-authored-by: Cursor <cursoragent@cursor.com>
Attach T-numbered buy/sell/hold lines (including blocked/unapplied) to
intraday narrative cards under a 调仓操作 section, mirroring close-day
当日买卖 formatting.

Co-authored-by: Cursor <cursoragent@cursor.com>
When the same symbol gets buy recommendations three times in a row,
waive min_cash reserve and deploy/max-position caps for one minimum-lot
buy so high-priced names like 300308 can still fill.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add L0/L1 sidecars for skill fragments, overlay/memory diff jsonl audit,
and 上下文轨迹 on morning/intraday/close 规则解读 cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
Persist failed/blocked intraday trades as structured cases under
memory/cases, sync harness entries to sidecar markdown, and expose
agentreach:// URIs via `agent-reach context ls|read|find`. Wire case
recording into intraday evaluate_trade and attach case_uri to rule
interpretation context traces.

Co-authored-by: Cursor <cursoragent@cursor.com>
…hu cards

Expand build_context_trace to render overlay/memory diff lines from
jsonl audit logs, iterate merged intraday symbols for per-stock trade
status, and resolve case memory by prioritized symbol codes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Enrich intraday trade_operations with MSS, Lookback, verdict, execution
fills, and portfolio status per symbol. Stop rendering harness runtime
overlays in intraday context_trace so 调仓操作 stays focused on stock trades.

Co-authored-by: Cursor <cursoragent@cursor.com>
Deep-loss holdings now record buy recommendations but block portfolio
apply until the same symbol receives three consecutive buy signals in a
row. Prevents one-off MSS spikes (e.g. T12 水晶光电) from adding into
trapped positions before defensive trim can act.

Co-authored-by: Cursor <cursoragent@cursor.com>
…an sells

Stamp holding cost on sell TradeActions and use it (or portfolio.json
opening costs) when ledger lacks buy lots, instead of treating sell price
as cost basis. Fixes deep-loss sells showing only commission loss (e.g.
水晶光电 -4).

Co-authored-by: Cursor <cursoragent@cursor.com>
Track today_buy_shares per holding so same-session buys cannot be sold
until the next trade session. Merge add-on buys into weighted average cost
(including commission) for unrealized P&L. FIFO replay skips same-day buy
lots when matching sells.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use format_trade_at (Asia/Shanghai) for close-day trade operations and
ledger summary lines instead of slicing UTC ISO timestamps.

Co-authored-by: Cursor <cursoragent@cursor.com>
When portfolio.json cash drifts from morning baseline + ledger net flow,
close summary and symbol_runner now use ledger-implied cash so daily PnL
is not inflated by phantom cash. close_code_review auto_fix applies the
same correction; tests mock empty ledger by default.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use end_total - start_total as the authoritative daily_pnl; decompose
with stock_mv_delta and cash_delta instead of summing per-holding day_pnl
plus cash. Update close card copy and tests for trade/capital scenarios.

Co-authored-by: Cursor <cursoragent@cursor.com>
Close schedule run failed because symbol_runner imported the helper
from snapshot_builder; it lives in symbols.py.

Co-authored-by: Cursor <cursoragent@cursor.com>
Close cards no longer trust wrong ledger stored realized_pnl (often
commission-only). Annotate day trades with FIFO replay using morning
baseline costs; backfill uses morning baseline instead of current portfolio.

Co-authored-by: Cursor <cursoragent@cursor.com>
Stamp FIFO realized_pnl onto portfolio_actions at ledger append time;
enrich missing fields when rendering intraday 调仓操作 lines; fallback
sell holding_cost to morning baseline; show realized on apply markdown.

Co-authored-by: Cursor <cursoragent@cursor.com>
Do not let current merged portfolio cost overwrite morning baseline
when seeding FIFO for intraday/ledger realized PnL.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add 12:30 midday macro/Lookback refresh, force bypass for non-trading
cron runs, and Kronos hold-out backtest CLI. Enable Team-First defaults,
StrategyOptimizer Sharpe parity, weekly experience dedupe by symbol, and
two-worker parallel intraday with deterministic narrative cards.

Includes supervisor counter-thesis LLM, plugin pipeline, intent cache,
watchlist intel, xueqiu enhancements, and expanded test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove evolved pnl_overview sell-ratio keys from static settings,
expect midday cron in schedule tests, isolate harness audit windows
from runtime dates, and bypass harness position caps in portfolio tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants