本卡屬 FR-166(母卡 CM-3109),批 9。repo:jedi-packages。只改 jedi-remote-agent 與 jedi-detection 兩個套件(同一個 repo)。由首腦驗收 CM-3143(P3-4b)、CM-3146(P4-2)時發現。
這張卡做什麼(白話)
主站前端已經畫好 Agent 清單的「待傳」「LDAP」兩欄和任務頁的「Agent 離線、等待回傳」橫幅(CM-3143),但套件沒有把這幾個欄位送出去,畫面永遠是「—」、橫幅永遠不出現。資料其實都在:心跳有收、資料表有存,只是 API 輸出時被欄位白名單丟掉。本卡把欄位補進輸出。做完後 CM-3143 不用改程式。
在哪裡
repo:~/Projects/Jedicogy/module/jedi-python-package(工作坊工作區 .worktrees/CM-3109 的 ws 分支)
改:jedi-remote-agent/jedi_remote_agent/api/serializers/remote_agent.py(RemoteAgentDetailResponse)
改:jedi-detection/jedi_detection/app/service/detection_orchestration_service.py(list_executions)
改:jedi-detection/jedi_detection/api/serializers/detection_tool.py(DetectionExecutionResponse)
改:兩個套件各自的 tests/
怎麼做
- jedi-remote-agent:RemoteAgentDetailResponse 加 outbox_size = fields.Integer(allow_none=True)、ldap_source = fields.String(allow_none=True)、sync_state = fields.String(allow_none=True)。三欄 DB/entity 都已存在(P0-6),只差輸出。加一條測試:清單 dump 帶這三欄;突變:拿掉任一欄宣告要紅。
- jedi-detection:list_executions 對 status 為 dispatched/running 的執行列,依該 Agent 的 last_seen_at 補 agent_offline_waiting(Agent 離線=true)與 agent_last_heartbeat_at。判斷沿用 jedi_remote_agent.common.agent_auth.heartbeat.is_online 與同一個離線門檻(jedi-detection 已相依 jedi-remote-agent),不要另寫一份判斷。已經在批次查 Agent(補 agent_name 那段),在同一迴圈補,不多打 DB。DetectionExecutionResponse 宣告這兩欄。測試:離線→true、在線→false、已完成的列不補(或為 false)。
- 前端已照這些欄位名接好(CM-3143:RemoteAgentManage.vue 讀 outbox_size/ldap_source;AgentOfflineBanner.vue 讀執行列的 agent_offline_waiting/agent_last_heartbeat_at/agent_name),欄位名不要改。
驗收
- 兩個套件 pytest tests 綠(BE venv+PYTHONPATH 指套件;BE venv 裝了 jedi-ldap 會搶 tests 套件名,要先把 tests 指回本套件,作法見 CM-3141/CM-3154 首腦復核)。
- 新測試含突變。
紀律
- 先 git status;先 git merge ws-CM-3109;顯式 git add 檔名,禁 -am;不切 branch;push 等令;不自派 subagent;不發版、不推 Nexus。
- 做完 commit+卡上回寫(commit hash、改了哪些檔、測試與突變結果),狀態改「修正待驗證」。
建議模型與思考強度(首腦判斷)
Stage 9/Model sonnet/Effort medium/Repo jedi-packages。兩處補欄位,判斷函式現成。
回寫(CM-3158)
- commit:10263909(branch ws-CM-3109-CM-3158,未 push)
- 改動:jedi-remote-agent api/serializers/remote_agent.py(RemoteAgentDetailResponse 加 outbox_size/ldap_source/sync_state);jedi-detection detection_orchestration_service.py(list_executions 對 dispatched/running 列補 agent_offline_waiting、agent_last_heartbeat_at,沿用 heartbeat.is_online+AgentAuthSettings 門檻,同一迴圈、不多打 DB)、api/serializers/detection_tool.py(宣告兩欄)