<reasoning_content>
*   Input: Extend `JobQueue` class.
    *   Method to add: `process_job(job_id: str, Processor: Callable) -> bool`.
    *   Functionality:
        1.  Find `data` associated with `job_id` from `add_job(job_id, data)`.
        2.  Call `processor(data)`.
        3.  On exception, retry up to 4 times (1 initial + 3 retries).
        4.  Track retry count per job.
        5.  Exponential backoff (1s, 2s, 4s).
        6.  *No actual sleep*: Record delays as data.
        7.  Return `True` on success, `False` if all 4 fail.
    *   Constraints: Standard library only, Python code only, no explanations.

    *   Since the original `JobQueue` wasn't provided in the prompt, I need to assume a basic structure for it or define it in a way that makes sense for the requested extension. Usually, `add_job` stores a dictionary of `job_id` -> `data`.
    *   The prompt asks to *extend* it. I will provide the class with the `add_job` and `process_job` methods.

    *   `jobs`: A dictionary mapping `job_id` to `data`.
    *   `retry_counts`: A dictionary mapping `job_id` to count.
    *   `backoffs`: A dictionary mapping `job_id` to a list of delays.

    *   `add_job(job_id, data)`: Stores data.
    *   `process_job(job_id, processor)`:
        *   Retrieve `data` for `job_id`.
        *   Loop up to 4 times.
        *   Inside loop:
            *   Try `processor(data)`.
            *   If success, return `True`.
            *   If exception:
                *   Increment retry count.
                *   Calculate backoff (1s, 2s, 4s) - wait, the prompt says "record the delays as data". This implies I should probably store the *intended* delay in the data or a tracking dict.
                *   Actually, the prompt says "Do NOT actually sleep — record the delays as data." This probably means if it fails, and we are going to retry, we note that we *would* have waited $2^{(retry-1)}$ seconds.

    *   Retry counts:
        *   Attempt 1: Fail.
        *   Attempt 2: Delay 1s.
        *   Attempt 3: Delay 2s.
        *   Attempt 4: Delay 4s.
    *   If Attempt 4 fails, return `False`.

    *   `self.jobs = {}`
    *   `self.retry_counts = {}`
    *   `self.recorded_delays = {}`

    Wait, the prompt says "record the delays as data". Does it mean in the `data` dict passed to `add_job`? Or a separate field?
    "Track the retry count per job. Use exponential backoff (delays of 1s, 2s, 4s). Do NOT actually sleep — record the delays as data."

    Let's assume `self.jobs[job_id]` is the dict. I'll add a key like `"retries"` and `"delays"` to that dict or keep internal state.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data
            self.jobs[job_id]['retries'] = 0
            self.jobs[job_id]['delays'] = []

        def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
            if job_id not in self.jobs:
                return False

            data = self.jobs[job_id]
            max_attempts = 4

            for attempt in range(max_attempts):
                try:
                    processor(data)
                    return True
                except Exception:
                    if attempt < max_attempts - 1:
                        # Attempt indices: 0 (init), 1 (retry 1), 2 (retry 2), 3 (retry 3)
                        # Delays: 1s, 2s, 4s
                        delay = 2 ** attempt
                        data['retries'] += 1
                        data['delays'].append(delay)
                    else:
                        # All attempts failed
                        break

            return False
    ```

    Wait, "delays of 1s, 2s, 4s".
    Attempt 1 fails -> Delay 1s (recorded).
    Attempt 2 fails -> Delay 2s (recorded).
    Attempt 3 fails -> Delay 4s (recorded).
    Attempt 4 fails -> Return False.

    Let's refine the `process_job` logic.

    ```python
    def process_job(self, job_id: str, processor: Callable) -> bool:
        data = self.jobs.get(job_id)
        if not data:
            return False

        for attempt in range(4):
            try:
                processor(data)
                return True
            except Exception:
                if attempt < 3:
                    delay = 2 ** attempt
                    data['retry_count'] = data.get('retry_count', 0) + 1
                    data['recorded_delays'] = data.get('recorded_delays', []) + [delay]
                else:
                    return False
        return False
    ```

    Actually, the prompt says "Track the retry count per job". It doesn't say where. Standard practice is to keep it inside the dictionary or as an instance attribute. I'll use an instance attribute for count and record delays in the data or another list.

    Let's look at the prompt again: "record the delays as data". This usually implies modifying the `data` dict passed in `add_job`.

    Revised logic:
    1. `add_job` takes `data` dict.
    2. `process_job` finds `data`.
    3. Loop 4 times.
    4. Exception?
       - If attempt < 4:
         - delay = 1, 2, 4 (for attempts 1, 2, 3 failure).
         - record delay in `data`.
         - update retry count.

    Wait, if it fails on attempt 1, we record 1s.
    If it fails on attempt 2, we record 2s.
    If it fails on attempt 3, we record 4s.
    If it fails on attempt 4, we return False.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data
            self.jobs[job_id]['retry_count'] = 0
            self.jobs[job_id]['recorded_delays'] = []

        def process_job(self, job_id: str, processor: Callable) -> bool:
            data = self.jobs.get(job_id)
            if data is None:
                return False

            for attempt in range(4):
                try:
                    processor(data)
                    return True
                except Exception:
                    if attempt < 3:
                        delay = 2 ** attempt
                        data['retry_count'] += 1
                        data['recorded_delays']].append(delay)
                    else:
                        return False
            return False
    ```

    One detail: "Track the retry count per job".
    "Record the delays as data".
    I will put `retry_count` and `recorded_delays` inside the `data` dictionary to satisfy "record... as data".

    Wait, the prompt says `process_job(job_id: str, Processor: Callable) -> bool`. I'll make sure the signature is exact.

    ```python
    from typing import Callable, Dict, Any

ally    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            # Ensure data is a dict and copy it to avoid mutation issues if desired, 
            # but standard practice is to just store it.
            self.jobs[job_id] = data
            self.jobs[job_id].setdefault('retry_count', 0)
            self.jobs[job_id].setdefault('recorded_delays', [])

        def process_job(self, job_id: str, processor: Callable) -> bool:
            data = self.jobs.get(job_id)
            if data is None:
                return False

            for attempt in range(4):
                try:
                    processor(data)
                    return True
                except Exception:
                    if attempt < 3:
                        delay = 2 ** attempt
                        data['retry_count'] = data.get('retry_count', 0) + 1
                        data['recorded_delays'] = data.get('recorded_delays', []) + [delay]
                    else:
                        return False
            return False
    ```

    Refining "delays of 1s, 2s, 4s".
    Attempt 0 (initial): Fails. Next delay is 2^0 = 1.
    Attempt 1 (retry 1): Fails. Next delay is 2^1 = 2.
    Attempt 2 (retry 2): Fails. Next delay is 2^2 = 4.
    Attempt 3 (retry 3): Fails. Return False.

    This matches "Make up to 4 total attempts (initial + 3 retries)".

    Final check on requirements:
    1. Call `processor(data)`. (Yes)
    2. On exception, retry (up to 4 total). (Yes)
    3. Track retry count. (Yes)
    4. Exponential backoff (1, 2, 4). (Yes, 2^0, 2^1, 2^2)
    5. Do NOT sleep, record delays. (Yes)
    6. Return True on success, False on total failure. (Yes)
    7. Standard library only. (Yes)
    8. Python code only, no explanations. (Yes)

    One small detail: `self.jobs[job_id]` might be mutated by the processor. I should be careful, but the prompt doesn't specify deep copying.

    Wait, the prompt asks to *extend* the `JobQueue` class. I should provide the class definition including `add_job`.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data
            if 'retry_count' not in self.jobs[job_id]]:
                self.jobs[job_id]['retry_count'] = 0
            if 'recorded_delays' not in self.jobs[job_id]]:
                self.jobs[job_id]['recorded_delays'] = []

        def process_job(self, job_id: str, processor: Callable) -> bool:
            data = self.jobs.get(job_id)
            if data is None:
                return False
            
            for attempt in range(4):
                try:
                    processor(data)
                    return True
                except Exception:
                    if attempt < 3:
                        delay = 2 ** attempt
                        data['retry_count'] = data.get('retry_count', 0) + 1
                        data['recorded_delays'] = data.get('recorded_delays', []) + [delay]
                    else:
                        return False
            return False
    ```

    Wait, "Track the retry count per job". If `add_job` is called multiple times with the same ID, should it reset? Usually, `add_job` implies a new job.

    I'll make sure `retry_count` and `recorded_delays` are handled cleanly.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            # Ensure we don't overwrite metadata if data already has it, 
            # but usually add_job is for fresh data.
            self.jobs[job_id] = data
            self.jobs[job_id].setdefault('retry_count', 0)
            self.jobs[job_id]].setdefault('recorded_delays', [])

        def process_job(self, job_id: str, processor: Callable) -> bool:
            job_data = self.jobs.get(job_id)
            if job_data is None:
                return False
            
            for attempt in range(4):
                try:
                    processor(job_data)
                    return True
                except Exception:
                    if attempt < 3:
                        delay = 2 ** attempt
                        job_data['retry_count'] = job_data.get('retry_count', 0) + 1
                        job_data['recorded_delays'] = job_data.get('recorded_delays', []) + [delay]
                    else:
                        return False
            return False
    ```

    Wait, the prompt says `process_job(job_id: str, Processor: Callable)`. I should use the exact capitalization if specified, but usually, Python is lowercase. The prompt says `Processor: Callable` (Capital P). I'll stick to the prompt's signature exactly if possible, but usually, lowercase `processor` is standard. I will use the prompt's capitalization for the argument name just in case.

    Signature requested: `process_job(job_id: str, Processor: Callable) -> bool`

    One check: "record the delays as data".
    The prompt says "Do NOT actually sleep — record the delays as data."
    This could mean adding them to a list in the `data` dictionary.

    Actually, I will make sure `retry_count` is also part of the data dict to satisfy "Track the retry count per job" and "record... as data".

    Wait, `data` is the dict passed to `add_job`.
    If I modify `data` in `process_job`, it affects `self.jobs[job_id]`. That's correct.

    One last check: `delays of 1s, 2s, 4s`.
    Attempt 0 fails: record 2^0 = 1.
    Attempt 1 fails: record 2^1 = 2.
    Attempt 2 fails: record 2^2 = 4.
    Attempt 3 fails: return False.
    Total 4 attempts. Perfect.
</reasoning_content>

<content>
```python
from typing import Callable, Dict, Any

class JobQueue:
    def __init__(self):
        self.jobs: Dict[str, Dict[str, Any]] = {}

    def add_job(self, job_id: str, data: Dict[str, Any]):
        self.jobs[job_id] = data
        self.jobs[job_id]].setdefault('retry_count', 0)
        self.jobs[job_id]].setdefault('recorded_delays', [])

    def process_job(self, job_id: str, Processor: Callable) -> bool:
        data = self.jobs.get(job_id)
        if data is None:
            return False

        for attempt in range(4):
            try:
                Processor(data)
                return True
            except Exception:
                if attempt < 3:
                    delay = 2 ** attempt
                    data['retry_count'] = data.get('retry_count', 0) + 1
                    data['recorded_delays'] = data.get('recorded_delays', []) + [delay]
                else:
                    return False
        return False
```
</content>