@commonlyai/cli 0.1.362 → 0.1.364
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 +1 -1
- package/src/commands/agent.js +34 -13
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -1022,6 +1022,13 @@ const PAST_CAP_MAX_CARRIES = 5;
|
|
|
1022
1022
|
// is unchanged, and the can't-answer limit (once per cause per pod per hour)
|
|
1023
1023
|
// still decides who hears it.
|
|
1024
1024
|
const CIRCUIT_NOTICE_CHECK_MS = 60 * 1000;
|
|
1025
|
+
// F237: failed turns in a row after which a full carry stops claiming new rows.
|
|
1026
|
+
// One failure keeps the claim, so a person's new message still joins the retry
|
|
1027
|
+
// ahead of carried agent rows; past it the outage looks real, and every row
|
|
1028
|
+
// claimed then rides the carry past the prompt cap, is released after
|
|
1029
|
+
// PAST_CAP_MAX_CARRIES failed turns and claimed again, an attempt each time,
|
|
1030
|
+
// until the requeue cap retires it without its ever being tried.
|
|
1031
|
+
const FULL_CARRY_CLAIM_FAILURES = 2;
|
|
1025
1032
|
|
|
1026
1033
|
// Who gets a slot when a batch is past the cap. 'unknown' counts as a person:
|
|
1027
1034
|
// only a row the snapshot and the kernel's stamp both can't place reads so, and
|
|
@@ -3861,6 +3868,25 @@ export const performRun = ({
|
|
|
3861
3868
|
confirmed === null || !deliveryIdOf(event) || confirmed.has(String(event._id))
|
|
3862
3869
|
);
|
|
3863
3870
|
|
|
3871
|
+
// What an inbox read asks for. A carry that fills the prompt during an
|
|
3872
|
+
// outage names its rows (`onlyIds`), and a current server returns only those
|
|
3873
|
+
// it requeued, with their live delivery ids, and claims nothing new (F237).
|
|
3874
|
+
// `limit` keeps today's value, so a server that predates onlyIds claims as
|
|
3875
|
+
// before. `inOutage`: the circuit-wait check, which runs only while the
|
|
3876
|
+
// circuit is open.
|
|
3877
|
+
const inboxQuery = ({ inOutage = false } = {}) => {
|
|
3878
|
+
const carried = [...heldRetry, ...heldGreeting];
|
|
3879
|
+
const carriedCount = carried.filter((event) => event.deliveryMode !== 'digest').length;
|
|
3880
|
+
const full = carriedCount >= batchLimit
|
|
3881
|
+
&& (inOutage || consecutiveSpawnFailures >= FULL_CARRY_CLAIM_FAILURES);
|
|
3882
|
+
return {
|
|
3883
|
+
agentName,
|
|
3884
|
+
instanceId,
|
|
3885
|
+
limit: Math.max(1, batchLimit - carriedCount),
|
|
3886
|
+
...(full ? { onlyIds: [...new Set(carried.map((event) => String(event._id)))].join(',') } : {}),
|
|
3887
|
+
...(adapter?.name ? { reportedCli: adapter.name } : {}),
|
|
3888
|
+
};
|
|
3889
|
+
};
|
|
3864
3890
|
// Decide what a failed turn's retry carries. `failedEvents` were attempted
|
|
3865
3891
|
// and count toward HELD_RETRY_MAX_FAILURES; `untriedEvents` are later groups
|
|
3866
3892
|
// from the same page that the failure stopped before they ran (#782), and
|
|
@@ -4096,7 +4122,9 @@ export const performRun = ({
|
|
|
4096
4122
|
}
|
|
4097
4123
|
if (isCommentWake(entry.event) && !commentTargetOf(entry.event)) {
|
|
4098
4124
|
entry.result = { outcome: 'no_action', reason: COMMENT_OUTSIDE_POD_REASON };
|
|
4099
|
-
|
|
4125
|
+
// A comment's payload has no messageId (postController sends no _id); its id
|
|
4126
|
+
// is thread.commentId.
|
|
4127
|
+
log(`[${entry.event.type}] comment ${entry.event.payload?.thread?.commentId} is not on a post in pod ${eventPodId}`
|
|
4100
4128
|
+ ' — acked without a spawn, so nobody is answered on a surface this seat was not placed for');
|
|
4101
4129
|
continue;
|
|
4102
4130
|
}
|
|
@@ -4533,12 +4561,8 @@ export const performRun = ({
|
|
|
4533
4561
|
// #3511). The overflow pass below stays as the backstop.
|
|
4534
4562
|
// Only wake events count: the server's page cap is on wakes, and a
|
|
4535
4563
|
// carried digest row takes no body (CodeRabbit on #3511).
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
const page = await client.get('/api/agents/runtime/events', {
|
|
4539
|
-
agentName, instanceId, limit: Math.max(1, batchLimit - carriedCount),
|
|
4540
|
-
...(adapter?.name ? { reportedCli: adapter.name } : {}),
|
|
4541
|
-
});
|
|
4564
|
+
// F237: a full carry in an outage claims nothing new (inboxQuery).
|
|
4565
|
+
const page = await client.get('/api/agents/runtime/events', inboxQuery());
|
|
4542
4566
|
pollLiveness.arm();
|
|
4543
4567
|
// A stall fired while this request hung: the loop has already given up on
|
|
4544
4568
|
// it, and `agent run` exits in onStall, so its page is left to the requeue.
|
|
@@ -4990,12 +5014,9 @@ export const performRun = ({
|
|
|
4990
5014
|
const wait = circuitNotice;
|
|
4991
5015
|
try {
|
|
4992
5016
|
pollLiveness.arm();
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
const page = await client.get('/api/agents/runtime/events', {
|
|
4996
|
-
agentName, instanceId, limit: Math.max(1, batchLimit - carriedCount),
|
|
4997
|
-
...(adapter?.name ? { reportedCli: adapter.name } : {}),
|
|
4998
|
-
});
|
|
5017
|
+
// A full carry here claims nothing new (F237): a pod whose first message
|
|
5018
|
+
// arrives then is told once the carry has room, not by this check.
|
|
5019
|
+
const page = await client.get('/api/agents/runtime/events', inboxQuery({ inOutage: true }));
|
|
4999
5020
|
pollLiveness.arm();
|
|
5000
5021
|
if (pollStalled) return;
|
|
5001
5022
|
const fetched = page?.events || [];
|