@xn-intenton-z2a/agentic-lib 7.4.19 → 7.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -156,6 +156,8 @@ function buildPrompt(ctx, agentInstructions, metricAssessment) {
|
|
|
156
156
|
"Use read_file to inspect source code and tests for completeness.",
|
|
157
157
|
"Use git_diff or git_status for additional context if needed.",
|
|
158
158
|
"Consider the implementation review findings — if critical gaps exist, do NOT declare mission-complete.",
|
|
159
|
+
"Check the acceptance criteria in the Mission section above. If all criteria are clearly satisfied by the current source code and tests (verified via read_file), you SHOULD declare mission-complete even if not all mechanical metrics are MET.",
|
|
160
|
+
"For simple missions (few functions, clear acceptance criteria), do not require elaborate test coverage or documentation beyond what the acceptance criteria specify.",
|
|
159
161
|
"Then call report_director_decision with your determination.",
|
|
160
162
|
"",
|
|
161
163
|
"**You MUST call report_director_decision exactly once.**",
|
|
@@ -455,6 +457,7 @@ export async function direct(context) {
|
|
|
455
457
|
if (logFilePath) attachments.push({ type: "file", path: logFilePath });
|
|
456
458
|
if (screenshotFilePath) attachments.push({ type: "file", path: screenshotFilePath });
|
|
457
459
|
|
|
460
|
+
const sessionStartTime = Date.now();
|
|
458
461
|
const result = await runCopilotSession({
|
|
459
462
|
workspacePath: process.cwd(),
|
|
460
463
|
model,
|
|
@@ -467,6 +470,8 @@ export async function direct(context) {
|
|
|
467
470
|
excludedTools: ["write_file", "run_command", "run_tests", "dispatch_workflow", "close_issue", "label_issue", "post_discussion_comment", "create_issue", "comment_on_issue"],
|
|
468
471
|
logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
|
|
469
472
|
});
|
|
473
|
+
const sessionDurationMs = Date.now() - sessionStartTime;
|
|
474
|
+
core.info(`Director session completed in ${Math.round(sessionDurationMs / 1000)}s (${result.tokensIn + result.tokensOut} tokens)`);
|
|
470
475
|
|
|
471
476
|
const tokensUsed = result.tokensIn + result.tokensOut;
|
|
472
477
|
|
|
@@ -482,14 +487,11 @@ export async function direct(context) {
|
|
|
482
487
|
|
|
483
488
|
// Execute the decision
|
|
484
489
|
let outcome = "directed";
|
|
485
|
-
if (decision === "mission-complete"
|
|
490
|
+
if (decision === "mission-complete") {
|
|
486
491
|
if (process.env.GITHUB_REPOSITORY !== "xn-intenton-z2a/agentic-lib") {
|
|
487
492
|
await executeMissionComplete(octokit, repo, reason);
|
|
488
493
|
outcome = "mission-complete";
|
|
489
494
|
}
|
|
490
|
-
} else if (decision === "mission-complete" && !metricAssessment.allMet) {
|
|
491
|
-
core.info("Director chose mission-complete but metrics are NOT all met — overriding to in-progress");
|
|
492
|
-
outcome = "directed";
|
|
493
495
|
} else if (decision === "mission-failed") {
|
|
494
496
|
if (process.env.GITHUB_REPOSITORY !== "xn-intenton-z2a/agentic-lib") {
|
|
495
497
|
await executeMissionFailed(octokit, repo, reason, metricAssessment);
|
|
@@ -609,6 +609,13 @@ async function executeCreateIssue(octokit, repo, params, ctx) {
|
|
|
609
609
|
if (!title && feature) {
|
|
610
610
|
title = `feat: implement ${feature}`;
|
|
611
611
|
}
|
|
612
|
+
// Fallback: derive title from mission context when LLM provides no params
|
|
613
|
+
if (!title && ctx?.mission) {
|
|
614
|
+
const missionHeading = ctx.mission.match(/^#\s+(.+)/m);
|
|
615
|
+
const missionName = missionHeading ? missionHeading[1].trim() : "mission";
|
|
616
|
+
title = `feat: implement ${missionName.toLowerCase()}`;
|
|
617
|
+
core.info(`create-issue: derived title from mission context: "${title}"`);
|
|
618
|
+
}
|
|
612
619
|
if (!title) {
|
|
613
620
|
core.warning("create-issue: no title, body, or feature provided — skipping");
|
|
614
621
|
return "skipped:no-title";
|
|
@@ -831,7 +838,21 @@ export async function supervise(context) {
|
|
|
831
838
|
type: "object",
|
|
832
839
|
properties: {
|
|
833
840
|
action: { type: "string", description: "Action name (e.g. dispatch:agentic-lib-workflow, github:create-issue, set-schedule:weekly, nop)" },
|
|
834
|
-
params: {
|
|
841
|
+
params: {
|
|
842
|
+
type: "object",
|
|
843
|
+
properties: {
|
|
844
|
+
title: { type: "string", description: "Issue title (REQUIRED for github:create-issue)" },
|
|
845
|
+
body: { type: "string", description: "Issue body or description" },
|
|
846
|
+
labels: { type: "string", description: "Comma-separated labels (e.g. 'automated,enhancement')" },
|
|
847
|
+
"issue-number": { type: "string", description: "Issue number for dispatch, label, or close actions" },
|
|
848
|
+
"pr-number": { type: "string", description: "PR number for dispatch actions" },
|
|
849
|
+
mode: { type: "string", description: "Workflow dispatch mode (e.g. 'dev-only', 'maintain-only')" },
|
|
850
|
+
frequency: { type: "string", description: "Schedule frequency for set-schedule action" },
|
|
851
|
+
message: { type: "string", description: "Message for respond:discussions action" },
|
|
852
|
+
"discussion-url": { type: "string", description: "Discussion URL for respond:discussions action" },
|
|
853
|
+
},
|
|
854
|
+
description: "Action parameters. For github:create-issue, 'title' is required.",
|
|
855
|
+
},
|
|
835
856
|
},
|
|
836
857
|
required: ["action"],
|
|
837
858
|
},
|
|
@@ -845,12 +866,30 @@ export async function supervise(context) {
|
|
|
845
866
|
planResult.reasoning = reasoning || "";
|
|
846
867
|
|
|
847
868
|
// Execute each action using existing handlers
|
|
869
|
+
// W10: Track created issue titles for same-iteration dedup
|
|
870
|
+
const createdIssueTitles = new Set();
|
|
848
871
|
const results = [];
|
|
849
872
|
for (const { action, params } of (actions || [])) {
|
|
850
873
|
try {
|
|
874
|
+
// W10: Skip duplicate create-issue within same plan
|
|
875
|
+
if ((action === "github:create-issue" || action.startsWith("github:create-issue")) && params?.title) {
|
|
876
|
+
const titleKey = (params.title || "").toLowerCase().substring(0, 40);
|
|
877
|
+
if (createdIssueTitles.has(titleKey)) {
|
|
878
|
+
results.push(`skipped:duplicate-same-session:${(params.title || "").substring(0, 50)}`);
|
|
879
|
+
logger.info(`Skipping duplicate issue in same session: ${params.title}`);
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
851
884
|
const result = await executeAction(octokit, repo, action, params || {}, ctx);
|
|
852
885
|
results.push(result);
|
|
853
886
|
logger.info(`Action result: ${result}`);
|
|
887
|
+
|
|
888
|
+
// W10: Track created issues for dedup
|
|
889
|
+
if (result.startsWith("created-issue:")) {
|
|
890
|
+
const title = (params?.title || "").toLowerCase().substring(0, 40);
|
|
891
|
+
if (title) createdIssueTitles.add(title);
|
|
892
|
+
}
|
|
854
893
|
} catch (err) {
|
|
855
894
|
logger.warning(`Action ${action} failed: ${err.message}`);
|
|
856
895
|
results.push(`error:${action}:${err.message}`);
|
|
@@ -870,6 +909,7 @@ export async function supervise(context) {
|
|
|
870
909
|
if (logFilePath) attachments.push({ type: "file", path: logFilePath });
|
|
871
910
|
if (screenshotFilePath) attachments.push({ type: "file", path: screenshotFilePath });
|
|
872
911
|
|
|
912
|
+
const sessionStartTime = Date.now();
|
|
873
913
|
const result = await runCopilotSession({
|
|
874
914
|
workspacePath: process.cwd(),
|
|
875
915
|
model,
|
|
@@ -882,6 +922,7 @@ export async function supervise(context) {
|
|
|
882
922
|
excludedTools: ["write_file", "run_command", "run_tests"],
|
|
883
923
|
logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
|
|
884
924
|
});
|
|
925
|
+
core.info(`Supervisor session completed in ${Math.round((Date.now() - sessionStartTime) / 1000)}s`);
|
|
885
926
|
|
|
886
927
|
const tokensUsed = result.tokensIn + result.tokensOut;
|
|
887
928
|
|
|
@@ -187,6 +187,10 @@ export async function transform(context) {
|
|
|
187
187
|
};
|
|
188
188
|
|
|
189
189
|
// ── Run hybrid session ─────────────────────────────────────────────
|
|
190
|
+
// Cap tool calls to prevent unbounded sessions (W6: Benchmark 010 finding)
|
|
191
|
+
const maxToolCalls = Math.max(20, Math.floor((t.maxTokens || 200000) / 5000));
|
|
192
|
+
|
|
193
|
+
const sessionStartTime = Date.now();
|
|
190
194
|
const result = await runCopilotSession({
|
|
191
195
|
workspacePath: process.cwd(),
|
|
192
196
|
model,
|
|
@@ -196,11 +200,12 @@ export async function transform(context) {
|
|
|
196
200
|
writablePaths,
|
|
197
201
|
createTools,
|
|
198
202
|
attachments,
|
|
203
|
+
maxToolCalls,
|
|
199
204
|
excludedTools: ["dispatch_workflow", "close_issue", "label_issue", "post_discussion_comment"],
|
|
200
205
|
logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
|
|
201
206
|
});
|
|
202
|
-
|
|
203
|
-
core.info(`
|
|
207
|
+
const sessionDurationMs = Date.now() - sessionStartTime;
|
|
208
|
+
core.info(`Transform session completed in ${Math.round(sessionDurationMs / 1000)}s (${result.tokensIn + result.tokensOut} tokens, maxToolCalls=${maxToolCalls})`);
|
|
204
209
|
|
|
205
210
|
// Detect mission-complete hint
|
|
206
211
|
const lowerResult = (result.agentMessage || "").toLowerCase();
|