feat: exclude 'Deprecated' plans (and their tasks) from LLM context
All checks were successful
Build and Deploy Teams Planner Bot / build-and-run (push) Successful in 30s

This commit is contained in:
윤정민 2026-05-15 17:41:41 +09:00
parent e42b3d7c43
commit 59c6814ccc
2 changed files with 12 additions and 2 deletions

View File

@ -170,6 +170,11 @@ export class PlannerBot extends TeamsActivityHandler {
return;
}
// listPlansWithBuckets already drops "Deprecated" plans; mirror that for tasks
// so the LLM can't try to update a task in a hidden plan.
const validPlanIds = new Set(plans.map((p) => p.planId));
recentTasks = recentTasks.filter((t) => validPlanIds.has(t.planId));
const action = await this.classifier.classify({
utterance,
plans,

View File

@ -11,12 +11,17 @@ import { PlanContext, Progress, RecentTaskContext } from "../llm/types";
export class PlannerClient {
constructor(private readonly graph: Client) {}
/** All plans the signed-in user can see, with their buckets pre-fetched. */
/** All plans the signed-in user can see, with their buckets pre-fetched.
* Plans whose title contains "deprecated" (case-insensitive) are filtered out
* so old/archived plans don't pollute the LLM context.
*/
async listPlansWithBuckets(): Promise<PlanContext[]> {
// Plans this user can access via the groups they belong to.
// Graph exposes /me/planner/plans which returns plans for groups the user is a member of.
const plansResp = await this.graph.api("/me/planner/plans").get();
const plans: Array<{ id: string; title: string }> = plansResp.value ?? [];
const plans: Array<{ id: string; title: string }> = (plansResp.value ?? []).filter(
(p: { title?: string }) => !/deprecated/i.test(p.title ?? ""),
);
const result: PlanContext[] = [];
for (const p of plans) {