@misterhuydo/sentinel 1.1.5 → 1.1.7

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "message": "Auto-checkpoint at 2026-03-23T08:53:48.152Z",
3
- "checkpoint_at": "2026-03-23T08:53:48.153Z",
2
+ "message": "Auto-checkpoint at 2026-03-23T09:08:47.973Z",
3
+ "checkpoint_at": "2026-03-23T09:08:47.974Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"
@@ -181,6 +181,12 @@ When to act vs. when to ask:
181
181
  - If a tool call will take a moment (search, fetch, pull), prefix your reply with a brief "working" line ending in "..." before the results, e.g. "Searching SSOLWA for TryDig activity..." then the actual output.
182
182
  Never just say a working line and stop — always follow it with the results in the same message.
183
183
 
184
+ Session context — critical rules:
185
+ - Loaded conversation history is prior-session background only. It may be hours or days old.
186
+ - NEVER say "the previous search", "I already fetched", "as I found earlier", or any phrase implying you already did part of the current task — unless a tool result appears in THIS response's tool calls.
187
+ - When handling a new request, call the tools fresh. Do not assume any prior tool result is still current or that any prior step "counts" toward the current task.
188
+ - The only exception: if the user explicitly asks about something from the history ("what did you find earlier?"), you may reference it — but note it is from a prior session.
189
+
184
190
  Issue identification — before calling create_issue:
185
191
  1. Determine if the message is a REAL issue/task (bug report, feature request, investigation ask)
186
192
  vs. a status question, tool query, or casual chat. If not an issue, just answer normally.
@@ -2010,7 +2016,7 @@ async def handle_message(
2010
2016
  from .notify import rate_limit_message
2011
2017
  alert_if_rate_limited(cfg.slack_bot_token, cfg.slack_channel,
2012
2018
  "sentinel_boss/api", err_str)
2013
- logger.warning("Boss: API key path failed (%s), trying CLI fallback", err_str[:80])
2019
+ logger.warning("Boss: API key path failed (%s), trying CLI fallback", err_str)
2014
2020
 
2015
2021
  # 2nd priority: Claude Pro / OAuth via CLI (limited tools but no API key needed)
2016
2022
  cli_reply, cli_done = await _handle_with_cli(
@@ -371,12 +371,32 @@ async def _run_turn(session: _Session, message: str, client, cfg_loader, store,
371
371
  channel = session.channel
372
372
 
373
373
  # Load persisted history from DB on the first turn of a new session.
374
- # Clean it to strip any orphaned tool_use turns from a previous crashed session.
374
+ # - _clean_history strips orphaned tool_use turns from a previous crashed session.
375
+ # - Trim to last 6 exchanges (12 messages) to prevent stale tool results from bleeding
376
+ # into the current session and causing the model to treat old work as already done.
377
+ # - Inject a session boundary marker so the model clearly sees where prior context ends.
375
378
  if not session.history_loaded:
376
- session.history = _clean_history(store.load_conversation(session.user_id))
379
+ loaded = _clean_history(store.load_conversation(session.user_id))
380
+ if loaded:
381
+ # Keep only the most recent 6 exchanges from prior session
382
+ _PRIOR_TURNS = 6
383
+ trimmed = loaded[-(_PRIOR_TURNS * 2):]
384
+ # Prepend a boundary pair so the model treats everything before it as old context
385
+ session.history = [
386
+ {
387
+ "role": "user",
388
+ "content": "[system: new session started — the following is prior conversation context only]",
389
+ },
390
+ {
391
+ "role": "assistant",
392
+ "content": [{"type": "text", "text": "Understood. I'll treat the prior context as reference only and handle your new request fresh."}],
393
+ },
394
+ ] + trimmed
395
+ else:
396
+ session.history = []
377
397
  session.history_loaded = True
378
398
 
379
- # Trim history to avoid context overflow on long conversations
399
+ # Trim history to avoid context overflow on long active conversations
380
400
  if len(session.history) > _MAX_HISTORY_TURNS * 2:
381
401
  session.history = session.history[-(_MAX_HISTORY_TURNS * 2):]
382
402