agentic-devtools 0.2.657__py3-none-any.whl → 0.2.659__py3-none-any.whl

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.
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.2.657'
22
- __version_tuple__ = version_tuple = (0, 2, 657)
21
+ __version__ = version = '0.2.659'
22
+ __version_tuple__ = version_tuple = (0, 2, 659)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -51,6 +51,12 @@ class DispatcherWakeStore:
51
51
 
52
52
  def __init__(self, provider: CIPlatformProvider) -> None:
53
53
  self.provider = provider
54
+ self._last_refusal: str | None = None
55
+
56
+ @property
57
+ def last_refusal(self) -> str | None:
58
+ """Return the last mutation's refusal reason, or None after success."""
59
+ return self._last_refusal
54
60
 
55
61
  @staticmethod
56
62
  def _timestamp(value: Any) -> float:
@@ -131,10 +137,12 @@ class DispatcherWakeStore:
131
137
 
132
138
  def enqueue(self, pr_number: int, head_sha: str, event: str, resume_at: float, now: float | None = None) -> bool:
133
139
  """Persist a deduplicated intent without shortening an existing deadline."""
140
+ self._last_refusal = None
134
141
  current = self._timestamp(time.time() if now is None else now)
135
142
  deadline = self._timestamp(resume_at)
136
143
  key = self._key(pr_number, head_sha, event)
137
144
  if deadline >= current + self.TTL_SECONDS:
145
+ self._last_refusal = "deadline-beyond-ttl"
138
146
  return False
139
147
  entry = {
140
148
  "version": 1,
@@ -147,25 +155,32 @@ class DispatcherWakeStore:
147
155
  "expires_at": current + self.TTL_SECONDS,
148
156
  "status": "pending",
149
157
  }
150
- return self._valid(key, entry) and self._update(key, entry, None, current)
158
+ if not self._valid(key, entry):
159
+ self._last_refusal = "invalid-entry"
160
+ return False
161
+ return self._update(key, entry, None, current)
151
162
 
152
163
  def acknowledge(self, key: str, expected_entry: dict, now: float | None = None) -> bool:
153
164
  """Retain a delivered tombstone only if the pending snapshot still matches."""
165
+ self._last_refusal = None
154
166
  current = self._timestamp(time.time() if now is None else now)
155
167
  return self._change(key, expected_entry, None, current)
156
168
 
157
169
  def postpone(self, key: str, expected_entry: dict, resume_at: float, now: float | None = None) -> bool:
158
170
  """Monotonically postpone a matching pending snapshot, within its original TTL."""
171
+ self._last_refusal = None
159
172
  current = self._timestamp(time.time() if now is None else now)
160
173
  return self._change(key, expected_entry, self._timestamp(resume_at), current)
161
174
 
162
175
  def _change(self, key: str, expected: dict, deadline: float | None, current: float) -> bool:
163
176
  if not self._valid(key, expected) or expected["status"] != "pending" or expected["expires_at"] <= current:
177
+ self._last_refusal = "invalid-entry"
164
178
  return False
165
179
  desired = dict(expected)
166
180
  if deadline is None:
167
181
  desired["status"] = "delivered"
168
182
  elif deadline >= expected["expires_at"]:
183
+ self._last_refusal = "deadline-beyond-expiry"
169
184
  return False
170
185
  else:
171
186
  desired["resume_at"] = max(deadline, expected["resume_at"])
@@ -175,35 +190,48 @@ class DispatcherWakeStore:
175
190
  known: dict[str, Any] = {}
176
191
  with _WRITE_LOCK:
177
192
  for attempt in range(3):
193
+ cause = None
194
+ stage = "read"
178
195
  try:
179
196
  observed = self._read()
180
197
  observed_records = self._prepare(observed, current)
181
198
  actual = observed_records.get(key)
182
199
  if expected is not None and actual != expected and (attempt == 0 or actual != desired):
200
+ self._last_refusal = "snapshot-mismatch"
183
201
  return False
184
202
  known = _merge_payloads(known, observed)
185
203
  records = self._prepare(known, current)
186
204
  previous = records.get(key)
187
205
  if expected is None and previous is not None:
188
206
  if not self._valid(key, previous):
207
+ self._last_refusal = "invalid-existing"
189
208
  return False
190
209
  desired = dict(previous, resume_at=max(previous["resume_at"], desired["resume_at"]))
191
210
  if desired["resume_at"] >= desired["expires_at"]:
211
+ self._last_refusal = "deadline-beyond-expiry"
192
212
  return False
193
213
  if len(records) > self.MAX_ENTRIES or (previous is None and len(records) >= self.MAX_ENTRIES):
214
+ self._last_refusal = "entry-capacity"
194
215
  return False
195
216
  records[key] = desired
196
217
  encoded = json.dumps(known, separators=(",", ":"), sort_keys=True)
197
218
  if len(encoded.encode()) > self.MAX_BYTES:
219
+ self._last_refusal = "byte-capacity"
198
220
  return False
221
+ stage = "write"
199
222
  self.provider.set_variable(COOLDOWN_VARIABLE, encoded)
223
+ stage = "verify-read"
200
224
  verified = self._read()
201
225
  verified_records = self._prepare(verified, current)
202
226
  combined = _merge_payloads(known, verified)
203
227
  target: Any = verified_records.get(key)
204
228
  if combined == verified and self._valid(key, target) and (expected is None or target == desired):
229
+ self._last_refusal = None
205
230
  return True
206
231
  known = combined
232
+ cause = "verification-failed"
207
233
  except Exception as exc:
234
+ cause = f"{stage}-error:{type(exc).__name__}"
208
235
  logger.warning("Could not persist dispatcher wake; retrying: %s", type(exc).__name__)
236
+ self._last_refusal = cause
209
237
  return False
@@ -97,8 +97,12 @@ class DispatcherWakeup:
97
97
  paused = _provider_cooldown(provider, datetime.fromtimestamp(now, UTC))
98
98
  if paused is not None:
99
99
  number, sha, event = self._current_wake_identity()
100
- if not DispatcherWakeStore(provider).enqueue(number, sha, event, paused[1].resume_at, now=now):
101
- raise RuntimeError("Dispatcher wake was not preserved; the scheduler wake-up was not handled")
100
+ store = DispatcherWakeStore(provider)
101
+ if not store.enqueue(number, sha, event, paused[1].resume_at, now=now):
102
+ raise RuntimeError(
103
+ "Dispatcher wake was not preserved; the scheduler wake-up was not handled "
104
+ f"(reason: {store.last_refusal})"
105
+ )
102
106
  with open(output_path, "a", encoding="utf-8") as output:
103
107
  output.write("throttled=true\n")
104
108
  print(
@@ -122,8 +126,12 @@ class DispatcherWakeup:
122
126
  paused = _provider_cooldown(provider, datetime.fromtimestamp(now, UTC))
123
127
  if paused is not None:
124
128
  number, sha, event = self._current_wake_identity()
125
- if not DispatcherWakeStore(provider).enqueue(number, sha, event, paused[1].resume_at, now=now):
126
- raise RuntimeError("Dispatcher wake was not preserved; the scheduler wake-up was not handled")
129
+ store = DispatcherWakeStore(provider)
130
+ if not store.enqueue(number, sha, event, paused[1].resume_at, now=now):
131
+ raise RuntimeError(
132
+ "Dispatcher wake was not preserved; the scheduler wake-up was not handled "
133
+ f"(reason: {store.last_refusal})"
134
+ )
127
135
  print(
128
136
  f"::notice::Dispatcher wake deferred by provider cooldown for PR {number} head {sha} event {event}."
129
137
  )
@@ -200,8 +208,12 @@ class DispatcherWakeup:
200
208
  except Exception as exc:
201
209
  shared_persisted = False
202
210
  print(f"::warning::Shared provider cooldown persistence failed ({type(exc).__name__}).")
203
- if not DispatcherWakeStore(provider).enqueue(number, sha, event, resume_at, now=now):
204
- raise RuntimeError("Dispatcher wake was not preserved; the scheduler wake-up was not handled") from error
211
+ store = DispatcherWakeStore(provider)
212
+ if not store.enqueue(number, sha, event, resume_at, now=now):
213
+ raise RuntimeError(
214
+ "Dispatcher wake was not preserved; the scheduler wake-up was not handled "
215
+ f"(reason: {store.last_refusal})"
216
+ ) from error
205
217
  if not shared_persisted:
206
218
  print(
207
219
  "::warning::Shared provider cooldown persistence is unconfirmed or shorter than the resolved deadline; "
@@ -92,9 +92,9 @@ class PipelineRunSummary:
92
92
  derived_unresolved_threads: Unresolved-thread count held by the derived
93
93
  state at the end of the run — the value the gates actually read.
94
94
  ``None`` when unknown (e.g. summaries built without a pipeline run).
95
- session_evidence: Current-run typed session state or its shared display
96
- projection. ``None`` when no action collected session state during
97
- the run.
95
+ session_evidence: Current-run typed session state, ordered session/lifecycle
96
+ state pair, or shared display projection. ``None`` when no action
97
+ collected session state during the run.
98
98
  """
99
99
 
100
100
  results: list[ActionResult] = field(default_factory=list)
@@ -103,4 +103,4 @@ class PipelineRunSummary:
103
103
  timestamp: str = ""
104
104
  trigger_reason: str = ""
105
105
  derived_unresolved_threads: int | None = None
106
- session_evidence: SessionState | SessionEvidencePresentation | None = None
106
+ session_evidence: SessionState | tuple[SessionState, SessionState] | SessionEvidencePresentation | None = None
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import html
6
6
  from dataclasses import replace
7
7
 
8
+ from agentic_devtools.cli.ci.agent_task_inventory import FailureCategory
8
9
  from agentic_devtools.cli.ci.pipeline.session_detector import SessionOutcome, SessionState
9
10
  from agentic_devtools.cli.ci.pipeline.snapshot_models import PRStateSnapshot
10
11
  from agentic_devtools.cli.ci.session_evidence_presentation import (
@@ -19,17 +20,11 @@ from agentic_devtools.cli.ci.session_evidence_presentation import (
19
20
  def _render_state_snapshot(
20
21
  snapshot: PRStateSnapshot,
21
22
  derived_unresolved_threads: int | None = None,
22
- session_evidence: SessionState | SessionEvidencePresentation | None = None,
23
+ session_evidence: SessionState | tuple[SessionState, SessionState] | SessionEvidencePresentation | None = None,
23
24
  ) -> str:
24
25
  """Render snapshot fields and any typed session evidence collected in this run."""
25
26
 
26
- def sanitize(value: str) -> str:
27
- normalized = value.replace("\r\n", "\n").replace("\r", "\n")
28
- escaped = html.escape(normalized, quote=False)
29
- return escaped.replace("|", "\\|").replace("\n", "<br>")
30
-
31
- if isinstance(session_evidence, SessionState):
32
- state = session_evidence
27
+ def project_state(state: SessionState) -> SessionEvidencePresentation:
33
28
  failure_source = state.failure_source
34
29
  source = {
35
30
  "agent-task-inventory": "session-lookup",
@@ -37,24 +32,48 @@ def _render_state_snapshot(
37
32
  "unsupported-agent-task-lifecycle": "lifecycle-reconciliation",
38
33
  }.get(failure_source or "", failure_source or "session-lookup")
39
34
  diagnostics = (
40
- (
41
- SessionEvidenceDiagnostic(
42
- source,
43
- state.failure_category,
44
- state.http_status,
45
- failure_source or "",
46
- ),
47
- )
35
+ (SessionEvidenceDiagnostic(source, state.failure_category, state.http_status, failure_source or ""),)
48
36
  if failure_source or state.failure_category is not None or state.http_status is not None
49
37
  else ()
50
38
  )
51
- session_evidence = project_session_evidence(
39
+ projection = project_session_evidence(
52
40
  session_active={SessionOutcome.ACTIVE: True, SessionOutcome.UNKNOWN: None}.get(state.outcome, False),
53
41
  reason=failure_source or state.outcome.value,
54
42
  identities=((state.task_id or "", ""),),
55
43
  diagnostics=diagnostics,
56
44
  )
57
- session_evidence = replace(session_evidence, status=state.outcome)
45
+ return replace(projection, status=state.outcome)
46
+
47
+ def sanitize(value: str) -> str:
48
+ normalized = value.replace("\r\n", "\n").replace("\r", "\n")
49
+ escaped = html.escape(normalized, quote=False)
50
+ return escaped.replace("|", "\\|").replace("\n", "<br>")
51
+
52
+ if isinstance(session_evidence, tuple):
53
+ session_projection, lifecycle_projection = (project_state(state) for state in session_evidence)
54
+ projections = (session_projection, lifecycle_projection)
55
+ diagnostics = tuple(item for projection in projections for item in projection.diagnostics)
56
+ identities = tuple((projection.task_id or "", projection.session_id or "") for projection in projections)
57
+ not_found = any(
58
+ item.failure_category is FailureCategory.HTTP_NOT_FOUND or item.http_status == 404 for item in diagnostics
59
+ )
60
+ active = session_projection.display_status is SessionOutcome.ACTIVE and not not_found
61
+ combined = project_session_evidence(
62
+ session_active=True
63
+ if active
64
+ else None
65
+ if not_found or session_projection.display_status is SessionOutcome.UNKNOWN
66
+ else False,
67
+ reason="incomplete-session-evidence" if not_found else session_projection.reason,
68
+ identities=identities,
69
+ diagnostics=diagnostics,
70
+ )
71
+ session_evidence = replace(
72
+ combined,
73
+ status=SessionOutcome.UNKNOWN if not_found else session_projection.status,
74
+ )
75
+ elif isinstance(session_evidence, SessionState):
76
+ session_evidence = project_state(session_evidence)
58
77
 
59
78
  head_sha_short = sanitize(snapshot.head_sha[:7])
60
79
  review_state = sanitize(snapshot.review_state or "none")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentic-devtools
3
- Version: 0.2.657
3
+ Version: 0.2.659
4
4
  Summary: Agentic devtools integrate Jira, DevOps & more
5
5
  Author: ayaiayorg
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
1
  agentic_devtools/__init__.py,sha256=gvLzsZ6L3Abr4sPHr4OJ_rdZDD8cFzXacaV0LGs8dVc,539
2
- agentic_devtools/_version.py,sha256=7FiEfcxvUIl7-VWctawaO1mtN4ng2C031ATW1-GHefs,524
2
+ agentic_devtools/_version.py,sha256=EGLpGli0IqyJyMRpZAfe21y0wKgrsJ2-DWyvnaXkVpI,524
3
3
  agentic_devtools/agdt_gitignore.py,sha256=vVVqTjBZ_ijn6U3Lnh_JGrARLschYVN-fFal9jDk0Ak,2694
4
4
  agentic_devtools/background_tasks.py,sha256=sFgmqOnCdCjclABJ8V__yDwBXDyi45b1Z-MVv3G2zB8,17664
5
5
  agentic_devtools/config.py,sha256=DEVxTVZhsQbVQwO9qdB_1h19aBpjMzF6xJY_ePYLGLs,15629
@@ -258,8 +258,8 @@ agentic_devtools/cli/ci/dispatch_state_codec.py,sha256=VELG4U_JzaSm9u4_JNHHkGJMg
258
258
  agentic_devtools/cli/ci/dispatcher_policy.py,sha256=ZE5Wc1uBL_or9sF9Sd1K1On7j_3Pw6CUUvhj9Hi80aw,7105
259
259
  agentic_devtools/cli/ci/dispatcher_throttle.py,sha256=q7x2xqHZzCpGtvxcWUPhQXXHhceu2XpoVzZnCr9eeXU,10113
260
260
  agentic_devtools/cli/ci/dispatcher_wake_replay.py,sha256=TSmyRXa7Itj29Rxbl7z6sIx5E7IPfra0VBE7w4RlMBU,18031
261
- agentic_devtools/cli/ci/dispatcher_wake_store.py,sha256=cV0UWO3SPdmsOll2Vl66RqLgaE3KJuUNzIF6thCG6Go,9713
262
- agentic_devtools/cli/ci/dispatcher_wakeup.py,sha256=ypdnMatom0XxDpTnt33CAjsB-XUOXpDgRquIQkMFNCs,12627
261
+ agentic_devtools/cli/ci/dispatcher_wake_store.py,sha256=Ls6BKN67LGvoFVzIQAYA9G54HzqtSoEfqE8qTIRwgVs,10949
262
+ agentic_devtools/cli/ci/dispatcher_wakeup.py,sha256=6toDxOoGuT-bH1aXtjg6YAdJvGYZklv7wtupVbUEkmk,13016
263
263
  agentic_devtools/cli/ci/due_probe_wakeup.py,sha256=4Tie-_cSFlYlkb6o3kJUZt9RaIiROBd5Crm5QAqSxfY,13494
264
264
  agentic_devtools/cli/ci/exceptions.py,sha256=zpKWOgnBbHHQgAQRvdRW4VFnE_qdgqgmo8r1H-x47l4,1086
265
265
  agentic_devtools/cli/ci/finalization_state.py,sha256=jQm_cH0J09LCZfEUdZK2XQNZFhF7KhyilKcGZ4g8Wzc,8978
@@ -345,13 +345,13 @@ agentic_devtools/cli/ci/pipeline/gate_verdict.py,sha256=-vbp24Kr172wXpB5T-y9lm-7
345
345
  agentic_devtools/cli/ci/pipeline/lifecycle_reconciliation_support.py,sha256=R15VC18-xSUEMoTtI8y9z5xYIFLWloWXAvnDPSSPtvM,2405
346
346
  agentic_devtools/cli/ci/pipeline/markdown_comments.py,sha256=nNGHpAWwLtXbe8Vg4cmZSziXJ-FD_Fcv8todJvBGfY8,929
347
347
  agentic_devtools/cli/ci/pipeline/markdown_fences.py,sha256=pJgoDLfodIqrtm167fWckShLLNW-mCfatbn_5BLoQoc,1244
348
- agentic_devtools/cli/ci/pipeline/models.py,sha256=jKuSunZ8FDsVFbIUwLkMVZdfVun9bc_SKvcxLW7s9Ls,4501
348
+ agentic_devtools/cli/ci/pipeline/models.py,sha256=ijq3ClT7_ACOUIogKit-mA7PN77TPRtm7F4zsurdbcQ,4572
349
349
  agentic_devtools/cli/ci/pipeline/repair_attempts.py,sha256=K9JgsxIW0CjxfV6PMmZRKd6w7qsTYClZvzwFSu7shsA,11054
350
350
  agentic_devtools/cli/ci/pipeline/runner.py,sha256=0lXe0sr8GB9VWejOIHZimWy9GF_obRFn9agO-ugCWgM,76902
351
351
  agentic_devtools/cli/ci/pipeline/runner_diff_fingerprint.py,sha256=EpasXQX_wUpK3m3jRPTNJCbDU0yDAQQlsg1CynvuKXg,2055
352
352
  agentic_devtools/cli/ci/pipeline/runner_diff_parser.py,sha256=T3ofZoUxKGZaGSyx5dF9yc3ddwRh7tKXWRA7lDaT59Y,17369
353
353
  agentic_devtools/cli/ci/pipeline/session_detector.py,sha256=5M-vxpxu12BVFz-OQEFxyCs_6IoEBzcw8IqeOiXofJU,66633
354
- agentic_devtools/cli/ci/pipeline/session_evidence_summary.py,sha256=BK2-eSZg0vOfRNDnuJZjANeZlHZ6Je6ryO2xa0jrfhk,4557
354
+ agentic_devtools/cli/ci/pipeline/session_evidence_summary.py,sha256=wLM6s3AeV265YbAr_S58kMkICFvM85ky9gsjaqiDlLY,5855
355
355
  agentic_devtools/cli/ci/pipeline/snapshot_builder.py,sha256=WxMSAsfK1h1StwkWAOVHgaorvBpKyjeCAcD1ekGHt8g,20116
356
356
  agentic_devtools/cli/ci/pipeline/snapshot_ci.py,sha256=nvtqRVSEnjWUSCXLEUVa9-JBmMXV08cOLEczogorNTc,4531
357
357
  agentic_devtools/cli/ci/pipeline/snapshot_models.py,sha256=htimdF2kUdcnNzIlhbZ_6bT-dzo72bVeMqgxnr0dX0c,12610
@@ -1346,8 +1346,8 @@ agentic_devtools/_bundled_skills/skills/speckit-plan/SKILL.md,sha256=qYLpzgLCIZ6
1346
1346
  agentic_devtools/_bundled_skills/skills/speckit-specify/SKILL.md,sha256=HbHRbdphMqbtNw6fL6NcYCj6sSFmUyk2S4U0bZ9p_l4,13681
1347
1347
  agentic_devtools/_bundled_skills/skills/write-github-commit-message/SKILL.md,sha256=Ep1lR8NDN117Iytj172VZgqazFiLpJ56Z7RXgaTnxR8,2626
1348
1348
  agentic_devtools/_bundled_skills/skills/write-github-commit-message/commit-types.md,sha256=bTy_t68ZD6R87rFIzq9wybTu8Wudoahb7nB9IWC4bFo,1839
1349
- agentic_devtools-0.2.657.dist-info/METADATA,sha256=3HbhsXMXF5-TZAM9gMkLWL8PSxyS7GRyjZsq-KOH_2I,35594
1350
- agentic_devtools-0.2.657.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
1351
- agentic_devtools-0.2.657.dist-info/entry_points.txt,sha256=oHUiF-YvDtXSMTUh0E2bwYKGn4hZlIVbBRaQGSFXASc,13696
1352
- agentic_devtools-0.2.657.dist-info/licenses/LICENSE,sha256=yBEDdICksxhBYLWoERKp9MTqwGnUF6Ryj9BTLwXTc6k,1082
1353
- agentic_devtools-0.2.657.dist-info/RECORD,,
1349
+ agentic_devtools-0.2.659.dist-info/METADATA,sha256=aB3NMmusIGVew2t_ZFyjZXv2fkqD260-WPNex2sqVEo,35594
1350
+ agentic_devtools-0.2.659.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
1351
+ agentic_devtools-0.2.659.dist-info/entry_points.txt,sha256=oHUiF-YvDtXSMTUh0E2bwYKGn4hZlIVbBRaQGSFXASc,13696
1352
+ agentic_devtools-0.2.659.dist-info/licenses/LICENSE,sha256=yBEDdICksxhBYLWoERKp9MTqwGnUF6Ryj9BTLwXTc6k,1082
1353
+ agentic_devtools-0.2.659.dist-info/RECORD,,